Skip to content
mlmentorship

Universal approximation theorem

A neural network with one hidden layer and enough units can approximate any continuous function on a bounded domain. What it does and doesn't say about deep learning.

Published · 5 min read ·Core ·Foundation

Visual quick review

Visual first · depth when needed

Interpret universal approximation as an existence claim that some finite network stays within a chosen uniform error tolerance over a compact domain, without inferring guarantees about width, training, generalization, or behavior outside that domain.

Preparing the visual…

Summary

The universal approximation theorem (Cybenko, 1989; Hornik, 1991) applies to continuous functions on a compact subset of . A feed-forward network with one sufficiently wide hidden layer and a suitable non-polynomial activation can approximate any such function to arbitrary accuracy.

UAT is often quoted as “neural networks can learn anything.” That is a misleading summary; the theorem is an existence result, not a guarantee that:

  • training will find the approximating network,
  • the network has reasonable size,
  • it generalizes from finite samples,
  • it is practical for the input dimension you care about.

Knowing what UAT does and doesn’t promise is a senior-level expectation; the wrong reading shows up regularly in interviews.

What the theorem says (precisely)

For any continuous function on a compact and any , there exists a network

with finite width such that , where is a continuous sigmoidal activation in Cybenko’s formulation. Later results broaden the sufficient activation conditions.

Learning objective: read universal approximation as a uniform error guarantee for some finite network on a compact domain, then separate that existence claim from width, optimization, generalization, and extrapolation.

The quantifiers are the lesson

What does “there exists an approximating network” actually guarantee?

A network approximation stays inside a uniform error band only on a compact domain On the compact interval K from a to b, a solid piecewise-linear target function is surrounded by a shaded tolerance band extending twelve drawing units above and below it. A dashed piecewise-linear network approximation stays inside the band. Its vertical error at every point is at most six units, so the maximum error is below epsilon. Below the plot, one box states what the theorem provides: some finite width and weights exist. A second box states what it does not provide: a small width, weights found by SGD, generalization from samples, or behavior outside K. ON COMPACT K: UNIFORM ERROR < ε target f: solid network g: dashed upper tolerance f(x) + ε lower tolerance f(x) − ε |g − f| ≤ 6 < ε = 12 a b COMPACT DOMAIN K = [a, b] THE THEOREM PROVIDES EXISTENCE Some finite width N and some weights make supₓ∈K |g(x) − f(x)| < ε. THE THEOREM DOES NOT PROVIDE A PRACTICAL RECIPE No small N · no SGD guarantee · no finite-sample generalization No constraint outside K
Read it this way: choose the compact domain and tolerance first. The theorem says that some finite network can keep its largest vertical error below that tolerance everywhere in the domain. It does not tell you how wide the network is, how to find its weights, whether it generalizes from samples, or what happens outside the domain. The target, approximation, and coordinates are an original construction checked against Cybenko (1989).

Modern extensions:

What the theorem does not say

  1. Width may be exponential. UAT does not bound . For some functions, the required width is exponential in input dimension.
  2. Training is not guaranteed. UAT is non-constructive. It proves existence, not how SGD finds it.
  3. Generalization is not addressed. A perfect fit on training data is not the same as predicting on test data.
  4. Deep beats wide for some functions. UAT applies to wide-shallow nets; depth gives exponential efficiency for many natural functions (Telgarsky, 2016).

Why deep nets are practically necessary

If shallow nets are universal, why use deep ones? Two reasons:

  • Compositional efficiency: many functions of practical interest (image features, language structure) are naturally compositional. Deep nets express them with polynomially fewer units than shallow nets (Mhaskar & Poggio, 2016; Eldan & Shamir, 2016).
  • Optimization landscape: SGD finds good solutions in deep over-parameterized networks more reliably than in narrow shallow ones. Empirically and per modern theory (NTK, lottery ticket, etc.).

So UAT justifies “neural networks can fit anything in principle.” Practical deep learning relies on additional, separately-justified properties.

  • Barron’s theorem (1993): for functions with bounded “Barron norm,” the approximation error of a width- shallow net is . Independent of input dimension. Constructive guarantee for a restricted function class.
  • Kolmogorov–Arnold theorem (1957): continuous functions on can be exactly represented as a sum of compositions of single-variable continuous functions. Inspired KAN architectures (2024).
  • Width-bounded ReLU UAT: width is sufficient for universality (Lu et al., 2017).

What to say in interviews

If asked “do neural networks really learn anything?”:

  1. State UAT precisely (one hidden layer, non-polynomial activation, compact domain).
  2. Note that it is non-constructive and bounds nothing about width or trainability.
  3. Argue that practical deep learning relies on (a) compositional efficiency of depth, (b) the optimization landscape of over-parameterized networks, and (c) inductive biases of architectures (CNNs for translation invariance, transformers for sequences).

That sequence demonstrates senior-level understanding rather than sloganeering.

Common pitfalls

  • Citing UAT as a guarantee that any NN learns its task. UAT says some network exists; SGD may not find it.
  • Using UAT to justify wide-shallow nets. Empirically, depth helps; UAT alone doesn’t predict that.
  • Ignoring the compactness assumption. UAT is for compact domains; behavior outside the training support is unconstrained.