Boolean Truth Tables

1. Boolean Truth Tables: OR, XOR, and All Sixteen Operators

The 2×2 grid representation

Every 2-input boolean function can be drawn as a 2×2 grid, one cell per input combination:

        B=0   B=1
A=0    [   ]  [   ]
A=1    [   ]  [   ]

Shading a cell means “output = 1” for that combination. This single idea — a truth table is a shading pattern over four cells — is the seed for everything else in this document set.

OR

Output is 1 unless both inputs are 0:

        B=0   B=1
A=0    [  ]  [██]
A=1    [██]  [██]

Only the (0,0) cell stays empty. Everything touching a 1 lights up.

XOR

Output is 1 when the inputs differ:

        B=0   B=1
A=0    [  ]  [██]
A=1    [██]  [  ]

A diagonal checkerboard pattern — the two “same” cells (0,0) and (1,1) are empty, the two “different” cells are shaded.

Key visual rule: OR keeps everything except the origin cell. XOR keeps only the off-diagonal. If you invert an XOR grid (swap shaded/unshaded), you get XNOR — the “same as” detector.

All sixteen 2-input operators

There are exactly 16 possible shadings of a 4-cell grid, grouped below by how many cells are lit:

── 0 ones ──
FALSE
□□
□□

── 1 one ──
NOR (neither)   A AND !B        !A AND B        AND
■□              □□              □■              □□
□□              ■□              □□              □■

── 2 ones ──
XOR (differ)    XNOR (same)     NOT A           NOT B           A (ignore B)    B (ignore A)
□■              ■□              ■■              ■□              □□              □■
■□              □■              □□              ■□              ■■              □■

── 3 ones ──
OR              NAND            B→A (A OR !B)   A→B (!A OR B)
□■              ■■              ■□              ■■
■■              ■□              ■■              □■

── 4 ones ──
TRUE
■■
■■

The symmetry

Every function has a mirror-image partner that is its exact inversion (swap every ■/□): AND↔NAND, OR↔NOR, XOR↔XNOR, TRUE↔FALSE, and the two implications mirror each other. Inverting a grid always walks you to its complementary gate — this is the “flip/invert” relationship that recurs throughout the rest of this notebook.