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.

Not startedJump to quiz

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

ConditionWhat 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 caseThe error bound holds everywhere on at once (uniform approximation), not just on average.
Non-polynomial activationA 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?
TermPlain meaningExample
Continuous functionYou can draw it without lifting your pen: no jumps is continuous; a step from 0 to 1 is not
ApproximateGet as close as you want to the target function, everywhere on the domain (within )Error below 0.01 at every input in
Compact setA 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

Continuous on compact , any : a one-hidden-layer network with enough units has . Non-polynomial activations (incl. ReLU).

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1conceptWhich is a correct statement of the universal approximation theorem?
Q2conceptWhat does the "compact" in "compact set " require of the inputs?
Q3conceptWhy does the theorem measure error with ?
Q4interpretDoes the theorem apply to networks with ReLU activations?
Q5conceptWhy must the activation not be a polynomial for the theorem to hold?