Tuesday, January 1, 2019

Learning  Binary

What do we mean by binary?  All digits have 2 numbers 1 and 0.

This is not initially intuitive but it is not too bad after we compare it to a system we commonly use which is based on tens.  This system is called the decimal system.

When we count in tens we do it as follows.
1 2 3 4 5 6 7 8 9 and after we get to the end of are units digit we carry a 1 to our next digit and get 10.
So as we go further from 10 it becomes 11 12 13 14 15 16 17 18 19 and we get to the end of our units digit and we carry a 1 into our tens digit and add it to the 1 already there and we have 20.

You may be asking why we are doing this.  We already know this and it seems natural but our new number system is similar but because we only have 2 numbers we go like this.
1 10 11 100 101 110 111 1000 1001...............
Okay this is becoming more clear.  As you can see our 2 numbers are 1 and 0 but every time we go from 1 to the next number we carry into the next digit. 

Lets go a little further in our counting:
1001 1010 1011 1100 1101 1110 1111 10000 10001 10010 10011 10100 10101 10110 10111 11000 11001 11010 11011 11100 11101 11110 11111 100000

Okay now you got it.  Practice counting by looking away from the numbers above and check once you are done.  You will get it pretty quick.

Now how would we convert binary to our decimal number system:

Lets look at a number. 11101 Now lets break it a part and we have 1 in the 5th place and 1 in the 4th place and 1 in the 3rd place 0 in the 2nd place 1 in the unit or ones place.

So this is more clear we will count along with the decimal equivalent so we can see what is happening.
1 2    3   4     5     6     7     8       9       10     11      12     13     14     15    16      17        18       19
1 10 11 100 101 110 111 1000 1001 1010 1011  1100 1101 1110 1111 10000 10001 10010 10011
 20       21        22      23       24       25       26       27       28      29     
10100 10101 10110 10111 11000 11001 11010 11011 11100 11101

Now that doesn't seem too easy does it?  There is an easier way but this demonstrates how the number systems correspond.
First any digit that is 0 will represent 0 for that digit.
The first digit is equal to 1 so 1=1 and 0=0
The second digit equal to 2 so 10=2 and 00=0
The third digit is equal to 2² =4 so 100=4
The forth digit is equal to 2³=8 so 1000=8
The fifth digit is equal to 2⁴ =16 so 10000=16

So in our 11101=10000+1000+100+1=16+8+4+1=29

So each digit equals 2⁽ⁿ⁻¹⁾ .  If we have a number, 1001001=2⁽⁷⁻¹⁾ +2⁽⁴⁻¹⁾+1=  2⁶ +2³+1=64+8+1=73

Try some numbers and use a binary to decimal calculator to test your answer.


No comments:

Post a Comment