i
ng
Ba
BINARY ARITHMETIC (OPERATIONS)
- Like in decimal system, there are four binary arithmetic operations that we will consider; namely
Addition, Subtraction, Multiplication and Division.
Binary Addition
-In binary addition, the following five simple rules are used:
(i) 0+0=0
(ii) 0+1=1
(iii) 1+0=1
(iv) 1 + 1 = 0 carry 1
(v) 1 + 1 + 1 = 1 carry 1
Examples
1. Add the binary numbers 10102 and 01102 .
Solution
1010
0110 +
100002
2. Add the decimal numbers 19 and 9 by binary means.
Solution
2 19
2 9 remainder 1
2 4 remainder 1
2 2 remainder 0
2 1 remainder 0
0 remainder 1
19 = 100112
1
i
ng
Ba
2 9
2 4 remainder 1
2 2 remainder 0
2 1 remainder 0
0 remainder 1
9 = 10012
Therefore;
10011
1001 +
111002 = 24 + 23 + 22 = 2810
The carry is usually taken to the next higher place value during binary addition.
Binary Subtraction
- The four rules for binary subtraction are:
(i) 0–0=0
(ii) 1–0=1
(iii) 1–1=0
(iv) 0 – 1 = 1 with a borrow of 1 from the next higher place value.
Note: A borrow of 1 from the previous place value is equivalent to a 2 in the present place value. The
contents of the previous place value are reduced by 1.
Examples
1. Subtract 01012 from 11102.
Solution
1110
0101 -
1001 = 10012
2. Subtract 00012 from 10002.
Solution
10002
00012 –
01112
2
i
ng
Ba
3. Subtract 01112 from 10012.
Solution
10012
01112 -
00102
4. Subtract 010112 from 101102.
Solution
101102
010112 -
010112
- Subtraction of binary can also be done using complements. The complement method of subtraction
reduces subtraction to an addition process. This method is popular in digital computers because:
1. Only adder circuits are needed thus simplifying the circuitry.
2. It is easy with digital circuits to get the complements of binary numbers.
- There are two types of complements:
(a) 1’s complement – Obtained by changing each 0 to a 1 and each 1 to a 0 in a binary number e.g. 1’s
complement of 10012 is 01102.
(b) 2’s complement – Obtained by Adding 1 to the 1’s complement of the binary number.
- It’s also known as a true complement.
Example: 2’s complement of 10112:
10112 01002
+ 1
01012 (Answer)
3
i
ng
Ba
1’s Complement subtraction
- When subtracting two quantities A and B, i.e. A – B, A is called the minuend and B is called the
subtrahend.
Procedure
1. Take 1’s compliment for the subtrahend and add the result to the minuend.
2. If the end-around carry is 1, add it to the result to get the final answer.
3. If there is no end-around carry, then re-complement the answer and attach a negative sign to it.
Examples
1. Subtract 1012 from 1112.
Solution
1112 – 1012 = 1112 + 0102
1112
0102 +
1001
Then;
001
1+
0102
Therefore 1112 – 1012 = 0102
2. Subtract 11012 from 10102.
Solution
10102 – 11012 = 10102 + 00102
10102
00102 +
1100 (note: no end-around carry)
So re-complementing and adding a negative sign:
1100 -00112
4
i
ng
Ba
Exercise
1. Subtract 11102 from 01102. {Answer: -10002}
2. Using 1’s complement method, subtract 011012 from 110112 {Answer: 011102}
3. Use 1’s complement to find 011012 - 110112 {Answer: -011102}
011012
001002 +
10001 (note: no end-around carry)
So re-complementing and adding a negative sign:
2’s Complement subtraction
- To carry out binary subtraction using 2’s complement subtraction, we proceed as follows:
Procedure
1. Find the 2’s compliment of the subtrahend. Add the result to the minuend
2. Drop the final carry (if generated).
3. If the carry is 1, the answer is positive and needs no re-complementing.
4. If there is no carry, obtain it’s (the rusult’s) 2’s complement and attach minus sign.
Examples
1. Using 2’s complement, subtract 10102 from 11012.
Solution
11012 – 10102: 10102 0101
+ 1
0110 (2’s complement of 10102).
Hence: 11012 – 10102 = 11012 + 01102
11012
01102 +
100112 (a carry 1 is generated hence drop off)
= 00112 (answer)
5
i
ng
Ba
2. Use 2’s complement to subtract 11012 from 10102.
Solution
10102 – 11012: 11012 0010
+ 1
0011 (2’s complement of 11012).
Hence: 10102 – 11012 = 10102 + 00112
10102
00112 +
11012 (no carry hence answer should be negative)
1’s complement of result is 0010 and hence 2’s complement is 0011.
Therefore, answer is. - 00112
Review Questions
1. Perform the following binary additions:
(a) 1011 + 1001
(b) 1011.01 + 1001.11
(c) 1111 + 111 + 1111
2. Perform the following binary subtractions:
a) 1101 – 1011
b) 111 – 101
c) 1000 – 11
d) 101011 – 10010
3. Find the 1’s complements of the following binary numbers.
(a) 01101 (b) 1101 (c) 1001 (d) 1010
4. What are 2’s complements of the following binary numbers?
(a) 1011 (b) 11011 (c) 11011.01 (d) 10011.11
5. Use the 1’s and 2’s complements of the following binary subtractions:
(i) 1111 – 1011
(ii) 110011 – 100101
(iii) 100011 – 111010
6
i
ng
Ba
Binary Multiplication
- In binary multiplication, we use the following four simple rules:
(i) 0x0=0
(ii) 0x1=0
(iii) 1x0=0
(iv) 1x1=1
- The multiplication is similar to decimal multiplication.
Examples
1. Multiply 1112 by 1012 using binary multiplication method
Solution
111
101 x
111
000
111
1000112
= 1000112
2. Multiply 11012 by 11002.
Solution
1101
1100 x
0000
0000
1101
1101
10011100 = 100111002
7
i
ng
Ba
3. Multiply 11112 by 01112
Solution
1111
0111 x
1111
1111
1111
0000
1101001 = 11010012
Binary Division
- It is similar to division in the decimal system. Division by 0, just like in the decimal system, is undefined.
Rules
(i) 0/1= 0
(ii) 1/1= 1
Examples
1. Carry out the binary division 11001 / 101.
Solution
101 = 101 2
101 11001
101
101
101
000
Hence 1012 .
8
i
ng
Ba
2. Divide 110112 by 1002
Solution
110.11 = 110.11 2
100 11011
100
101
100
110
100
100
100
000
Hence 110.112
Review Questions
1. Multiply the following binary numbers:
a) 1100 x 101
b) 10111 x 101
c) 1110 x 111
2. Perform the following binary divisions:
a) 11011 / 100
b) 1110011 / 101
c) 1100010 / 111