Binary

Converting from Decimal to Binary

A computer uses the Binary Number System(Base 2). All numbers and characters are represented by 8 binary digits (bits) which equal to either 1 or 0. Binary has a number line just like the decimal system has a number line. The binary number line begins with 1 on the right side and then you multiply by 2(the base) for every number in the line.

 

Binary Number Line

256 128 64 32 16 8 4 2 1

 

To represent numbers in binary, use the number line and a combination of ones and zeros:

 

Example: Binary Number Line

____________________________________

16

8

4

2

1

Decimal #

2 = 1 0

3 = 1 1

5 = 1 0 1

7 =

 

In these examples, a 2 in decimal is equal to 10 in binary, because there is a one in the two's position in the number line. There is a zero in the one's position to hold that place in the number line. Three (3) in decimal is equal to 11, because 2 + 1 = 3. There is a one in the two's position and a one in the one's position. In binary, you add the number from the number line when there is a one in that position. Five(5) in decimal, is equal to 101 because 4 + 1 = 5. There is a one in the four's position and a one in the one's position, thus 4+1=5. The zero in the two's position is there to hold that place. If you removed the zero, you would change the value of the number. What would be the binary equivalent of 7? You try that one. If you got 111, you are correct. There would be a one in the four's position, a one in the two's position, and a one in the one's position. 4 + 2 + 1 = 7. To fine the binary equivalent of any decimal number, just think what + what + what = the number you are trying to convert. If the number is large and you do not wish to use the above mentioned method, you can take the number in decimal and divide it by 2(the base) and save the remainder to get the binary equivalent.(Example in packet given at orientation)

 

Converting from Binary to Decimal

If you are given a binary number and asked to convert it to decimal, all you have to do is plug the binary number under the number line and add the numbers from the number line with a one under them.

 

 

Example:

____________________________________

16 8 4 2 1

1 1 0 1

Binary # Decimal #

1101 = 1 1 0 1 = 8+4+1= 13

10001= 1 0 0 0 1 =16+1= 17

11011= 1 1 0 1 1 =16+8+2+1=27

 

Remember to only add the numbers in the number line that have a one below them.

 

Binary Addition & Subtraction - In packet