Logic Gates (AND, OR, XOR)

A logic gate is a simple decision rule that maps two inputs (A, B) to one output. In neural networks, early models showed that networks of such rules can compute complex functions.

Interpretation for psychology students. Think of A and B as two cues. A could be "witness heard a voice" and B could be "witness saw a face." A gate answers a yes/no question about those cues. AND means both cues must be present. OR means either cue is enough. XOR means exactly one cue is present (one but not both).

Rules: AND = 1 only if A = 1 and B = 1. OR = 1 if A = 1 or B = 1 (inclusive). XOR = 1 if A and B are different.

Symbolic: A,B{0,1}   AND:y=AB    OR:y=AB    XOR:y=AB

Output: AND 0 | OR 0 | XOR 0
A B AND
A B OR
A B XOR

Truth table. This lists every possible input pair and the outputs of each gate. The highlighted row matches your current A and B selections.

A B AND OR XOR NAND NOR NOT A NOT B

Why XOR matters. XOR is not linearly separable, which means you cannot draw one straight line that separates the 1s from the 0s. This is the classic reason single-layer perceptrons fail on XOR and why hidden layers are needed.