Lesson 5.1 · 7 min read · about 50 min to master at a very slow pace
The Universal Approximation Theorem
One hidden layer with enough neurons can approximate any continuous function on a bounded domain as closely as you like. The precise statement, what each condition means, and the extension that covers ReLU.
The statement
Let be a continuous sigmoidal activation, a compact (closed and bounded) set, and any continuous function. Then for every there is a network with one hidden layer of finitely many units,
such that
This is Cybenko's theorem (1989). Leshno and colleagues (1993) extended it to any continuous activation that is not a polynomial, which includes ReLU.
Reading each condition
| Condition | What it means |
|---|---|
| Compact | Inputs come from a closed, bounded region, such as . No promise about behaviour far outside it. |
| Continuous | No jumps in the target. (Classification outputs are handled through probabilities; see lesson 5.3.) |
| Any | You can make the error as small as you want, by using enough units. |
| , the worst case | The error bound holds everywhere on at once (uniform approximation), not just on average. |
| Non-polynomial activation | A polynomial activation only produces polynomials of bounded degree, which can't approximate everything. |
Plain-language version
"On a closed and bounded input domain, a neural network with a single hidden layer, enough neurons and a suitable non-linear activation can approximate any continuous function to any desired accuracy."
Stuck? Common doubts
Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.
First passIf one hidden layer is enough, why do we build deep networks?
Because "enough neurons" can mean an impractically huge number, and the theorem says nothing about finding the weights or about generalising from limited data. Deep networks can often represent the same function with far fewer units, by composing simple pieces (Section 3). Lesson 5.3 lists what the theorem doesn't promise.
First passWhat do "continuous function", "approximate" and "compact set" mean in plain words?
| Term | Plain meaning | Example |
|---|---|---|
| Continuous function | You can draw it without lifting your pen: no jumps | is continuous; a step from 0 to 1 is not |
| Approximate | Get as close as you want to the target function, everywhere on the domain (within ) | Error below 0.01 at every input in |
| Compact set | A closed, bounded range of inputs | or a box ; not "all real numbers" |
"Approximate" here is about representing a function that's already known. It isn't about predicting new data: generalisation is a separate question the theorem doesn't answer.
First passDoes the theorem say that in practice we need more than one hidden layer?
No. It says one hidden layer is enough to exist. The reason we build deep networks in practice comes from elsewhere: the one-layer network may need an impractically large number of neurons, while a deeper network can represent the same function with far fewer (lesson 11.1).
Cheatsheet
Universal approximation
Check your understanding
Score 75% or more to master this lesson and earn XP. Answer first, then check.