5.4. Binary Addition¶
With slight modifications can use our normal algorithms for doing binary math. Take addition for example. We are familiar with adding base ten numbers column by column, carrying to the next column any time we get a value of 10 or more in the present column. In base two, each column can only store a 0 or a 1. So any value over 1 means we have to carry. 2 (\({10}_2\)) means “zero in this column, carry a 1”, 3 (\({11}_2\)) means “one in this column, carry a 1”, 4 (\({100}_2\)) means “carry a 1 two columns over”, etc…
0 + 0 0 
0 + 1 1 
1 + 0 1 
1 + 1 10 
1 1 + 1 11 
1 1 1 + 1 100 
For multidigit numbers, simple work from right to left, adding each column and carrying as necessary:
Overflow
One thing we do have to watch out for any time we have a fixed number of bits to represent numbers is overflow. That is when a value becomes too large to store in the bits we have. When we are doing math on paper, we can add as many digits as we need. But when an electric circuit is doing math, there are a fixed number of digits that can be represented. For example, say we are using 4bit numbers and we try to add 9 + 9 (\({1001}_2\) + \({1001}_2\))  any bits past 4 need to be discarded.
1 1 (Carries) 1001 (9) +1001 (9) 10010 (18) Keep only the last 4 bits: 0010 (2 !?!)
9 + 9 gave us just 2 because we can not store the bit that should represent 16. This is an overflow error. Circuits in computers have to detect when there is a carry out of the last digit so it can signal an error and software developers have to be careful to watch for these errors. Computers use many more than 4bits to store each number, but any fixed representation will have limits to how big a value can be stored.
Self Check

Q9: What is binary 1011 + 0001?
 1102
 There are no 2's in binary!
 1010
 Forget to carry?
 1000
 Forget to carry?
 1100

Q10: What is binary 0110 + 0101?
 1011
 0111
 1111
 1001