Part 2: Binary Arithmetic One of the most common operations we perform on binary numbers (and all numbers) is addition. It can be cumbersome to convert your binary numbers to decimal just to add them and convert them back, so instead we will be learning how to add binary numbers directly. Binary addition works the same way as decimal addition, with the added restriction that each digit can only go up to 1. Let's consider the possibilities for adding the values of any 2 single digits together: 0 + 0 0 + 1 1 + 0 1 + 1 0 1 1 10 (remember that 10 in binary represents the number 2) In that last case, the result is larger than a single digit. When adding larger binary numbers, that means we have to carry the 1 over to the next column. This presents us with another new case: what happens if we have 1 + 1 + carried 1? In that case, the result is 11, which means that column's result is 1, and we carry 1 to the next column. Below is an example of adding two binary numbers that shows all cases: carry: 1 1 1 1 in decimal 0 1 1 0 1 1 0 0 108 + 0 0 1 1 1 0 1 0 = + 58 1 0 1 0 0 1 1 0 166 first column (1's place): 0 + 0 = 0 second column (2's place): 0 + 1 = 1 third column (4's place): 1 + 0 = 1 fourth column (8's place): 1 + 1 = 0, carry 1 fifth column (16's place): 0 + 1 + carried 1 = 0, carry 1 sixth column (32's place): 1 + 1 + carried 1 = 1, carry 1 seventh column (64's place): 1 + 0 + carried 1 = 0, carry 1 last column (128's place): 0 + 0 + carried 1 = 1 Exercise 4: What is 10001000 + 00101000? Show the result in binary. Exercise 5: What is 00011111 + 11000101? Show the result in decimal.
Part 2: Binary Arithmetic
One of the most common operations we perform on binary numbers (and all numbers) is addition. It can be cumbersome to convert your binary numbers to decimal just to add them and convert them back, so instead we will be learning how to add binary numbers directly.
Binary addition works the same way as decimal addition, with the added restriction that each digit can only go up to 1. Let's consider the possibilities for adding the values of any 2 single digits together:
0 + 0 | 0 + 1 | 1 + 0 | 1 + 1 |
0 | 1 | 1 | 10 |
(remember that 10 in binary represents the number 2)
In that last case, the result is larger than a single digit. When adding larger binary numbers, that means we have to carry the 1 over to the next column. This presents us with another new case: what happens if we have 1 + 1 + carried 1? In that case, the result is 11, which means that column's result is 1, and we carry 1 to the next column. Below is an example of adding two binary numbers that shows all cases:
carry: 1 1 1 1 in decimal
0 1 1 0 1 1 0 0 108
+ 0 0 1 1 1 0 1 0 = + 58
1 0 1 0 0 1 1 0 166
first column (1's place): 0 + 0 = 0
second column (2's place): 0 + 1 = 1
third column (4's place): 1 + 0 = 1
fourth column (8's place): 1 + 1 = 0, carry 1
fifth column (16's place): 0 + 1 + carried 1 = 0, carry 1
sixth column (32's place): 1 + 1 + carried 1 = 1, carry 1
seventh column (64's place): 1 + 0 + carried 1 = 0, carry 1
last column (128's place): 0 + 0 + carried 1 = 1
Exercise 4: What is 10001000 + 00101000? Show the result in binary.
Exercise 5: What is 00011111 + 11000101? Show the result in decimal.
Step by step
Solved in 3 steps