# Number system Arithmetic - Addition & Subtraction

The most common Number system arithmetic operations are addition, subtraction, multiplication, and division. we all are familiar with these arithmetic operations on decimal numbers. the same operations can be performed on the binary, octal, and hexadecimal numbers.

## Binary Arithmetic

Binary arithmetic is much simpler than decimal arithmetic because here only two digits, 0 and 1 are involved.

For binary addition, we have to remember some rules that are given in the below table.

0000
0110
1010
1101

#### Example of binary addition

Add the following binary numbers.
1011 and 1100

1  0  1  1
(+) 1  1  0  0
_____________
Carry(1) 0  1  1  1

So the addition of both numbers 1011 and 1100 is 10111. here that last number 1 is th carry.

### Binary Subtraction

For binary subtraction, we also have some rules that are given in the below table.

MinuendSubtrahendDifferenceBorrow
000
0111
1010
1100

#### Example of binary subtraction

Subtract the following binary numbers.
1101 and 0011

1  1  0  1
(-) 0  0  1  1
________________
1  0  1  0

When 1 is subtracted from 0, there is a borrow from the adjacent bit.

## 2's complement Method

The 2's complement is used to represent the negative of a binary number. 2's complement of any binary number can be found by following the steps given.
1. Invert all bits
2. Add 1 to the inverted number

The obtained number will be negative to the original binary number. the 2's complement method can be used to subtract the numbers.
Step-1 Write the minute.
Step-2 Find the 2's complement of subtrahend.
Step-3 Add these two numbers.
Step-4 If carry is there then discard the carry and the remaining is the required result.
Step-5 If carry is not there, take 2's complement of the result and place a negative sign to MSB that is the reset and is negative.

### Example of binary subtraction using 2's complement

Subtract (52)10 from (92)10 by using 2's complement method. remember it is the base 10 number.

(52)10  = (0110100)2
(92)10 = (1011100)2

2's complement of (52)10 = (1001011 + 1)2
= (1001100)2
Now
(1)(1)(1)
Minuend      = 1   0   1  1  1  0  0
2's complement of (52)10 = 1   0   0  1  1  0  0
________________________
[Discard the carry (1)] 0 1   0  1  0  0  0

The result is (0101000)2 or (40)10

## Octal Arithmetic

Octal arithmetic rules are similar to decimal or binary arithmetic. arithmetic operations for octal numbers can be performed by converting the octal number to binary numbers and then using the rules of binary arithmetic.

#### Example of octal addition

Add the numbers (23)8 and (56)8.

(23)8 =        0  1  0  0  1  1
(56)8 =  (+) 1  0  1  1  1  0
_______________________
(1)  0  0  0  0  0  1
Carry

Thus the result is (1000 001)2 = (101)8

The rules for arithmetic operations with hexadecimal numbers are similar to the rules for decimal, octal and binary systems.

The information can be handled only in binary form in a digital circuit and it is easier to enter the information using a hexadecimal number system. since arithmetic operations are performed by the digital circuits binary numbers, therefore hexadecimal numbers are to be first converted into the binary numbers.

Add the two numbers (7F)16 and (32)16

(1)(1)(1)(1)(1)(1)
(7F)16 =     (0   1  1   1  1   1   1  1)2
(32)16 =  + (0   0  1   1  0   0   1  0)2
______________________________
1  0  1  1  0  0  0  1

So the result is (1011 0001)2 or (B1)16