3.1.7 · D3Neural Network Fundamentals

Worked examples — Universal approximation theorem

2,618 words12 min readBack to topic

This is a hands-on companion to the parent theorem note. There we argued why sums of squashed activations can trace any shape. Here we grind through every case by hand — every kind of input the theorem can face — and check each number.

Before we start, one promise: every symbol below is defined the moment it appears.


The scenario matrix

Every case this topic can throw at you falls into one of these cells. The eight examples that follow are each tagged with the cell(s) they cover, so together they touch every box.

# Case class What's tricky Covered by
A Single sigmoid, generic reading a step's value at any point Ex 1
B Sign of (positive vs negative) negative flips the step Ex 2
C Degenerate the neuron dies — constant output Ex 3
D Bump construction (two sigmoids) subtracting steps to isolate a region Ex 4
E Staircase fit of a real choosing heights, counting neurons Ex 5
F Limiting behaviour (, ) how sharp/how many for target error Ex 6
G Assumptions break (non-compact / unbounded) why no finite net works Ex 7
H Exam twist: ReLU instead of sigmoid ramp bump; neuron overhead Ex 8

The figure below shows the three shapes these cells produce, side by side, so you can see at a glance what a "step", a "bump", and a "ramp" each look like — every example rebuilds one of them.

Figure — Universal approximation theorem
Figure s01 — Left (lavender): a single soft step, the object of Cells A and B. Middle (coral): two steps subtracted give a localized bump, Cell D. Right (mint): two ReLUs subtracted give a ramp that never comes back down, Cell H. Notice the bump returns to zero on both sides while the ramp does not.


Worked examples

The next figure draws exactly this construction, so you can see the two dashed cliffs and their solid difference:

Figure — Universal approximation theorem
Figure s02 — The lavender and butter dashed curves are the two steps at and ; the coral solid curve is their difference . Arrows mark that is inside the interval and on both sides — a localized rectangular bump.

The staircase and the true parabola are plotted together below:

Figure — Universal approximation theorem
Figure s03 — Slate curve: the true . Mint dots: the four midpoint heights . Coral flats: each bump's plateau sitting at . Lavender dashed: the assembled 8-neuron staircase hugging the parabola.

The final figure contrasts the ReLU ramp with a sigmoid bump on one axis:

Figure — Universal approximation theorem
Figure s04 — Mint solid: the ReLU difference climbs then plateaus at and never returns to zero (annotated). Coral dashed: a sigmoid bump for comparison, which does return to zero on both sides. This is why two ReLUs are not a drop-in replacement for two sigmoids.


Recall Quick self-test on the matrix

Which cell warns you a single neuron can go flat and useless? ::: Cell C — kills the -dependence, leaving only . Which cell shows why small blows up neuron count? ::: Cell F — error , so halving error doubles and . Two sigmoids give a bump; two ReLUs give a ___ ? ::: ramp that plateaus at , not a localized bump. Why does on defeat every finite net? ::: non-compact, unbounded target vs bounded network output.

Related ideas: Overfitting and generalization (fitting generalizing) and Backpropagation (finding these weights in practice, which the theorem does not promise).