Basic Concepts Behind The Binary System
Basic Concepts Behind The Binary System
Basic Concepts Behind The Binary System
To understand binary numbers, begin by recalling elementary school math. When we first
learned about numbers, we were taught that, in the decimal system, things are organized into
columns:
H | T | O
1 | 9 | 3
such that "H" is the hundreds column, "T" is the tens column, and "O" is the ones column. So
the number "193" is 1-hundreds plus 9-tens plus 3-ones.
Years later, we learned that the ones column meant 10^0, the tens column meant 10^1, the
hundreds column 10^2 and so on, such that
10^2|10^1|10^0
1 | 9 | 3
the number 193 is really {(1*10^2)+(9*10^1)+(3*10^0)}.
As you know, the decimal system uses the digits 0-9 to represent numbers. If we wanted to
put a larger number in column 10^n (e.g., 10), we would have to multiply 10*10^n, which
would give 10^(n+1), and be carried a column to the left. For example, putting ten in the
10^0 column is impossible, so we put a 1 in the 10^1 column, and a 0 in the 10^0 column,
thus using two columns. Twelve would be 12*10^0, or 10^0(10+2), or 10^1+2*10^0, which
also uses an additional column to the left (12).
The binary system works under the exact same principles as the decimal system, only it
operates in base 2 rather than base 10. In other words, instead of columns being
10^2|10^1|10^0
they are
2^2|2^1|2^0
Instead of using the digits 0-9, we only use 0-1 (again, if we used anything larger it would be
like multiplying 2*2^n and getting 2^n+1, which would not fit in the 2^n column. Therefore,
it would shift you one column to the left. For example, "3" in binary cannot be put into one
column. The first column we fill is the right-most column, which is 2^0, or 1. Since 3>1, we
need to use an extra column to the left, and indicate it as "11" in binary (1*2^1) + (1*2^0).
1011=(1*2^3)+(0*2^2)+(1*2^1)+(1*2^0)
= (1*8) + (0*4) + (1*2) + (1*1)
= 11 (in decimal notation)
Try converting these numbers from binary to decimal:
• 10
• 111
• 10101
• 11110
Remember:
2^4| 2^3| 2^2| 2^1| 2^0
| | | 1 | 0
| | 1 | 1 | 1
1 | 0 | 1 | 0 | 1
1 | 1 | 1 | 1 | 0
Answers
10=(1*2^1) + (0*2^0) = 2+0 = 2
111 = (1*2^2) + (1*2^1) + (1*2^0) = 4+2+1=7
10101= (1*2^4) + (0*2^3) + (1*2^2) + (0*2^1) + (1*2^0)=16+0+4+0+1=21
11110= (1*2^4) + (1*2^3) + (1*2^2) + (1*2^1) + (0*2^0)=16+8+4+2+0=30
Binary Addition
Consider the addition of decimal numbers:
23
+48
___
We begin by adding 3+8=11. Since 11 is greater than 10, a one is put into the 10's column
(carried), and a 1 is recorded in the one's column of the sum. Next, add {(2+4) +1} (the one is
from the carry)=7, which is put in the 10's column of the sum. Thus, the answer is 71.
Binary addition works on the same principle, but the numerals are different. Begin with one-
bit binary addition:
0 0 1
+0 +1 +0
___ ___ ___
0 1 1
1+1 carries us into the next column. In decimal form, 1+1=2. In binary, any digit higher than
1 puts us a column to the left (as would 10 in decimal notation). The decimal number "2" is
written in binary notation as "10" (1*2^1)+(0*2^0). Record the 0 in the ones column, and
carry the 1 to the twos column to get an answer of "10." In our vertical notation,
1
+1
___
10
The process is the same for multiple-bit binary numbers:
1010
+1111
______
• Step one:
Column 2^0: 0+1=1.
Record the 1.
Temporary Result: 1; Carry: 0
• Step two:
Column 2^1: 1+1=10.
Record the 0, carry the 1.
Temporary Result: 01; Carry: 1
• Step three:
Column 2^2: 1+0=1 Add 1 from carry: 1+1=10.
Record the 0, carry the 1.
Temporary Result: 001; Carry: 1
• Step four:
Column 2^3: 1+1=10. Add 1 from carry: 10+1=11.
Record the 11.
Final result: 11001
Alternately:
11 (carry)
1010
+1111
______
11001
Always remember
• 0+0=0
• 1+0=1
• 1+1=10
1 11 1
101 101 101
+111 +111 +111
_____ ____ _____
0 00 1100
--------------------------------------------------------------------
1 1 1
111 111 111
+111 +111 +111
_____ _____ _____
0 10 1110
Binary Multiplication
Multiplication in the binary system works the same way as in the decimal system:
• 1*1=1
• 1*0=0
• 0*1=0
101
* 11
____
101
1010
_____
1111
Note that multiplying by two is extremely easy. To multiply by two, just add a 0 on the end.
Binary Division
Follow the same rules as in decimal division. For the sake of simplicity, throw away the
remainder.
For Example: 111011/11
10011 r 10
_______
11)111011
-11
______
101
-11
______
101
11
______
10
Decimal to Binary
Converting from decimal to binary notation is slightly more difficult conceptually, but can
easily be done once you know how through the use of algorithms. Begin by thinking of a few
examples. We can easily see that the number 3= 2+1. and that this is equivalent to
(1*2^1)+(1*2^0). This translates into putting a "1" in the 2^1 column and a "1" in the 2^0
column, to get "11". Almost as intuitive is the number 5: it is obviously 4+1, which is the
same as saying [(2*2) +1], or 2^2+1. This can also be written as [(1*2^2)+(1*2^0)]. Looking
at this in columns,
EXPLANATION
The procedure for converting is approximately common for all systems. Below is the
example of the simplest conversion (decimal to binary). If the user types 82 as a decimal
number, try to find all the numbers that are less than to this number such that these numbers
are powers of 2. That is:
1, 2, 4, 8, 16, 32, 64 (and not 128)
Note: To convert to binary, we take powers of 2 and apply the same method. To convert to
octal, we take powers of 8 and apply the same method. To convert to hexadecimal, we take
powers of 16 and apply the same method.