## Building a Computer 1000: Subtraction

First off, here is a photo of what we have so far for our four-bit adder:

Nothing is glued down and we still have holes to cut and more pieces to cut out.

Last night my nine-year-old was asking more about subtraction. He had made a chart of four-bit binary representations of negative numbers. It started like this:

```1    2    3    4    5
0001 0010 0011 0100 0101
------------------------  etc
1111 1110 1101 1100 1011
-1   -2   -3   -4   -5
```

With some prodding he found the pattern that -2 is the same 1 only with 1s replaced with 0s and 0s replaced with 1s. Likewise for -3 and 2, -4 and 3, -5 and 4, etc. Another way to say this is that you can get -3 from 2 by flipping all of the bits, and similarly for the other pairs.

Next I had him try the following process: Take two positive numbers. Write them out as four-bit binary numerals. Flip all of the bits of the larger one. Add the original smaller number and the bit-flipped number together. Flip all of the bits of the result. He did the following example

```1:  0001
2:  0010

bit flipped 2:
1101

0001
+1101
----
1110

flip bits of result:
0001
```

The result is the binary representation of one, which is the difference 2-1. Here’s another example:

```8:  1000
3:  0011

bit flipped 8:
0111

0111
+0011
----
1010

flip bits of result:
0101 = 5
```

So we have to figure out how to flip bits with marbles.