3.1.4 · D2Boolean Algebra & Logic Gates

Visual walkthrough — Boolean variables and operations (AND, OR, NOT)

2,026 words9 min readBack to topic

Before line one: a wire is a piece of metal. Either voltage is pushed through it (we call that 1) or it isn't (0). That is the entire alphabet. Everything below is built from that one fact.


Step 1 — One wire, two states, and the flip

WHAT. We start with the smallest possible thing: a single Boolean variable . It is a wire. It is either (dark) or (lit). The NOT operation, written (a bar over the letter), gives back the opposite wire.

WHY. Every complex circuit needs a way to say "the opposite of this". Without NOT you could never express "not raining". So we earn NOT first — it is the only operation taking a single input.

PICTURE. In the figure, the top wire is ; the bottom wire is . When one is bright, the other is dark. They are mirror images.

Figure — Boolean variables and operations (AND, OR, NOT)

Step 2 — Two wires: the AND gate is strict

WHAT. Now we take two wires, and , and ask: is everything on? That question is AND, written (a dot between them).

WHY. We need "all conditions met at once" — card present AND PIN correct. A single wire can't express a joint condition; we need a two-input operation. AND is the strict one: one dark wire ruins it.

PICTURE. Four little lamps, one per possible input pair . Only the bottom-right lamp — where both wires are lit — glows. The other three stay dark. The picture is the truth table.

Figure — Boolean variables and operations (AND, OR, NOT)

Step 3 — Two wires: the OR gate is generous

WHAT. Same two wires, opposite mood. OR, written , asks: is at least one on?

WHY. We need "any reason is enough" — rain OR snow ⇒ umbrella. This is the complement of strict AND, and we'll need both to build anything interesting.

PICTURE. Same four lamps, but now three glow — every pair except the all-dark one. Notice the crucial trap in the top-right lamp: both wires lit, yet the output is still just , not .

Figure — Boolean variables and operations (AND, OR, NOT)

Step 4 — The target: a function no single gate gives us

WHAT. We now set a goal that none of AND, OR, NOT can do alone: output only when exactly one of is on (both-on or both-off ⇒ ). Call it .

WHY. This is the real test of the parent's claim. If three tiny tools truly are functionally complete, they must be able to hit this target too. Let's first draw the target's truth table so we know what we're aiming at.

PICTURE. The desired output column: . Two lamps in the middle glow, the corners stay dark — a pattern neither pure AND nor pure OR produces.

Figure — Boolean variables and operations (AND, OR, NOT)
target
0 0 0
0 1 1
1 0 1
1 1 0

Step 5 — Build each story with AND + NOT

WHAT. Turn each story into a formula.

  • Story 1 " on and off" .
  • Story 2 " on and off" .

WHY. "on" is the wire itself; "off" is its NOT (Step 1). "and" is AND (Step 2). So each story is just one AND of a plain wire and a flipped wire — assembled from tools we already own.

PICTURE. Two mini truth tables side by side. Story 1's single glowing row is ; Story 2's is . Each catches exactly one of the two rows we want.

Figure — Boolean variables and operations (AND, OR, NOT)

Step 6 — Join the stories with OR (the finished function)

WHAT. Combine both stories with OR:

WHY. The target said "story 1 OR story 2". Each story fires on its own single row; OR (Step 3) merges those two rows into one output that is on either. Follow precedence — NOT first, then AND, then OR — and the brackets take care of themselves.

PICTURE. The two single-lamp patterns from Step 5 laid on top of each other; the OR merges them so the two middle lamps glow and the corners stay dark — exactly the Step 4 target.

Figure — Boolean variables and operations (AND, OR, NOT)

Step 7 — The degenerate / edge cases (never leave a scenario unshown)

WHAT. Check the boundary behaviours so no reader hits an unshown case.

WHY. A robust reader must know what happens when an input is pinned, or when both stories misbehave. Pinning one wire collapses to a simpler known operation — a good sanity check.

PICTURE. Two collapse-cases: pin (top) and pin (bottom), and watch reduce.

Figure — Boolean variables and operations (AND, OR, NOT)
  • Pin : . The function becomes a plain copy of — makes sense: "exactly one on" while is stuck off just means "is on?".
  • Pin : . It becomes NOT- — with always on, "exactly one on" means " must be off".
  • Both stories can never both fire: needs ; needs the opposite. They can't be together, so the OR never faces the situation here — no saturation surprises.

The one-picture summary

WHAT. The whole derivation compressed: wire → NOT → the two AND-stories → OR → finished , with the final truth column glowing.

Figure — Boolean variables and operations (AND, OR, NOT)
Recall Feynman retelling — explain the whole walk to a friend

We started with one wire that's either dark or lit — that's our only alphabet. NOT is a naughty switch that lights the other wire. AND is the strict teacher: both wires must be lit or you get nothing. OR is the generous grandma: any lit wire is enough, but she never gives you "2" — she stops at "1". Then we picked a hard target: light up only when exactly one wire is on. We split that into two little stories — "A on, B off" and "B on, A off" — each built from a plain wire ANDed with a flipped wire. Each story is a spotlight hitting exactly one row. Finally we glued the two stories with OR, and the two spotlights together lit precisely the rows we wanted, corners dark. The punchline: we never used anything but NOT, AND, OR — yet we built a function none of them could do alone. That's the promise the parent note made, now watched happen.

Recall Quick self-check
  • What three tools built ? → NOT, AND, OR only
  • formula? → ====
  • output column top-to-bottom? → 0, 1, 1, 0
  • Why split into two stories? → ==because "exactly one on" = (A on B off) OR (B on A off)==
  • What does become if is pinned to 1? → == (NOT of A)==
  • Why does OR never saturate inside this ? → the two AND-terms can never both be 1 at once

Connections

Concept Map

one wire 0 or 1

NOT flips wire

AND both lit

OR at least one lit

story A on B off

story B on A off

F exactly one on