Logic Gates

All computers have what is called "gates" which control them. Gates have inputs and outputs and perform simple logical functions. They 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