Learn / Math / Variables, Expressions & Equations
01. Variables, Expressions & Equations
Foundations · Lesson 2 of 18 · 5:11
The three building blocks every ZK circuit is made of underneath: a name that holds a value, a calculation with no equals sign, and a claim that two things are equal.

This one looks almost too simple to deserve its own lesson. It isn’t. Every cryptographic protocol and every ZK circuit, underneath all the theory, is a pile of variables tied together with equations — look inside any real circuit and that’s all you’ll find: named values and the constraints that relate them. Modular arithmetic, finite fields, polynomial commitments — all of it is this same idea, just dressed up. So before any of that, it’s worth being precise about what a variable, an expression, and an equation actually are.

Variables — a name for a value

A variable is a symbol standing in for a value. Pick a letter, usually xx, yy, or zz, and let it hold something:

Example

x=5x = 5

xx is the variable, 55 is what it currently holds.

It helps to picture a variable as a labeled box: the label is its name, and whatever’s sitting inside is its value. age = 25 is a box named “age” with 25 inside it — exactly the same idea a programming language uses when you write age = 25 in Python or JavaScript.

age 25 a name, holding a value secret same box — value stays hidden age = 25 secret = ?
Fig. 1 — a variable is a labeled box. Nothing stops that box from staying closed.

That second box is the one cryptography actually cares about. Say there’s a password, or any value someone wants to keep private — call it secret. Writing secret = 12345 and then only ever referring to secret means the value itself never has to appear again. The box still exists, it’s still a variable, it just isn’t opened. That single habit — naming a value instead of writing it out — is the seed that zero-knowledge proofs grow from: proving something about a box without ever lifting the lid.

Expressions — a calculation, not yet a claim

An expression combines values, variables, and operations into a single computed quantity. The giveaway is that it has no equals sign — it isn’t asserting anything, it’s just describing a calculation:

Example

x+52xx2+3x + 5 \qquad 2x \qquad x^2 + 3

Three expressions. 2x2x is shorthand for 2⋅x2 \cdot x — in algebra, a number written directly next to a variable always means multiplication.

Expressions are where the actual work happens in a cryptographic system. If xx is a secret value, the expression x2x^2 means “take whatever is in that box and multiply it by itself” — and a surprising amount of real cryptography is exactly this: running a calculation over a hidden value without ever needing to see what’s inside.

Equations — a claim that two things are equal

An equation goes one step further than an expression: it states that two expressions are equal.

Example

x+5=12x + 5 = 12

Whatever xx is, adding 55 to it produces 1212.

x + 5 12 balanced — both sides are equal
Fig. 2 — an equation is a balance: whatever sits on each side, the claim is that they weigh the same.

Solving it means isolating xx — doing the same operation to both sides until xx stands alone:

Solving
x+5=12x+5−5=12−5x=7\begin{aligned} x + 5 &= 12 \\ x + 5 - 5 &= 12 - 5 \\ x &= 7 \end{aligned}

Subtracting 55 from both sides keeps the balance intact while peeling the 55 away from xx.

And it’s checkable — plug the answer back in and confirm both sides still agree:

Verifying

7+5=12✓7 + 5 = 12 \quad \checkmark

This solve-then-verify pattern shows up constantly in proof systems: a prover produces a value, and the whole protocol exists to let someone else check it satisfies the equation, without redoing the work of finding it.

One equation, two variables

Equations don’t have to pin a variable down to a single number — they can describe a relationship between two variables instead:

Example

y=x+10y = x + 10

If x=5x = 5, then y=5+10=15y = 5 + 10 = 15.

x = 5 y = x + 10 y = 15 one equation, relating two variables
Fig. 3 — a value goes in, the equation acts on it, a second variable comes out.

That’s a complete constraint: feed in xx, the equation determines yy. A real ZK circuit is built from a long chain of exactly these — thousands or millions of small relationships like this one, linked so that the output of one feeds the input of the next.

Back to the box that stays closed

Pull these three ideas together and the earlier example from this track’s introduction stops being a curiosity and starts being a template. Someone claims to know a value xx such that:

x⋅x=25x \cdot x = 25

That’s an equation. xx is a variable — the box that stays shut. x⋅xx \cdot x is the expression describing what gets checked. A zero-knowledge proof is a way to convince someone this equation holds for some value inside that box, without ever opening it. Strip away the cryptography and what’s left is exactly what this lesson covered: a named value, a calculation, and a claim of equality. Everything from here — modular arithmetic, finite fields, polynomial constraints — is this same shape, scaled up.