The binary number system is a numerical system with a base of 2, utilizing only two digits, "0" and "1." It belongs to a group of four different number systems and is predominantly employed in programming languages like Java and C++. The term "binary" derives from the prefix "bi," which signifies "two." Examples of binary numbers include (11)₂, (1110)₂, (10101)₂, and so forth. In this context, the subscript "2" denotes the radix of the binary number, and each individual digit is referred to as a "bit." Binary numbers can be converted into three other number systems: the decimal number system, the octal number system, and the hexadecimal number system. In this article, we explore arithmetic operations involving binary numbers and provide formulas for converting binary numbers into these three alternate number systems.
To grasp the workings of the binary number system, it's essential to delve into its operations. Binary numbers find widespread application in electronic circuits, especially in the implementation of logic gates, and are crucial in the realm of microcontrollers for logical computations. In the binary number system, only two digits, "0" and "1," are employed, with each individual digit referred to as a "bit." When data is input into a computer, it is initially converted into binary language using assigned ASCII codes. Subsequently, this binary language is transformed back into a user-friendly language for output presentation.
Adding binary numbers follows a slightly different process compared to standard addition, but it's straightforward. When adding two binary numbers, the addition must be carried out digit by digit. The result of adding two binary numbers is also a binary number. Refer to the table below for a clear illustration of binary number addition.
Binary number 1 | Binary number 2 | Sum | Carry |
0 | 0 | 0 | 0 |
0 | 1 | 1 | 0 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 1 |
Subtracting binary numbers involves a digit-by-digit subtraction process. Unlike binary addition, there's no carry involved in binary subtraction. Instead, when subtracting a larger digit from a smaller digit, we require a borrow. To gain a clear understanding of binary number subtraction, please refer to the table provided below.
Binary number 1 | Binary number 2 | Difference | Borrow |
0 | 0 | 0 | 0 |
0 | 1 | 1 | 1 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 0 |
Binary multiplication closely resembles the multiplication of standard numbers. To grasp binary number multiplication, refer to the table below for a clear illustration.
Binary number 1 | Binary number 2 | Multiplication |
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
Also Check – Arithmetic Progressions Formula
Decimal Number System
The decimal number system is the most commonly used numerical system in our daily lives. It has a base of 10, and it utilizes digits from 0 to 9 to represent numbers. Examples of decimal numbers include (14)₁₀, (245)₁₀, (1456)₁₀, and so forth. To convert a binary number "an-1...a₃a₂a₁a₀" into a decimal number, you can multiply each digit of the binary number by the corresponding powers of 2.
If you have a binary number with n-digits represented as B = an-1...a₃a₂a₁a₀, you can convert it into a decimal number D using the following formula:
D = (an-1 × 2^(n-1)) + ... + (a₃ × 2^3) + (a₂ × 2^2) + (a₁ × 2^1) + (a₀ × 2^0).
This formula calculates the decimal equivalent of the binary number by considering each digit's position and its contribution to the overall value in base 10.
Decimal Number | Binary number | Decimal Number | Binary number |
1 | 001 | 11 | 1011 |
2 | 010 | 12 | 1100 |
3 | 011 | 13 | 1101 |
4 | 100 | 14 | 1110 |
5 | 101 | 15 | 1111 |
6 | 110 | 16 | 10000 |
7 | 111 | 17 | 10001 |
8 | 1000 | 18 | 10010 |
9 | 1001 | 19 | 10011 |
10 | 1010 | 20 | 10100 |
Example: Convert the binary number (1101011)₂ to its decimal equivalent.
Solution:
Given binary number: (1101011)₂.
To convert it to decimal:
(1101011)₂ = (1 × 2^6) + (1 × 2^5) + (0 × 2^4) + (1 × 2^3) + (0 × 2^2) + (1 × 2^1) + (1 × 2^0)
= 64 + 32 + 0 + 8 + 0 + 2 + 1 = 107
Hence, the binary number (1101011)₂ is equivalent to the decimal number (107)₁₀.
To convert a decimal number into binary, you can use a method that involves dividing the given decimal number by 2 repeatedly until you reach a quotient of 1. Then, write down the remainders obtained from each division in reverse order, from bottom to top. This process yields the binary representation of the decimal number.
Also Check – Quadratic Equations Formula
The octal number system is a numerical system with a base of 8, utilizing digits from 0 to 7 to represent numbers. It was initially used in the early stages of computer programming languages. In the octal system, after reaching the digit 7, the numbers continue with 10 through 17, then 20 through 27, and so on. Notably, octal numbers do not contain digits such as 8 and 9.
There are two primary methods for converting a binary number into an octal number:
Direct Conversion: This method involves directly converting the binary number into octal without an intermediate step through decimal.
Binary to Decimal to Octal Conversion: In this approach, you first convert the binary number into decimal and then convert the obtained decimal number into octal.
Both methods are used to obtain the octal representation of binary numbers, offering flexibility in different scenarios.
Binary number | Octal Number | Binary number | Octal Number |
000 | 0 | 1000 | 10 |
001 | 1 | 1001 | 11 |
010 | 2 | 1010 | 12 |
011 | 3 | 1011 | 13 |
100 | 4 | 1100 | 14 |
101 | 5 | 1101 | 15 |
110 | 6 | 1110 | 16 |
111 | 7 | 1111 | 17 |
For example, convert (10110110)2 to octal.
Solution:
Method 1:
Step 1: Begin by dividing the given binary number into groups of three digits, starting from the right end.
10-110-110
Step 2: If the first group does not have three digits, pad it with zeros on the left. Then, assign the corresponding octal values to each group.
010-110-110
(010)₂ = (2)₈
(110)₂ = (6)₈
(110)₂ = (6)₈
Step 3: Finally, combine all the obtained octal digits.
010-110-110 = 2-6-6 = 266
Hence, the binary number (10110110)₂ is equivalent to the octal number (266)₈.
Also Check – Rational Number Formula
Hexadecimal Number System
The hexadecimal number system is a numerical system with a base of 16, utilizing digits from 0 to 9 and alphabets from A to F. In this system, the alphabets A to F represent the decimal numbers 10 to 15. Examples of hexadecimal numbers include AF₁₆, 7BF, B2A1, and so on.
There are two primary methods for converting a binary number into a hexadecimal number:
Direct Conversion: This method involves directly converting the binary number into hexadecimal without an intermediate step through decimal.
Binary to Decimal to Hexadecimal Conversion: In this approach, you first convert the binary number into decimal and then convert the obtained decimal number into hexadecimal.
Both methods are used to obtain the hexadecimal representation of binary numbers, offering flexibility in different scenarios.
Decimal number | Binary number | Hexadecimal Number | Decimal number | Binary number | Hexadecimal number |
0 | 0000 | 0 | 8 | 1000 | 8 |
1 | 0001 | 1 | 9 | 1001 | 9 |
2 | 0010 | 2 | 10 | 1010 | A |
3 | 0011 | 3 | 11 | 1011 | B |
4 | 0100 | 4 | 12 | 1100 | C |
5 | 0101 | 5 | 13 | 1101 | D |
6 | 0110 | 6 | 14 | 1110 | E |
7 | 0111 | 7 | 15 | 1111 | F |
For instance, let's convert the binary number (1101010)₂ to hexadecimal.
Solution:
Method 1:
Step 1: Commencing from the right end, group the given binary number into sets of four digits.
1101010 ⇒ 110-1010
Step 2: If the first group lacks four digits, add zeros to the left. Then, assign the corresponding hexadecimal values to each group.
110-1010 ⇒ 0110-1010
(0110)₂ = (6)₁₆
(1010)₂ = (A)₁₆
Step 3: Finally, combine all the digits.
0110-1010 = 6 – A = (6A)₁₆
Consequently, the binary number (1101010)₂, when expressed in the hexadecimal system, is equivalent to (6A)₁₆.
Example 2: Let's convert the binary number (110010101)₂ to octal.
Solution:
To convert this binary number into octal, we begin by dividing the given binary number into sets of three digits, starting from the right end. Then, we assign the corresponding octal value to each group.
110010101 ⇒ 110 – 010 – 101
(110)₂ = (6)₈
(010)₂ = (2)₈
(101)₂ = (5)₈
Finally, we combine these octal digits:
6 – 2 – 5 = 625
As a result, the binary number (110010101)₂, when expressed in the octal system, is equivalent to (625)₈.