Computers do clever things - they play chess, run spreadsheets, do voice recognition, translate languages, predict stock markets and offer thousands of other useful, or fun, or even life-saving applications. It is very tempting to suppose that they work in some irreducibly complex way. Indeed, as Arthur C. Clarke put it, "Any sufficiently advanced technology is indistinguishable from magic."

However, in their fundamental workings, computers are ridiculously simple. They are so simple that you can build computers out of wood, or lego, or tubes filled with water. All their cleverness comes from the way their very simple components have been combined. The components themselves are laughably trivial.

Suppose we play a game in which you hold out your hands and I put apples in them. I can put an apple in your left hand or leave it empty. Similarly I can put an apple in your right hand or leave it empty. If you end up with two apples, one in each hand, you say "Yes", otherwise you say "No". That's it. Quite a simple game. Congratulations, you are now a fully functioning "AND gate", a critical component of computers. An AND gate takes two inputs and if the first input AND the second input are both positive, it outputs "Yes" otherwise it outputs "No".

Let's change the game slightly. This time if you end up with an apple in your left hand OR your right hand OR both, you say "Yes" otherwise you say "No". In other words, you only say "No" if you get no apples at all. Congratulations, you are now an "OR gate", another crucial component of computers. An OR gate takes two inputs and if the first OR the second OR both are positive, it outputs "Yes", otherwise "No".

You can build these 'logic gates' out of just about anything. Here is an 'OR gate' built out of dominoes. If you knock over either the lower left or lower right domino or both, all the dominoes will fall. So we can see the lowest two dominoes as the inputs and the domino at the top as the output.

As a matter of fact, the gates in computers are typically made out of silicon and work electronically, but this is irrelevant to the cleverness of computers. What makes computers clever is the way the very simple gates are combined.

So how can we combine gates to do something clever?

Let us suppose we want to build a computer that can add two numbers together, for example 4 and 2.

Clearly we need to give those numbers to a set of gates somehow, to "input" those numbers. But we have a problem. As we saw above, gates typically take two inputs, but they can only take inputs of "yes" or "no", an apple or no apple, or in the case of computers, 1 or 0. We can't give the number 4 or 2 to a single gate.

The solution is to convert each number to a set of 1s and 0s. In other words, we need to convert the inputs to binary. If you are not conversant with binary, it's just another way of representing numbers like our normal decimal system or roman numerals. In the decimal system, columns represents 1s, 10s, 100s etc, so 523 means 3 + 20 + 500 = 523. In binary, columns represent 1s, 2s, 4s, 8s etc. So the binary number 101 means 1+4 = 5 in decimal.

So if we convert our inputs 4 and 2 to binary, we get:

Decimal | Binary | 4s | 2s | 1s |

4 | 100 | 1 | 0 | 0 |

2 | 010 | 0 | 1 | 0 |

Now that our inputs are '100' and '010', they are in a format where we can give them to some gates. But what gates?

Both numbers, '100' and '010' have 3 digits. What if we had a row of 3 OR gates and we gave each OR gate one digit from each number? It would look like this:

OR gate 1 | OR gate 2 | OR gate 3 | |

Input 1 | 1 | 0 | 0 |

Input 2 | 0 | 1 | 0 |

Output | 1 | 1 | 0 |

If we 'OR' together '100' and '010', we get '110'.

'110' in binary is 6 in decimal:

Decimal | Binary | 4s | 2s | 1s |

6 | 110 | 1 | 1 | 0 |

In binary 100+010 = 110 (6 in decimal) and in decimal 4+2 = 6. It worked! By 'OR'ing together binary versions of our numbers, we got the correct sum of the two numbers. (Note that 'OR'ing together numbers like this to add them works fine if the two numbers don't have a '1' in the same column. If they both have a '1' in the same column, like adding 101 and 001, the gates need to be a bit more complicated, because you need to 'carry' values, like when you add 9 and 7 in decimal and 'carry' 1 to give you 16.)

So you can see that we have done something quite clever, adding together two numbers, using a purely mechanical process built out of very simple components.

Everything that computers do, including sophisticated functions like playing chess or running spreadsheets or translating languages, is built up out of very simple gates like the ones we have looked at in this article.

Of course, the main point of this post is to suggest that just as the cleverness of computers is the aggregated result of simple components, so too may be the workings of our minds. The sophistication of our thought processes need not necessarily indicate that something irreducibly complex is going on.

## Please post any comments on the forum