Introduction
Are you afraid of learning Computer's own language, the Binary Number System? I suppose you are not! If you are a Computer Programmer or intend to become one, then I suggest you better learn it. No, you are not going to write programs in Binary Numbers, but sooner or later you will come across references to binary, Octal, and Hexadecimal Numbers. If you don't like surprises then better try getting some general understanding of this Number System.
I think that is enough to keep you interested. It is not that hard to learn. In fact, if you look at a few simple rules that go with the Decimal Number System then you can devise any number system that you like if others understand it and accept it.
Few Simple Rules that Govern the Decimal Number System.
Let us look at a few simple rules that go with the Decimal Number System, that we are already familiar with.
The Decimal Number System.
- The decimal Number System's Base value is 10 which is known as the Base-10 Number System.
- The Base-10 Number System has 10 digits to express quantities; 0 to 9 and the highest digit value is 9, i.e., one less than the Base value of 10.
- Any value more than 9 is expressed in multiples of 10.
Note: Keep this simple rule in mind: Any new Number System that you create using a particular value as a Base, the number of digits in that system will be equal to the base value and the highest value of the digit in that system will be one less than the base value. We will see this when we learn about some other number systems used in Computers (Octal & Hexadecimal Systems).
- Decimal value 10 cannot be written with a single digit, instead, we put a zero in the unit's position and write 1 in the 10th position. So, decimal Value 10 = 101 + 1 x 0 or 10 + 1 x 0.
Let us create a table to see how each digit value is calculated and added up to the decimal quantity.
Note: Please use your Laptop or Tablet to view the Table correctly.
106 | 105 | 104 | 103 | 102 | 101 | 100 |
1,000,000 | 100,000 | 10,000 | 1,000 | 100 | 10 | 1 |
2 | 5 | 5 |
2 x 102 OR 2 x 10 x 10 OR 2 x 100 = 200
5 x 101 OR 5 x 10 = 50
5 x 100 OR 5 x 1 = 5
=======
255
=======
Going by the above rules we can devise any number system. For example, if we devise a Number System with Base-8 then this will have the digits 0 to 7; the highest single-digit value is one less than the base value 8 and this number system doesn't have digits 8 or 9. In fact, this Number System has been already there in the computer world and we will learn it after going through the Binary Number System.
Binary Number System.
By keeping the above simple rules in mind, we will learn the Binary or Base-2 Number System. This Number System has only two digits 0 and 1 (highest digit value is 1, i.e., one less than the base value 2) to write any Decimal value in Binary form.
First, let us create a Binary Table, similar to the decimal table like the decimal number table so that converting Decimal Numbers to Binary and vice versa is easy.
Note: Please use your Laptop or Tablet to View the Table correctly.
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
32,768 | 16,384 | 8,192 | 4,096 | 2,048 | 1,024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
In the above table, each digit position value is given in the second row. For example, if you put 1 below the value 1024 and fill the other slots to the right with all zeroes, then the value of Binary Number 10000000000 is 1024 (or 1K or 210). If you put 1 replacing the rightmost 0 (10000000001) then the Binary Value becomes 1024+1 = 1025.
Let us try converting the small decimal number 10 to binary.
Method-1:
- Find the highest integer value in the table above that can be subtracted from decimal number 10? 8 is the highest value that can be taken from the above table.
- Subtract 8 from 10 and find the result.
10
-8
====
2
====
- Put 1 under the slot of value 8 in the binary table.
- Next value 2 can be subtracted from the balance value 2 above.
2
-2
=====
0
=====
- Put 1 under the value 2 in the binary table. There is nothing left to calculate the binary value so put a 0 in the unit position of the binary table. So the result of Decimal Number 10 in binary form is as given below:
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
32,768 | 16,384 | 8,192 | 4,096 | 2,048 | 1,024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
1 |
Now, we have 2 as balance and the next binary position value is 4. 4 cannot be subtracted from 2, so put a 0 under the value 4.
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
32,768 | 16,384 | 8,192 | 4,096 | 2,048 | 1,024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
1 | 0 |
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
32,768 | 16,384 | 8,192 | 4,096 | 2,048 | 1,024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
1 | 0 | 1 | 0 |
Cross-Checking the Result.
You can quickly cross-check whether the binary number is correct to the decimal number by adding up the values in the second row wherever one is there in the third row; 8+2 is 10.
It is not always convenient to build the above table every time when we want to convert a decimal number to binary. Instead, we can do it with a simple calculation. Let us convert the decimal number 10 to binary with this new method.
Method-2:
- Divide the decimal number by 2 and get the remainder value (always integer division and the remainder is 1 or 0) and start building the binary value from right to left with the remainder value.
- Each time takes the Quotient Value from the previous division and divides it by 2 again.
10/2 = Quotient = 5, Remainder=0
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
32,768 | 16,384 | 8,192 | 4,096 | 2,048 | 1,024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
0 |
5/2 = Quotient = 2, Remainder = 1
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
32,768 | 16,384 | 8,192 | 4,096 | 2,048 | 1,024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
1 | 0 |
2/2 = Quotient=1, Remainder = 0
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
32,768 | 16,384 | 8,192 | 4,096 | 2,048 | 1,024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
0 | 1 | 0 |
1/2 = Quotient = 0, Remainder=1
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
32,768 | 16,384 | 8,192 | 4,096 | 2,048 | 1,024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
1 | 0 | 1 | 0 |
If you have understood this simple number system so far then try converting some numbers bigger than what we have tried. As you can see from the binary table above the highest value we have plotted on the table above is 32768 (215) but you can try converting any value below the decimal Number 65536 in the above table.
If you need a sample number, then try converting the decimal number 255 to binary.
[...] ToolbarViral PDF eBooks - turn your PDF documents into a viral sales force Related Links:Learn Binary Numbering SystemConverting From Decimal to Binary, Octal, and HexadecimalDigital Electronics MCQ Free Download PDF [...]
ReplyDeleteHi, and thanks for the comment on my post on understanding binary! I think yours is intended for the more confident reader, whereas mine has the goal of giving a brief introduction to those who feel they are in some way not as mathematical. Yours may well be a good place to take a step up from mine (similarly, mine may be a good place to start for any who find yours starts off too high!)
ReplyDeleteJust in case, mine's here: http://mathsqs.blogspot.com/2010/10/how-does-binary-work.html
Thanks for the review TeaKayB.
ReplyDeleteRegards,
Here is a good site for people wanting to learn binary and hexadecimal.
ReplyDeletehttp://justwebware.com/bitwise/bitwise.html