The XOR problem is the classic example of a function that cannot be computed by a single McCulloch-Pitts neuron.
XOR outputs 1 when exactly one of its inputs is 1 — but the four input patterns are not linearly separable.
However, a 2-layer network with 5 neurons solves it easily: two hidden neurons decompose XOR into
sub-problems (x1 AND NOT x2 and NOT x1 AND x2),
and the output neuron combines them with OR. Toggle the inputs below and watch the signals propagate through the network.
Hidden Layer
h1: step( 1·0 + (-1)·0 ) = step(0) ≥ 1 → 0
h2: step( (-1)·0 + 1·0 ) = step(0) ≥ 1 → 0
Output
y: step( 1·0 + 1·0 ) = step(0) ≥ 1 → 0
XOR = 0
Truth Table
| x1 |
x2 |
h1 |
h2 |
y (XOR) |
| 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 | 0 |