06

What a neuron cannot do

Why is a single neuron not enough?

6 min

What a neuron cannot do

With voice. You can pause and jump to any step.

Lesson complete

Subtitles

A neuron with two inputs draws a line and splits the plane into two sides. The question is whether one line is always enough.

Voice

No voice: the lesson advances on its own with subtitles.

The voice for this lesson is being recorded: for now it advances on its own with subtitles.

0:00 / 0:00

What you will achieve

  • Explain why a single neuron cannot solve XOR, with a geometric argument.
  • Describe what a hidden layer does: it creates new signals until one line is enough.
  • Place the perceptron’s limit in its historical context without overstating it.

Key ideas

  1. One neuron splits the plane with a line: it only solves linearly separable problems.
  2. XOR is not linearly separable: its two diagonals cross, so no line gets all four corners right.
  3. A hidden layer creates new signals (here, “some input” and “both”); in that new space, a line does separate.
  4. The XOR limit belonged to the single neuron: a hidden layer overcomes it. Minsky and Papert doubted multi-layer networks but left it as an open problem; what was missing was a practical method to train hidden layers.
  5. The history of AI has cycles of enthusiasm and disillusion; the causes are several, not just one book.

What many people believe

Common belief Minsky and Papert proved that neural networks could not work, and that is why they were abandoned.

What is true They showed real limits of single neurons. They doubted multi-layer networks, but left it as an open problem: they did not prove them useless. The disillusion of the 1970s also had other causes, such as the Lighthill report, published in 1973.

Check yourself

Four questions. No grade, no account: they just show whether the idea stuck.

ConceptWhy does no line separate the four XOR points?
ConceptWhat does the hidden layer do in the XOR example?
CalculationWith h₁ = OR(x, y) and h₂ = AND(x, y), what values does the hidden layer take for the input (1, 0)?
ApplicationA vendor claims its “single-layer” model (no hidden layer) solves any classification problem. Which response is the soundest?

Under the hoodFor those who want the math and the code. You do not need it to follow the course.

Why XOR is not linearly separable

A two-input neuron answers f(x,y)=1f(x,y)=1 if w1x+w2y+b>0w_1x+w_2y+b>0 and 00 otherwise. For XOR we would need all of these at once:

b≤0,w1+b>0,w2+b>0,w1+w2+b≤0.b\le 0,\qquad w_1+b>0,\qquad w_2+b>0,\qquad w_1+w_2+b\le 0.

Adding the two middle inequalities: w1+w2+2b>0w_1+w_2+2b>0, that is, w1+w2+b>−b≥0w_1+w_2+b>-b\ge 0, which contradicts the last one. No weights work: it is the same geometric argument about the diagonals, in algebra. It is also the argument Minsky and Papert use in Perceptrons (§2.1) to show that the equivalence x≡yx\equiv y, the complement of XOR, cannot be computed by a single neuron; the book notes (§1.4) that, of the 16 Boolean functions of two variables, these are the only two with that limitation. We checked it by brute force: over a fine grid of (w1,w2,b)(w_1,w_2,b), 14 of the 16 truth tables are reachable, and the two missing ones are XOR and its complement.

The solution with a hidden layer

With the step function HH (1 if the argument is positive, 0 otherwise), these weights solve XOR:

h1=H(x+y−0.5),h2=H(x+y−1.5),output=H(h1−h2−0.5).h_1=H(x+y-0.5),\qquad h_2=H(x+y-1.5),\qquad \text{output}=H(h_1-h_2-0.5).

h1h_1 is OR, h2h_2 is AND, and the output is “OR and not AND,” which is XOR. In the (h1,h2)(h_1,h_2) plane the four points become (0,0)(0,0), (1,0)(1,0), (1,0)(1,0), and (1,1)(1,1): the ones merge at (1,0)(1,0) and a line now separates the classes.

What Minsky and Papert proved, and what they did not

In Perceptrons (1969), a perceptron “of order kk” is a threshold neuron whose inputs are predicates, each of which depends on at most kk inputs. Among other results, they proved that the parity of nn bits has order nn (theorem 3.1.1): at least one predicate that looks at all the inputs is required. With n=2n=2, parity is XOR.

On multi-layer networks, the book says (§13.2) that they considered “Gamba machines,” described as “two layers of perceptron,” and found no other really interesting class of multilayered machine; and it adds: “we consider it to be an important research problem to elucidate (or reject) our intuitive judgment that the extension is sterile.” They present it as a conjecture to be tested, not as a theorem.

In code

import numpy as np

H = lambda z: (z > 0).astype(int)       # step

def xor_net(x, y):
    h1 = H(x + y - 0.5)                  # OR
    h2 = H(x + y - 1.5)                  # AND
    return H(h1 - h2 - 0.5)              # OR and not AND

for x in (0, 1):
    for y in (0, 1):
        print(x, y, "->", int(xor_net(np.array(x), np.array(y))))
# 0 0 -> 0 | 0 1 -> 1 | 1 0 -> 1 | 1 1 -> 0

What comes next

The weights in this example were chosen by hand. In a real network they are learned with gradient descent, which needs the gradient of every weight, including those of hidden layers: backpropagation solves that (lesson 8), which Rumelhart, Hinton, and Williams described in 1986, showing how hidden units come to represent new features of the task. First, lesson 7 shows why layers need a nonlinear activation function.

Decision lens

What this idea means if your job is to decide, not to code.

  • Cycles of enthusiasm and disillusion are part of AI’s history: ask for evidence with your data before promises.
  • If a vendor talks about a “linear” or “single-layer” model (no hidden layer), ask whether your problem has interactions between variables that such a model cannot capture.
  • Hidden layers capture interactions like XOR, but they usually need more data and careful training: more capacity also brings more risk of mistakes.
  • When someone says “AI cannot do that,” ask with which method: many limits belonged to a specific architecture, not to the general idea.

Terms in this lesson

Full transcript
CommentsThis lesson’s public conversation: questions, facts to check, ideas.

Comments live in GitHub Discussions, in the course’s public repository; writing one requires a GitHub account. They load from giscus.app when you open this section. The course reviewers read them, and if a change is accepted, it is applied in both languages. Open the thread on GitHub

Sources