Sunday, July 17, 2011

Learn the Binary Numeral System

Introduction


    Most of us have seen it, those zeros and ones. Those are called binary, a different way of counting compared to our traditional decimal numeral system. Instead of using 10 values (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) binary uses two (0, 1). Binary is used in computers with electrical pulses, one being on and zero being off.

Lets Start Learning


    First of all you read Binary right to left. Lets picture columns. We will start with 2 columns to get used to them.
                                         2    1
                                       | 0 | 1 |

    What do you think this number is? If you said 1 you are right! The second column is 0 (off) and the first column is 1 (on). When you add this up you get 1. Note that you are adding the top numbers, not the ones and zeros.

    Now lets get a bit more complicated. Lets extend the number of columns.

                                         64   32   16   8    4     2    1
                                        | 0 | 0 | 1 | 1 | 0 | 1 | 0 |         This equals 26!

    First of all to increase the number of columns if you ever needed more just double the last column. In this case it would be 64x2=128.

Exercises
Decode the columns below.


                                                      64   32   16   8    4     2    1
1.                                     | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 



                                                      64   32   16   8    4     2    1
2.                                     | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 



                                                      64   32   16   8    4     2    1
3.                                     | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 



                                                      64   32   16   8    4     2    1
4.                                     | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 




Here are the following answers to the earlier exercises:
#1 - 2
#2 - 15
#3 - 46
#4 - 127


    So lets review what we have learned. When decoding binary into decimal you add up the columns that are "on" to the the answer. Thanks for reading, hope you enjoyed this tutorial. Feel free to share!

No comments:

Post a Comment