In the hexadecimal number system, the numbers are expressed with the base 16. Hexadecimal is also called as Hex. It is like decimal, binary or octal numbers. The list of 16 hexadecimal numbers are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Here, we are going to learn how to perform addition, subtraction operations in between two hexadecimal numbers with the examples for the better understanding of the concept. So, interested people can check out this complete page.
What is Hexadecimal Number System?
A hexadecimal number is a number having a base of 16. These numbers are also called the 16 number system. It has 16 different symbols, 0 to 9 represent the binary values, A, B, C, D, E, F represent 10 to 15 values respectively. Each position in the hexadecimal number represents 0 power of the base 16. The last position in the number represents an x power of base 16.
Examples of Hexadecimal Numbers:
1. B84F
The decimal value of B84F is 11 x 16 + 8 x 16 + 4 x 16 + 16 x 16
= 176 + 128 + 64 + 256
= 624
2. Convert 857 to hexadecimal
857 ÷ 16 = 53.5625
0.5625 x 16 = 9 (Remainder 9)
53 ÷ 16 = 3.3125
0.3125 x 16 = 5 (Remainder 5)
3 ÷ 16 = 0.1875
0.1875 x 16 = 3 (Remainder 3)
Read remainders from bottom to top
So, 857 = (359)16
Also, Read: Binary Subtraction
Procedure for Adding & Subtracting in Hexadecimal
Below provided are the simple steps that are helpful to compute the addtion and subtraction of two hexadecimal numbers.
1. Hexadecimal Numbers Addition
- Write two hexadecimal numbers one after another in two different lines
- Begin adding from the rightmost digits.
- If the digit is in the form of an alphabet then convert it to the respective decimal number to make the process easy
- Add those digits and convert the sum to the hexadecimal
- If you got the carry, then represent it on the top of the first number next digit and result on the bottom of the second number added digit.
- Continue the process until you left nothing on the left side.
We can also add two hexadecimal numbers by following this table.
For Example:
926 + 1A2
9 2 6
(+) 1 A 2
= A C 8
So, 926 + 1A2 = AC8
2. Hexadecimal Numbers Subtraction
- Write two hexadecimal numbers in different lines
- Subtraction starts from the rightmost digits of the numbers.
- Convert the alphabets into decimals and subtract two digits and again convert the difference value as hexadecimal.
- In case the first number digit is smaller than the second number digit, then barrow from the left side digit.
- The borrowed value is always 16 as its base is 16. Then add borrowed value and first number digit and subtract.
- Don’t forget to mention the borrowed value on the top of the first number digit.
- After borrowing, the left side digit decreased by 1.
- Repeat the process till you have nothing remaining on the left side.
For Example:
938 – 1A2
8 – 2 = 6
3 – A(10) = (16 + 3) – 10 = 19 – 10 = 9
(9 – 1) – 1 = 8 – 1 = 7
So, 938 – 1A2 = 796.
Hexadecimal Addition and Subtraction Examples
Example 1:
Evaluate (1AB2)16 + (2198)16
Solution:
Given expression is (1AB2)16 + (2198)16
From the table,
2 + 8 = A
B + 9 = 4 and 1 is carry
1 + A + 1 = C
1 + 2 = 3
Therefore, (1AB2)16 + (2198)16 = 3C4A
Example 2:
Find subtraction of (B84F)16 and (A53)16.
Solution:
F means 15. F – 3 = 15 – 3 = 12 = C
4 + 16 = 20 – 5 = 15 = F
8 – 1 = 7
7 + 16 = 23 – A = 23 – 10 = 13 = D
8 – 1 = 7
23
10 7 20
B 8 4 F
(-) 0 A 5 3
= 7 D F C
So, (B84F)16 – (A53)16 = (7DFC)16
Example 3:
Find the addition, subtraction of (AB53)16, (155)16
Solution:
The addition of numbers is (AB53)16 + (155)16
3 + 5 = 8
5 + 5 = 10 = A
B + 1 = 11 + 1 = 12 = C
A + 0 = 10 + 0 = 10 = A
So, (AB53)16 + (155)16 = (ACA8)16
Subtraction of numbers is (AB53)16 – (155)16
(3 + 16) – 5 = 19 – 5 = 14 = E
(5 – 1) – 5 = 4 – 5
(4 + 16) – 5 = 20 – 5 = 15 = F
(B – 1) – 1 = (11 – 1) – 1 = 10 – 1 = 9
A – 0 = A
A B 5 3
(-) 0 1 5 5
= A 9 F E
So, (AB53)16 – (155)16 = (A9FE)16
Example 4:
(i) Calculate (9AB)16 + (12C)16
(ii) Compute (CB5)16 – (223)16
Solution:
(i) (9AB)16 + (12C)16
B + C = 11 + 12 = 23 = 7 and 1 is carry
1 + A + 2 = 3 + 10 = 13 = D
9 + 1 = 10 = A
So, (9AB)16 + (12C)16 = (AD7)16
(ii) (CB5)16 – (223)16
5 – 3 = 2
B – 2 = 11 – 2 = 9
C – 2 = 12 – 2 = A
So, (CB5)16 – (223)16 = (A92)16