Every lesson so far started with a polynomial and worked outward from it — building, evaluating, combining. Today flips the problem around: given a handful of points, how do you find the one polynomial that passes through all of them? That question has a name, Lagrange interpolation, and it’s the exact mechanism that turns an entire ZK circuit into a single polynomial.
The problem
Take three points: , , and . What polynomial passes through all three? With exactly three points, exactly one polynomial of degree fits.
The trick: basis polynomials
The trick is to build one small helper polynomial per point — a Lagrange basis polynomial. Each one is engineered to equal at its own point and at every other point in the set.
Each basis polynomial only ever “turns on” for its own point — everywhere else, it contributes nothing.
Building one is mechanical: for every other point, multiply in a factor of , then divide by whatever that same product evaluates to at your own point — which forces the result to land on exactly there.
Combining them
With all three basis polynomials built, combine them by scaling each one by its point’s -value and adding the results together.
Checking this against the original points confirms it works — at each , exactly one basis polynomial is “on,” and it hands back exactly that point’s -value.
Expanded out, all of that simplifies down to a single clean expression: — exactly the curve from Fig. 1.
The general formula
Nothing about this is specific to three points. The same construction works for any number of them:
Sum each point’s -value times its own basis polynomial — that’s the entire formula, however many points there are.
Why this matters for ZK
Here’s the payoff. In a QAP — the structure behind Groth16 — every gate in a circuit becomes a point: the gate’s index paired with its value.
Lagrange interpolation takes that entire set of points and produces a single polynomial representing the whole circuit at once. This is literally what the Q in QAP stands for — Quadratic Arithmetic Program — the same idea this lesson just built from scratch, running at the scale of a real circuit.