Learn / Math / Polynomial Arithmetic
08. Polynomial Arithmetic
Algebra for ZK · Lesson 9 of 18 · 3:41
Addition, subtraction, multiplication, and division for polynomials — the same journey modular arithmetic took, one level up, including why a zero remainder is exactly what a ZK proof system checks for.

The last lesson covered what a polynomial is. This one covers what you can do with it — adding, subtracting, multiplying, and dividing polynomials, which turns out to be exactly the same journey plain numbers took a few lessons back, just one level up.

Adding polynomials

Adding two polynomials means grouping their matching powers of xx together and adding the coefficients that sit on each one.

adding polynomials (3x² + 2x + 5) + (x² + 4x + 1) step 1 — group like terms (3x²+x²) + (2x+4x) + (5+1) step 2 — add each group 4x² + 6x + 6 add coefficients of matching powers of x
Fig. 1 — grouping matching powers of x, then adding the coefficient in each group.
Addition

(3x2+2x+5)+(x2+4x+1)=4x2+6x+6(3x^2 + 2x + 5) + (x^2 + 4x + 1) = 4x^2 + 6x + 6

Subtracting polynomials

Subtraction works the same way, with one extra move first: flip the sign of every term in the second polynomial, then add as usual.

subtracting polynomials (3x² + 2x + 5) − (x² + 4x + 1) step 1 — flip signs of the second 3x² + 2x + 5 − x² − 4x − 1 step 2 — group like terms (3x²−x²) + (2x−4x) + (5−1) step 3 — combine each group 2x² − 2x + 4 subtraction is addition of the negated polynomial
Fig. 2 — flip every sign in the second polynomial first, then group and combine exactly like addition.
Subtraction

(3x2+2x+5)−(x2+4x+1)=2x2−2x+4(3x^2 + 2x + 5) - (x^2 + 4x + 1) = 2x^2 - 2x + 4

Multiplying polynomials

Multiplying two polynomials means every term in the first one multiplies every term in the second — then the products get combined.

multiplying polynomials (x + 2)(x + 3) x × x x² x × 3 3x 2 × x 2x 2 × 3 6 x² + 3x + 2x + 6 = x² + 5x + 6
Fig. 3 — every term in (x + 2) multiplied against every term in (x + 3), then summed.
Multiplication

(x+2)(x+3)=x2+3x+2x+6=x2+5x+6(x + 2)(x + 3) = x^2 + 3x + 2x + 6 = x^2 + 5x + 6

Doing this over a finite field

This is where the finite-fields lesson connects back in. In a ZK system, every coefficient lives inside GF(p)GF(p) — so after multiplying, every coefficient gets reduced mod pp, same as it would for a plain number.

multiplying over GF(7) (x + 5)(x + 4), coefficients mod 7 expand normally x² + 4x + 5x + 20 combine like terms x² + 9x + 20 reduce coefficients mod 7 x² + 2x + 6
Fig. 4 — the same multiplication process, finished off with one extra step: reduce every coefficient mod 7.
Multiplication over GF(7)

(x+5)(x+4)≡x2+2x+6(mod7)(x + 5)(x + 4) \equiv x^2 + 2x + 6 \pmod{7}

9 mod 7=29 \bmod 7 = 2 and 20 mod 7=620 \bmod 7 = 6 — every coefficient wraps around exactly like it did two lessons back, just attached to a power of xx instead of standing alone.

Dividing polynomials

Division is the trickiest of the four, but it runs on the same long-division process as plain numbers: divide the leading terms, multiply back, subtract, and repeat.

dividing polynomials (x² − 5x + 6) ÷ (x − 2) step 1 — divide leading terms x² ÷ x = x step 2 — multiply back x(x−2) = x² − 2x step 3 — subtract (x²−5x+6) − (x²−2x) = −3x+6 step 4 — repeat: −3x ÷ x = −3 −3(x−2) = −3x+6 step 5 — subtract again (−3x+6) − (−3x+6) = 0 quotient is x − 3, remainder is 0
Fig. 5 — long division of x² - 5x + 6 by x - 2, the same polynomial whose roots got checked by hand last lesson.
Division

(x2−5x+6)÷(x−2)=x−3,remainder 0(x^2 - 5x + 6) \div (x - 2) = x - 3, \quad \text{remainder } 0

A remainder of 00 isn’t a coincidence here — x−2x - 2 divides in cleanly because 22 is one of this polynomial’s roots, found the same way back in the previous lesson.

Why division matters for ZK

That connection between roots and clean division is the entire reason this operation matters so much for ZK systems.

p(x) ÷ (x − root) → remainder 0 if and only if the root really is a root zero remainder = valid computation this exact check is how QAP verifies a ZK witness
Fig. 6 — dividing by (x - root) leaves no remainder exactly when that value really is a root.

p(x)÷(x−root)p(x) \div (x - \text{root}) leaves a remainder of 00 if and only if that value really is a root of p(x)p(x) — a zero remainder means a valid computation, a nonzero one means it isn’t. This exact check is how a QAP verifies a ZK witness: not by recomputing everything, just by confirming one polynomial division comes out clean.