Chapter 2

# XOR Network Simulator

Solving XOR with a hidden layer — a problem no single neuron can handle

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 (x1AND NOTx2 and NOTx1ANDx2), and the output neuron combines them with OR. Toggle the inputs below and watch the signals propagate through the network.
x1
0
x2
0
Speed 1.0x

#### 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