Last chapter's perceptron draws exactly one straight line. Here are four points — and in one class, and in the other — that no single line can ever separate. Does adding a second perceptron help, or does the problem just double?
This is XOR, the classic case no line can separate. Click through all four corners: two small perceptrons — labeled A and B — look at the same and disagree, feeding their two answers into a third perceptron that combines them. Every corner comes out correct, something neither A nor B could do alone with a single line.
Stack perceptrons into a hidden layer, then feed their outputs into another perceptron:
- — hidden perceptron 's output, itself a decision.
- — hidden perceptron 's own weights and bias.
- — the output perceptron's weights and bias, applied to the hidden layer's outputs instead of the raw input.
- Two lines, not one
- Perceptron A fires like : on for every corner except .
- Perceptron B fires like : on for every corner except .
Two different lines, two different opinions.
- A third perceptron combines their opinions
Feed and into an output perceptron wired like : it fires only when both hidden neurons agree the point is "in." That happens at exactly the two corners XOR calls true.
- Depth bought a new kind of boundary
No single one of these three perceptrons can solve XOR. Stacked, they draw a boundary that's the intersection of two lines — a shape one line could never make.
(0,0)→1✗ (0,1)→1✓ (1,0)→1✓ (1,1)→1✗ — 2/4 correct
The hidden layer's weights are fixed at the OR/NAND solution above — only the output perceptron's bias is yours to drag. Watch the truth table: most values of get 2 of the 4 rows right by accident, since and already agree on those two corners. Getting all 4 takes finding the exact bias that reproduces AND.
Weights fixed at , , , , :
- Try c = 0 (a plausible-looking guess)
- At : , , so and — but the target is . Wrong.
- At by symmetry: , , , against a target of .
Both "same-input" corners fail — only gets 2 of 4 rows right.
- Try c = -1.5 instead
At : , so — correct. At : , — correct.
- Check it didn't break the other two
At and : , , so , — still correct, matching the target of at both.
- All four, from one bias
is the exact bias an AND gate uses on — fire only when both hidden neurons agree — and that alone solves every row of XOR.
Drag the output neuron’s bias until the network gets all 4 of 4 XOR rows right.
(0,0)→1✗ (0,1)→1✓ (1,0)→1✓ (1,1)→1✗ — 2/4 correct
A hidden layer doesn't add a fundamentally new kind of unit — it's perceptrons feeding perceptrons, the exact same building block from last chapter, just composed. That composition is what turns "one straight line" into "the intersection of several," and it's the whole reason depth matters at all. The next chapters ask what happens once these hand-picked weights get replaced with weights a network learns on its own.