Binary Arithmetic
BINARY ADDITION
The steps used for a computer to complete
addition are usually greater than a human, but
their processing speed is far superior.
RULES
0+0=0
0+1=1
1+0=1
1 + 1 = 0 (With 1 to carry)
1 + 1 + 1 = 1 (With 1 to carry)
BINARY ADDITION
EXAMPLE
1 0 0 1 +
1 0 1 1
BINARY ADDITION
EXAMPLE
1 0 01 1 +
1 0 1 1
0
BINARY ADDITION
EXAMPLE
1 01 01 1 +
1 0 1 1
0 0
BINARY ADDITION
EXAMPLE
1 01 01 1 +
1 0 1 1
1 0 0
BINARY ADDITION
EXAMPLE
1 1 01 01 1 +
1 0 1 1
0 1 0 0
BINARY ADDITION
EXAMPLE
11 01 01 1 +
1 0 1 1
10 1 0 0
BINARY ADDITION
CHECK THE ANSWER
9 +
11
20
BINARY SUBTRACTION
Computers have trouble performing
subtractions so the following rule should be
employed:
“X – X is the
sameas X +
-X”
This is where two’s complement is
BINARY SUBTRACTION
RULES
2. Convert the number to binary.
3. Perform two’s complement on the second
number.
4. Add both numbers together.
BINARY SUBTRACTION
EXAMPLE 1
Convert 12 - 8 using two’s complement.
3. Convert to binary
12 = 00001100 2
8 = 00001000 2
Perform one’s complement on the 8 10
00001000 2
11110111 2
BINARY SUBTRACTION
EXAMPLE 1
2. Perform two’s complement.
11110111 2
+
00000001 2
11111000 2
6. Add the two numbers together.
= 1 0 0 0 0 0 1 0 0 (Ignore insignificant bits)
2
BINARY SUBTRACTION
EXAMPLE 2
What happens if the first number is larger than
the second?
Try 6 - 10
10 10
BINARY SUBTRACTION
EXAMPLE 2
2. Convert to binary
6 = 000001102
10 = 00001010 2
Perform one’s complement on the 10
10
000010102
111101012
BINARY SUBTRACTION
EXAMPLE 2
2. Perform two’s
complement. 1 1 1 1 0 1
010000001+
2 2
=11110110 2
BINARY SUBTRACTION
EXAMPLE 2
2. Add the two numbers together.
00000110 2
+
11110110 2
= 1 1 1 1 1 1 0 0 (Ends with a negative bit)
2
BINARY SUBTRACTION
EXAMPLE 2
2. Perform one’s complement on the result
11111100 2
00000011 2
5. Add 1 to the result.
00000011 2
+
00000001 2
=00000100 2
BINARY SUBTRACTION
EXAMPLE 2
2. We then add the sign bit
back. 0 0 0 0 0 1 0 02
=10000100 2
BINARY MULTIPLICATION
Multiplication follows the general principal of
shift and add.
The rules include:
0*0=0
0*1=0
1*0=0
1*1=1
BINARY MULTIPLICATION
EXAMPLE 1
Complete 15 * 5 in binary.
3. Convert to binary
15 = 00001111 2
5 =
00000101 2
6. Ignore any insignificant zeros.
x
00001111
00000101 2
2
BINARY MULTIPLICATION
EXAMPLE 1
2. Multiply the first number.
1111 2
101 x 2 1111 x 1 = 1111
1111
7. Now this is where the shift and takes place.
BINARY MULTIPLICATION
EXAMPLE 1
2. Shift one place to the left and multiple the
second digit.
1111 2
1111 x 0 = 0000
x
101 2
1111
00000 Shift One Place
BINARY MULTIPLICATION
EXAMPLE 1
2. Shift one place to the left and multiple the
third digit.
1111 2
1111 x 1 = 1111
x
101 2
1111
00000
111100 Shift One Place
BINARY MULTIPLICATION
EXAMPLE 1
2. Add the total of all the
steps. 1 1 1 1
00000 +
111100
1001011
8. Convert back to decimal to check.
BINARY DIVISION
Division in binary is similar to long division in
decimal.
It uses what is called a shift and subtract
method.
BINARY DIVISION
EXAMPLE 1
Complete 575 / 25 using long division.
0 Take the first digit of 575 (5) and see if 25
will go into it.
2. 25 575 If it can not put a zero above and take the
next number.
02
How many times does 25 go into 57?
TWICE
2. 25 575
BINARY DIVISION
02 How much is left over?
2. 25 57 – (25 * 2) = 7
575
50
7
Drop down the next value
02
2. 25
575
50
75
BINARY DIVISION
023 Divide 75 by 25
2. 25 Result = 3
575
50
75
Check for remainder
023
75 – (3 * 25) = 0
2. 25 FINISH!
575
50
75
75
0
BINARY DIVISION
Complete the following:
25/5
Step 1: Convert both numbers to binary.
25 = 1 1 0 0 1
5=101
Step 2: Place the numbers accordingly:
101 11001
BINARY DIVISION
Step 3: Determine if 1 0 1 (5) will fit into the
first bit of dividend.
101 11001
1 0 1(5) will not fit into 1(1)
Step 4: Place a zero above the first bit and try
the next bit.
BINARY DIVISION
Step 5: Determine if 1 0 1 (5) will fit into the
next two bits of dividend.
0
101 11001
1 0 1(5) will not fit into 1 1(3)
Step 6: Place a zero above the second bit and
try the next bit.
BINARY DIVISION
•Step 7: Determine if 1 0 1 (5) will fit into the next three bits of dividend.
• 0 0
•1 0 1 11001
•1 0 1(5) will fit into 1 1 0(6)
•Step 8: Place a one above the third bit and times it by the divisor (1 0 1)
BINARY DIVISION
Step 9: The multiplication of the divisor should be
placed under the THREE bits you have used.
0 0 1
101 11001
101
A subtraction should take place, however you
cannot subtract in binary. Therefore, the two’s
complement of the 2nd number must be found and
the two numbers added together to get a result.
BINARY DIVISION
Step 10: The two’s complement of 1 0 1 is 0 1 1
0 0 1
101 11001
+ 011
001
BINARY DIVISION
Step 11: Determine if 1 0 1 will fit into the remainder
0 0 1. The answer is no so you must bring down the
next number.
0 0 1
101 11001
+ 011
0010
BINARY DIVISION
Step 12: 1 01 does not fit into 0 0 1 0. Therefore, a
zero is placed above the last bit. And the next number
is used.
0 0 1 0
101 11001
+ 011
00101
BINARY DIVISION
Step 13: 1 0 1 does fit into 1 0 1 so therefore, a one is
placed above the final number and the process of
shift and add must be continued.
0 0 1 0 1
101 11001
+ 011
00101
+ 0 1 1
000
Binary Division
Step 14: The final answer is 1 0 1 (5) remainder zero.