Menu

Boolean Logic

AND gate

An AND gate is a logic gate that combines its inputs into a single output. With the usual two inputs, its rule is strict: the output is 1 only when both inputs are 1, and a single 0 at either input forces the output to 0.

Think of a bike lock that needs a key turned and a code entered before it releases. Turning the key alone is not enough, and typing the code alone is not enough — both things must happen together. Set key turned = 1 and code entered = 1: only then does the lock give an output of 1 and open.

An AND gate drawn with inputs A and B and output A AND B, beside its truth table where only the row with both inputs 1 gives an output of 1.

Truth table for an AND gate

Two inputs give four possible combinations, so the truth table has four rows. Just one of those rows produces an output of 1 — the last one, where A and B are both 1:

ABA AND B
000
010
100
111

Writing AND in an expression

AND is written as A AND B. The result is true only when every condition joined by AND is true, so the answer is 0 the moment any single condition is false. If you joined three conditions as A AND B AND C, the output would be 1 only in the one case where all three are 1.

An AND gate is stricter than an OR gate: a single 1 at one input is never enough to satisfy it, however the other input is set.

Practise this