Digital Electronics - Hexadecimal Arithmetic
Digital Electronics - Hexadecimal Arithmetic
Hexadecimal arithmetic is a mathematical system that allows to perform arithmetic operations such as
addition, subtraction, multiplication, and division of hexadecimal or base-16 numbers.
In this chapter, we will cover the following four basic hexadecimal arithmetic operations −
Hexadecimal Addition
Hexadecimal Subtraction
Hexadecimal Multiplication
Hexadecimal Division
Let’s understand each of the hexadecimal arithmetic operations in detail with the help of examples.
Hexadecimal Addition
Hexadecimal addition is one of the basic arithmetic operations performed on hexadecimal numbers to
determine their sum. Basically, hexadecimal addition is similar to decimal addition. But in hexadecimal
addition, a carry is generated to the next higher column if the sum is greater than or equal to 16.
Let us see some solved examples to better understand the hexadecimal addition.
Example 1
Solution
Move to the next column and add the digits along with carry: 5 + B + 1 = 5 + 11 + 1 = 17 = 16 + 1. Here,
16 forms a carry to the next column. Thus, the sum is 1 with a carry 1. There are no digits left, hence
carry will also be written as leftmost digit in the sum.
Example 2
Solution
Explanation
Start by adding the digits in the rightmost column: C + 9 = 12 + 9 = 21 = 16 + 1. Here, 16 forms a carry.
Thus, the sum is 1 with a carry 1.
Move to the next column and add the digits along with the carry from the previous step: B + A + 1 = 11 +
10 + 1 = 22 = 16 + 6. Thus, the sum is 6 with a carry 1 to the next column.
Move to the leftmost column and add the digits along with the carry from the previous step: A + 2 + 1 =
10 + 2 + 1 = 13. Since, the sum is 13 which is less than 16, hence no carry is generated. In hexadecimal
number system, 13 is represented by the letter D. x
Hence, the hexadecimal sum of ABC and 2A9 = D65.
This is all about hexadecimal addition that involves the addition of digits of the given hexadecimal
numbers column by column. The most important point to keep in mind while performing hexadecimal
addition is that a carry is generated to the next column when the sum in a particular column is greater
than or equal to 16, i.e., base of the hexadecimal number system.
Explore our latest online courses and learn new skills at your own pace. Enroll and become a certified
expert to boost your career.
Hexadecimal Subtraction
Hexadecimal subtraction is a basic arithmetic operation performed on hexadecimal numbers to
determine the difference between them.
Hexadecimal subtraction is similar to decimal subtraction. The only difference is that in hexadecimal
subtraction, when the minuend digit is smaller than the subtrahend digit, a borrow 1, which is equivalent
to 16, is taken from the higher column digit.
Let us understand the hexadecimal subtraction with the help of solved examples.
Example 1
Solution
Explanation
Start subtracting the hexadecimal digits from rightmost column: 7 – 5 = 2. Write down the result.
Move to the next column and subtract the digits: 5 – 2 = 3. Write down the digit 3 as difference.
Move to the leftmost column and subtract the digits: A – 1 = 10 – 1 = 9. Write down the result as
difference.
Example 2 x
Subtract (1DA)16 from (BC5)16.
Solution
The hexadecimal subtraction of BC5 and 1DA is shown below −
Explanation
Start by subtracting from the digits in rightmost column: 5 – A. Since 5 is less than A (10), so we have
to borrow from the next higher-order digit. After borrowing from the next column (C), the digit 5 will
become 5 + 16 (as 16 is equivalent to borrow 1) = 21. Thus, 21 – A = 11 (B). Write down B as the
difference.
Move to the next column and subtract the digits: B – D. Again, B is smaller than D, so we take a borrow
from the higher order digit B. After getting a borrow, B will become B + 16 = 27. Thus, 27 – D = 14 (E).
Write down the digit E as difference.
Move to the leftmost column and subtract the digits: A – 1 = 9. Write down the result.
These examples explain the process of subtracting two hexadecimal numbers. Let us now discuss the
third basic arithmetic operation on hexadecimal numbers i.e., hexadecimal multiplications.
Hexadecimal Multiplication
Hexadecimal multiplication is an arithmetic operation used to determine the product of two
hexadecimal numbers.
Hexadecimal multiplication is similar to the decimal multiplication. But, in the case of hexadecimal
multiplication, a carry is generated to the next column when the product is greater than or equal to 16.
The following examples demonstrate the process of multiplying two hexadecimal numbers.
Example 1
Solution
x
The multiplication of given hexadecimal numbers is shown below −
Multiply the digit (B)16 with each digit of the number (A19)16 and write down the result.
Then, we multiply B by 1 and add the carry 6 to the product. It gives 17 = 16 + 1. Here, the result is 1 and
carry is 1.
Finally, we multiply B by A and add the carry 1 overed from previous step to product. It gives 96 + 15 (F
in hexadecimal). The result is F with a carry 6.
Example 2
Solution
Explanation
In this example, we first multiply the digit (9)16 of the second number (29)16 by each digit of the
number (ABC)16. Write down the partial product.
x
Then, we multiply the digit (2)16 of the number (29)16 by each digit of the number (ABC)16. Write down
the partial product by shifting one position to the left.
Finally, we sum up all the partial products to obtain the final result.
Hexadecimal Division
Hexadecimal division is the fourth basic arithmetic operation that we perform on base-16 numbers. In
the hexadecimal division, we obtain two results namely, quotient and remainder.
Step 2 − Multiply the obtained quotient by the divisor and subtract from the dividend.
Step 3 − Bring down the next significant digit or digits of the dividend.
Step 4 − Repeat the process explained in the above three steps until all the digits in the
dividend are used.
Example 1
Solution
In this hexadecimal division, we have obtained the quotient (208)16 and remainder (1)16.
Example 2
We explained the direct method of performing hexadecimal arithmetic operations. Now let's see how
we can perform all these four hexadecimal arithmetic operations through binary arithmetic.
As we know, each hexadecimal digit can be represented as group of four bits as shown in the following
table.
Hexadecimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
x
E 1110
F 1111
Let us now discuss hexadecimal arithmetic operations through binary conversion.
The following example demonstrates the process of hexadecimal addition through binary conversion.
Example
Solution
Finally, converting the binary sum to its equivalent hexadecimal format to obtain the final result.
Here is an example demonstrating the process of hexadecimal subtraction through binary conversion.
x
Example
Converting the difference back to the hexadecimal to obtain the final result,
The following example demonstrates the process of multiplying hexadecimal numbers through binary
conversion.
Example
Solution
(B)16 = (1011)2
x
Multiplying the binary numbers,
Converting the product back to the hexadecimal format,
Let us understand the hexadecimal division using binary arithmetic with the help of an example.
Example
Solution
(A)16 = (1010)2
x
Converting the quotient and remainder to hexadecimal,
Conclusion
In this chapter, we explained the four basic arithmetic operations (addition, subtraction, multiplication,
and division) of hexadecimal numbers. We also discussed the binary method of hexadecimal arithmetic
operations.