Hexadecimal Arithmetic – Addition and Subtraction of Hexadecimal Numbers

In this article, we will discuss hexadecimal arithmetic, covering the two basic arithmetic operations: addition and subtraction of hexadecimal numbers. Before discussing the hexadecimal arithmetic, let us first discuss the basics of hexadecimal numbers.

Hexadecimal Number System

The hexadecimal has two letters, “Hexa” and “deci” that stand for the numbers “6” and “10,” respectively. The hexadecimal numbers are represented by numerals 0 through 9 and letters A through F.

A hexadecimal number system has a radix or base of 16. Hence, it has 16 distinct symbols to express numbers. These symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. Here, A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.

The hexadecimal number system is a positional weight number system in which each position is determined by the power of 16. For example, the lowest position is 160, the upper position is 161 and so on.

Hence, this is all about the basics of hexadecimal numbers. Let us now discuss the addition and subtraction of hexadecimal numbers.

Hexadecimal Addition

Hexadecimal addition, or hex addition, is one of the basic arithmetic operations we can perform on hexadecimal numbers. It is used to determine the sum of two or more hexadecimal numbers.

There are several different methods of performing hexadecimal addition. But in this article, we will learn to perform direct addition of hexadecimal numbers, i.e., addition of hexadecimal numbers in the base 16 number system.

Let us understand the addition of hexadecimal numbers with the help of examples.

Example – Add (5B69)16 and (7AC3)16.

Solution – The hexadecimal numbers are (5B69)16 and (7AC3)16. The addition of these two hexadecimal numbers is shown in the following figure.

Hexadecimal Arithmetic= Addition

Here is the step-by-step explanation of this addition.

Step 1 – Add the rightmost digits, 9 and 3:

(9)16 + (3)16 = (12)16 = (C)16

Hence, the sum digit is C.

Step 2 – Add the the next two digits, 6 and C:

(6)16 + (C)16 = (6)16 + (12)16 = (18)16 = (16 + 2)16

In the hexadecimal number system, 16 forms a carry 1. Hence. The sum digit is 2, and the carry is 1.

Step 3 – Add the next two digits, B and A:

(B)16 + (A)16 = (11)16 + (10)16 = (21)16

Also, there is a carry 1 from the previous step, thus

(1)16 + (21)16 = (22)16 = (16 + 6)16

Hence, the sum digit is 6, and a carry 1 for 16.

Step 4 – Add the leftmost digits, 5 and 7:

(5)16 + (7)16 = (12)16

Again, there is a carry 1 from the previous step; thus,

(1)16 + (12)16 = (13)16 = (D)16

Here, the sum result is less than 16; hence, there is no carry, and the sum digit is D.

Therefore, the final result of adding these two hexadecimal numbers is (D62C)16.

This is how we can perform hexadecimal addition. Let us now explore the hexadecimal subtraction.

Hexadecimal Subtraction

Subtraction is another basic operation in hexadecimal arithmetic. It is used to determine the difference between two hexadecimal numbers.

We can perform hexadecimal subtraction just like decimal subtraction. The only difference is in the borrowed number. That means we consider 16 as a borrow instead of 10 in the hexadecimal number system.

Let us see an example to understand the subtraction of hexadecimal numbers.

Example – Subtract (1A70)16 from (1ADB)16.

Solution – The hexadecimal numbers are (1ADB)16 and (1A70)16. The subtraction of (1A70)16 from (1ADB)16 is below.

Hexadecimal Arithmetic- subtraction

Here is the step-by-step explanation of this hexadecimal subtraction.

Step 1 Subtract the rightmost digits, 0 from B:

(B)16 – (0)16 = (B)16

The difference digit is B.

Step 2 – Subtract the next two digits, 7 from D:

(D)16 – (7)16 = (13)16 – (7)16 = (6)16

Hence, the difference digits is 6.

Step 3 – Subtract the next two digits, A from A:

(A)16 – (A)16 = (0)16

Hence, the difference digit is 0.

Step 4 – Subtract the leftmost digits, 1 from 1:

(1)16 – (1)16 = (0)16

Hence, the difference digit is 0.

Thus, the final difference is (006B)16.

This is how we can easily subtract two hexadecimal numbers.

Conclusion

In this article, we have discussed the addition and subtraction of hexadecimal numbers. The hexadecimal addition and subtraction are two important operations used in various electronic systems like microcontrollers, keyboards, etc. Here, we have learned these two operations of hexadecimal arithmetic with the help of an example.

Solved Examples

Example 1: Add the following hexadecimal number. 7AC + 6B8

solved example 1- hex addition

Example 2: Add the following hexadecimal numbers.B6E + 8C7

solved Example 2- Hex addition

Leave a Comment