Knowledge Sprint SeriesMT24 Learning

Phase 10 · Sprint 31/90 · Neural NetworksMcCulloch · Rosenblatt · Minsky · Papert · Rumelhart

From Perceptron to Multilayer Network

One neuron draws one straight line. XOR needs a bend, and a hidden layer supplies it.

In short. The artificial neuron and the perceptron, its convergence promise, why XOR defeats a single line, and how a hidden layer bends the space.

Sprint 31 of 90 infographic: From Perceptron to Multilayer Network. One neuron draws one straight line. XOR needs a bend, and a hidden layer supplies it. The full text of the image is on this page.
Full resolution2160 × 2700 PNGPhase summary

The part of the image you are reading lights up. Tap a part to jump to its text.

Fig. 1 in words

XOR: one line fails, one hidden layer works · same data as code 05

  1. 1 Input space

    • a square with axes x₁ and x₂, ticks 0 and 1
    • filled blue points at top left and bottom right, open orange rings at bottom left and top right
    • 0.5 inside the shaded square, between two dashed red lines
    • best line: 0.5 for all four
    • any line: 3 of 4 at most
  2. 2 Hidden layer by hand · §6.1

    • x₁ and x₂ each feed two Σ units through weights: ▭ all = 1
    • top unit c = 0, then a ReLU to h₁; bottom unit c = -1, then a ReLU to h₂
    • ReLU max(0, z)
    • h₁ goes to out with +1, h₂ with -2; out is a Σ unit
    • out = 0, 1, 1, 0 · exactly XOR
  3. 3 Hidden space

    • axes with ticks 1 (up) and 1, 2 (across)
    • open orange rings at the origin and at top right; one filled blue point on the axis at 1, marked ×2
    • a green line; the shaded side below it reads out 1
    • h₁ − 2h₂ = 0.5
    • one line now works
    • (0,1), (1,0) → (1,0)
  4. 4 100 seeds

    • a grid of dots, one per seed, green and red; one red dot boxed
    • 2 hidden: 77 solve (green), 23 freeze (red)
    • 4 hidden: 100 solve

01 One Neuron, One Line Unit

  • Sum weighted inputs, fire past a threshold: an idea from McCulloch & Pitts (1943)
  • Its border is one straight line: w·x + b = 0
  • Rosenblatt (1958) made it learn. Modern rule: after a mistake, add error × input

Rosenblatt’s Mark I machine kept its weights in an array of potentiometers (Smithsonian).

02 A Promise, If… Novikoff

  • If one line separates the classes, the rule stops after a finite number of mistakes (Novikoff 1962)
  • AND: no miss from epoch 6
  • XOR: from epoch 2 every epoch ends on the same weights. A loop, not slow progress

No line separates XOR, so the theorem promises nothing.

03 What XOR Asks XOR

  • Answer 1 when exactly one input is on
  • The best straight line answers 0.5 for all four (Goodfellow et al. 2016, §6.1)
  • Minsky & Papert (1969) proved limits of one-layer perceptrons, not of networks

“The book that killed neural nets” is the official history Olazaran (1996) examined, not a theorem.

04 Bend the Space Hidden

  • Two ReLU units move (0, 1) and (1, 0) onto one point: (1, 0)
  • In that new space one line works: h₁ − 2h₂ gives 0, 1, 1, 0
  • Without a nonlinearity, stacked layers collapse into one linear map

The network does not find a better line. It builds a space where a line is enough.

05 Try It Yourself PYTHON 3.13.15

sprint31_from_perceptron_to_multilayer_network.py

import numpy as np
X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
AND, XOR = np.array([0, 0, 0, 1]), np.array([0, 1, 1, 0])
def perceptron(y, epochs=100):      # Rosenblatt's rule
    w, b = np.zeros(2), 0.0
    for e in range(1, epochs + 1):
        miss = 0
        for x, t in zip(X, y):
            err = t - int(w @ x + b > 0)
            w += err * x; b += err; miss += err != 0
        if miss == 0: return f"no miss from epoch {e}"
    return f"{miss} misses in epoch {epochs}"
