How Binary Numbers Work. (easy)

88

1

Introduction: How Binary Numbers Work. (easy)

As a teacher I used the following to explain Binary number system to my students. Most seemed to grasp it better than adults did!

Supplies

None required although a white board is useful.

Step 1: Decimal Numbers

We have available 10 decimal numbers 0,1,2,3,4,5,6,7,8,9

The next number is?

Well most people will say 10 but that is really wrong because we only have 0 to 9 numbers to use.

The next number is 0, we put a 1 before it to show we already passed zero once so we put 10. We have unfortunately given this combination a name and call it ten but it is really a 1 and a 0

Step 2: Extending This Idea to Bigger Numbers

We can continue this sequence 1,2,3,4,5,6,7,8,9 all with a 1 in front to show we have gone passed them once.

so 11,12,13,14,15,16,17,18,19

So what is the next number?

A few might say twenty so you have to repeat the only 10 numbers idea.

So the next number is 0 with a 2 in front to show we have gone passed 0 twice.

and so the sequence continues and all the class now get it.

Step 3: Moving on to a Two Digit System

In BINARY we only have 2 numbers 0 and 1

So the number sequence goes 0,1 what is the next number?

Most in a class will now say 0, a few will say 3 and you can remind them you only have 2 numbers to play with.

So we have to put a 1 in front of the 0 to show we went passed the 0 once already.

0,1,10, then

0,1,10,11,100,101, 110, 111 etc

We can draw this vertically to match the binary u with the equivalent decimal numbers.

Decimal Binary

0 0

1 1

2 1 0

3 1 1

4 1 0 0

5 1 0 1

6 1 1 0

7 1 1 1

8 1 0 0 0

9 1 0 0 1

10 1 0 1 0

etc

You can note that the decimal "value" of each binary bit is a power of 2

so:

8 4 2 1 Value as a power of 2

1 0 0 1 Binary number

so the Binary 1001 if we want to convert to decimal we can add together the values of each 1 binary bit

so 1001 = a value of 8 + a value of 1 = 9 (see table above to confirm.)

You can easily do this with any binary number as long as you can double the value of each binary position.

1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, etc.

This sequence should be familiar to anyone who has had anything to do with writing computer programmes.

Step 4: There Are Other Numbering Systemt As Well.

Some times for convenience, because it is hard to remember and say long sets of 0 and 1s. we can use different numbering systems or number bases (decimal is base 10, Binary is base 2)

For example OCTAL is base 8 so we have numbers from 0 to 7 ie 8 numbers to use

in Binary: 0, 1, 01, 11, 100, 101 110 111

Decimal 0 1 2 3 4 5 6 7

So to convert A big binary number to Octal we break the number into groups of 3 binary bits starting at the right hand side. The we evaluate those groups as if the were separate octal numbers expressed in binary.

so 11110011101 - (1949 in Decimal) ito convert to octal we break it into groups of 3 bits starting at the right hand side,

011 110 011 101

because the last group only has 2 binary bits in it we put a 0 in front to keep to the 3 binary bit pattern for Octal.

Convert those groups to octal = 3635 (oct) which = 1949 in decimal -

3635 is a lot easier to remember and say than 11110011101.

Octal isn't often used these days more normally computer people use Hexadecimal or base 16. - often just called Hex.

This uses 16 numbers 0,1,2,3,4,5,6,7,8,9 - Oh dear we ran out of numbers Ok we will just use letters as well so

0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

are our 16 hexadecimal numbers. To convert a binary number to hex we break the number into groups of 4 binary digits

and then convert each group into it's hex equivalent.

so 1949 = 11110011101 break into groups of 4 = 0111 1001 1101 or in hex 79D again a lot easier to say and remember.

One more example:

24,061,949 (dec) is

1 0110 1111 0010 0111 1111 1101 (bin)

or 16F 27FD (hex)

or 133 623 775 (oct)

You can open a scientific calculator on your PC and check this easily.