Logic Gates

We have all heard that computers think in ones and zeros but what they actually use is high and low. If you crack one open you can see that computers have wires (those little shiny lines on the green boards are called "traces" and carry electricity like a wire). These wires carry electricity and "one" is represented by high voltage and "zero" by low voltage. It's that simple.

These high and low states of a wire can be thought of differently depending on the application. When controlling a light, for example, it would make sense to call high "on" and low "off" because that's what happens to the light when connected to the wire. However, when doing number crunching then we use the terms "one" and "zero" instead. Likewise, when talking about logic (as we will later on this page) we'll use the terms "true" and "false". But no matter what terms we use, it's still really just comes down to high and low voltage. The terminology just helps understand things better depending on the context.

Wires by themselves aren't very interesting so besides these wires all computers have what is called "gates" which control them. All gates have inputs and outputs and perform simple logical functions. Gates can be created in several different ways, some with moving parts or vacuum tubes, however, today they are mostly manufactured using transistors on integrated circuits. You can read about the history and physical attributes of gates via the "Further study" links below, but here we'll stick with the basic ideas behind them and then build on that to show how they can combine to do more complex work. When talking about these "logic gates" it's easiest to use the terms "true" and "false".

NOT

About the simplest logic gate is the "NOT" gate. It has one input and one output and its output is whatever the input is not. So if the input is true, the output is false. And here is how that gate is drawn (click on the circle to turn on and off the input):

In this example the input is labeled "A" and the output is "X". (For all the figures on this site, I'll use the left and top as input, and right and bottom for output.) In Boolean algebra (named after Mathematician George Boole) this could be written as X = ¬A, or .

AND

Two other fundamental gates are AND and OR.

In this AND gate, X equals A and B or that can be written as X=AB. Here, X is true only when both A and B are true. In any other case, X is false. Click on the circles and try it out.

OR

Likewise, in the OR gate, X equals A or B. A mathematician might write that as X=A|B or even X=A+B. Here X is true if either A or B is true (or both are). So X is false only when A and B are both false.

Next

There are few other common gates which can be constructed from the three above. But before we move onto more complicated components it's useful to first master the truth table.

Next Up: Truth Tables »

Further study