print("AND", perceptron(AND), "| XOR", perceptron(XOR))
A1 = np.c_[X, np.ones(4)]            # best straight line
print("line", np.linalg.lstsq(A1, XOR)[0].round(3) + 0.)
W, c = np.ones((2, 2), int), np.array([0, -1])
H = np.maximum(0, X @ W + c)         # ReLU (§6.1)
print("hidden", H.tolist(), "out", (H @ [1, -2]).tolist())
sig = lambda z: 1 / (1 + np.exp(-z))
def train(h, seed, steps=5000, lr=0.5):   # 2-h-1 net
    rng = np.random.default_rng(seed)
    W1, b1 = rng.normal(size=(2, h)), np.zeros(h)
    W2, b2 = rng.normal(size=h), 0.0
    for _ in range(steps):
        A = sig(X @ W1 + b1); p = sig(A @ W2 + b2)
        d2 = p - XOR; d1 = np.outer(d2, W2) * A * (1 - A)
        W2 -= lr * A.T @ d2; b2 -= lr * d2.sum()
        W1 -= lr * X.T @ d1; b1 -= lr * d1.sum(0)
    return p
ok = lambda h, s: all(abs(train(h, s) - XOR) < .1)
n = [sum(ok(h, s) for s in range(100)) for h in (2, 4)]
print("2 and 4 hidden units solve", n, "of 100")
bad = next(s for s in range(100) if not ok(2, s))
print("seed", bad, train(2, bad).round(3))

Output, as printed on the image

AND no miss from epoch 6 | XOR 4 misses in epoch 100
line [0.  0.  0.5]
hidden [[0, 0], [1, 0], [1, 0], [2, 1]] out [0, 1, 1, 0]
2 and 4 hidden units solve [77, 100] of 100
seed 6 [0.001 0.5   0.999 0.5  ]

Run it. sprint31_from_perceptron_to_multilayer_network.py · versions, data and steps

Check: 1 − 2·0 = 1 · 2 − 2·1 = 0 · 77 + 23 = 100 · loss of seed 6: 1.389 ≈ 2 ln 2 = 1.386 · numpy 2.5.3

06 General Notes Practice

  • One wide enough hidden layer can approximate any continuous function on a bounded box (Cybenko 1989; Hornik et al. 1989)
  • That proves the weights exist, not that training finds them (Goodfellow et al. §6.4.1)

Count the seeds that succeed. Here 23 of 100 runs froze at 0.5, still there after 200 000 steps.

07 Mini Project Hands-on

  • Rerun with 1, 3 and 8 hidden units (here: 0, 99 and 100 of 100)
  • Add direct input-to-output wires (Rumelhart et al. 1986) and retry 1 hidden unit
  • Swap sigmoid for tanh; recount the freezes
  • Train the perceptron on OR and NAND

Seed 6 is the first run that freezes. Start there.

R Trusted Sources

  1. McCulloch & Pitts (1943). A Logical Calculus of the Ideas Immanent in Nervous Activity. Bull. Math. Biophys. 5, 115–133
  2. Rosenblatt (1958). The Perceptron: A Probabilistic Model for Information Storage and Organization in the Brain. Psychol. Rev. 65(6), 386–408
  3. Novikoff (1962). On Convergence Proofs on Perceptrons. Symp. Math. Theory of Automata 12, 615–622
  4. Minsky & Papert (1969). Perceptrons. MIT Press
  5. Rumelhart, Hinton & Williams (1986). Learning Internal Representations by Error Propagation. Parallel Distributed Processing, vol. 1, ch. 8, MIT Press
  6. Cybenko (1989). Approximation by Superpositions of a Sigmoidal Function. MCSS 2(4), 303–314
  7. Hornik, Stinchcombe & White (1989). Multilayer Feedforward Networks Are Universal Approximators. Neural Netw. 2(5), 359–366
  8. Goodfellow, Bengio & Courville (2016). Deep Learning, ch. 6. MIT Press
  9. Olazaran (1996). A Sociological Study of the Official History of the Perceptrons Controversy. Soc. Stud. Sci. 26(3), 611–659

Cite this phase

Tahri, M. (2026). MT24 Learning — Knowledge Sprint Series, Phase 10: Neural Networks (Version 1.0) [Educational resource]. Zenodo. https://doi.org/10.5281/zenodo.23343237

Version DOI 10.5281/zenodo.23343237 · all versions 10.5281/zenodo.23343236 · first published 7 October 2026