Understanding AI · lesson 29 of 60 · about 5 minutes
Why One Neuron Isn't Enough
Some patterns are impossible for a single neuron. Find out which, and why that led to layers.
What you'll learn
- Describe the one-or-the-other pattern
- Explain why one neuron can't learn it
- Explain why that problem matters
One or the other, but not both
A neuron can learn and (both inputs on) and or (either input on). But try this rule: say yes when exactly ONE input is on, but not both. It's called exclusive or, often written XOR.
Example: a light controlled by two switches at either end of a hallway changes when you flip either switch, but flipping both puts it back.
Why one neuron fails
A single neuron can only split its inputs with one straight line: yes on one side, no on the other. For XOR, the yes cases (0,1) and (1,0) sit at opposite corners, with the no cases at the other two corners. No single straight line separates them.
In 1969 this was a famous reason people thought neural networks were a dead end. The answer turned out to be layers.
The XOR rule written out. `!=` means not equal: yes when the inputs differ.
for x1 in [0, 1]:
for x2 in [0, 1]:
print(x1, x2, 1 if x1 != x2 else 0)Output
0 0 0
0 1 1
1 0 1
1 1 0Tip
One neuron draws one straight line. Some patterns need more than one line.
Now try it yourself
This lesson is free in Codiqo, with 6 questions on what you just read. You can only learn to code by writing code, so it ends with a short program you write yourself, which we run and check straight away.