Exercises — Universal approximation theorem
Two objects we lean on the whole way down, restated in plain words so no notation is unearned:
Figure s01 (below): the three blocks on one axis — a black sigmoid step (rises once and stays up), the black dashed ReLU (a straight ramp that never levels off), and the red sigmoid bump (on only between and ). Read it left-to-right: only the red curve is localized — it comes back down. That single visual is the whole reason bumps, not bare steps, tile a function.

Level 1 — Recognition
L1.1
Which of the following functions can the Universal Approximation Theorem (UAT) guarantee to -approximate with a single hidden layer? For each, answer YES/NO and give the one-word reason. (a) on (b) on (c) (floor) on (d) on
Recall Solution
The two hypotheses are: continuous target, on a compact (closed + bounded) domain.
- (a) YES — is continuous, is closed and bounded. ✔ both.
- (b) NO — domain is open at (not closed ⇒ not compact) and blows up. ✘ compactness.
- (c) NO — floor has jumps ⇒ not continuous. ✘ continuity.
- (d) YES — a Gaussian is continuous, is compact. ✔ both.
L1.2
A shallow net uses activation . For each activation, state whether Leshno's criterion (universal non-polynomial) is satisfied: (a) , (b) , (c) , (d) (constant).
Recall Solution
Universal activation is non-polynomial.
- (a) is a polynomial ⇒ NOT universal.
- (b) is non-polynomial ⇒ universal.
- (c) ReLU is non-polynomial (a kink is not a polynomial) ⇒ universal.
- (d) constant is a (degree-0) polynomial and is not "non-constant" ⇒ NOT universal.
Level 2 — Application
L2.1
You want localized bumps to tile using sigmoids. How many hidden neurons do you need for (a) , (b) , (c) ? Give the formula.
Recall Solution
Each sigmoid bump = subtract two sharp steps = 2 neurons. So .
- (a) .
- (b) .
- (c) .
L2.2
Approximate on with a 4-bump staircase (heights = at the midpoints of the four equal subintervals ). List the four heights, and how many hidden neurons this uses.
Recall Solution
Midpoints: . Heights :
Neurons: bumps hidden neurons.
L2.3
With a large sharpness , evaluate the single sigmoid step at the step location . What value do you get, and what does it mean geometrically?
Recall Solution
At : . Geometrically: every sigmoid, no matter how sharp, passes through height exactly at its center . The step is antisymmetric about that point — this is why is called the "location" of the step.
Level 3 — Analysis
L3.1
Show algebraically that is not a localized bump but a ramp that plateaus at height . Evaluate it at for .
Recall Solution
Let with .
- : .
- : .
- : .
- : .
- : .
The value rises from to over and then stays at forever — it never returns to . That is a plateau, not a bump.
Figure s02 (below) shows exactly this: the red curve climbs the ramp over then flatlines at the dotted line and never comes back down. Contrast it mentally with the red localized bump of figure s01 — that is the visual difference between "plateau" and "bump" the whole ReLU discussion turns on.

L3.2
Explain, using uniform continuity, why the staircase error can be driven below any . Where exactly does compactness enter?
Recall Solution
Uniform continuity (Uniform continuity) says: for any target error there is a single width such that whenever two inputs are within , their -values are within — and this same works everywhere on the domain.
- Make each staircase interval narrower than that . Then on each interval varies by less than , so the constant plateau (set to at the midpoint) is within of across that whole interval.
- Compactness is what upgrades ordinary continuity to uniform continuity: on a closed, bounded set a continuous function is automatically uniformly continuous. Without compactness (e.g. on ) no single works everywhere — you'd need infinitely narrow intervals near the trouble spot, i.e. infinitely many neurons.
Level 4 — Synthesis
L4.1
Build a true flat-top (rectangular) bump from ReLUs. Design a combination of ReLU units that is across the whole interval and outside , using steep ramps of width on each side. Give the explicit formula and verify it numerically.
Recall Solution
Idea: a flat top needs four corners, so we place four ReLU kinks — one where the left ramp starts, one where it must stop rising, one where the right ramp starts falling, one where it must stop falling. Between the middle two kinks the slopes cancel to , giving a genuine flat plateau (unlike the triangle you'd get from only three kinks).
Use a steep slope so each side climbs/falls by exactly over its width- ramp:
- Term 1 starts a ramp at .
- Term 2 cancels that ramp at → the value holds flat at height .
- Term 3 starts a ramp at → begins descending.
- Term 4 cancels the descent at → the value holds flat at forever.
Peak height on the plateau . ✔ (no phantom half-height — the two inner kinks are what flatten the top instead of forming a triangle apex.)
Numerical check. Take , so :
- : . ✔ off left.
- (start of top): . ✔ at height .
- (middle of top): . ✔ flat at .
- (end of top): . ✔ still .
- : . ✔ back to zero.
- : . ✔ off right forever.
This is a genuine flat-top rectangular bump using 4 ReLU units — vs 2 sigmoid units. That extra pair of units is the "constant-factor overhead" the parent note mentioned.
L4.2
For the target on , how many hidden ReLU neurons does the 4-unit flat-top bump strategy cost for bumps, compared to the sigmoid count from L2.2?
Recall Solution
- Sigmoids: per bump neurons.
- ReLU flat-top bumps: per bump neurons.
Ratio — a constant factor overhead, not an exponential one. Universality is unaffected; only efficiency shifts. (In practice ReLU nets share kinks between neighbouring bumps and rarely pay the full ; see Depth vs Width tradeoff.)
Level 5 — Mastery
L5.1
A student claims: "I trained a 1-hidden-layer net and it fit my 500 training points to zero error. By UAT it will predict any new point accurately." Identify every flaw and state what UAT does and does not promise.
Recall Solution
Three distinct flaws:
- Existence ≠ learnability. UAT says there exist weights achieving small error; it does not say gradient descent + Backpropagation found them, nor that the found ones are the approximating ones.
- Fitting ≠ generalizing. UAT is about approximating a target on its domain given ideal weights. Fitting 500 sampled points says nothing about points between them — that is Overfitting and generalization, a separate bias–variance issue.
- "Zero training error" is a red flag, not a guarantee — it often signals overfitting (memorizing noise), which typically hurts new-point accuracy.
UAT promises: for a continuous target on a compact domain, a wide-enough shallow net can be within everywhere. UAT does not promise: trainability, small width, or generalization to unseen data.
L5.2
Design the smallest argument showing why UAT gives no lower bound on that is useful in practice, and connect it to why we build deep nets.
Recall Solution
UAT is an existence statement: " such that error ." It is silent on how large must be.
- For some functions the required grows exponentially with input dimension or with the fineness — the staircase needs a bump per feature-combination.
- Because can explode and the loss landscape can be hard, a shallow solution may be both huge and untrainable.
- Depth re-expresses the same function by composing simple maps: features built in early layers are reused, so the total neuron count can drop from exponential to polynomial. Same capability (UAT already granted it), far better efficiency — the theme of Depth vs Width tradeoff.
So UAT ends the "can it be done?" question (yes) and hands off to depth theory for the "how cheaply?" question.
Recall Self-check summary
Compactness gives ::: uniform continuity, so one interval width works everywhere. Sigmoid bump neuron cost per bump ::: 2 (subtract two steps). ReLU flat-top bump neuron cost per bump ::: 4 (up-ramp, cancel, down-ramp, cancel). UAT is an existence result about ::: fitting a continuous target on a compact domain, not learnability or generalization. Why we still go deep ::: same capability, exponentially fewer neurons and easier training.