Reducing the number of equality checks (constraints) through random linear combinations

Random linear combinations are a common trick in zero knowledge proof algorithms to enable mm equality checks to be probabilistically checked with a single equality check. Suppose we have mm inner products we are trying to prove. Instead of creating mm proofs, we create a random linear combination of the equalities and prove that.

Equality of Pedersen Commitments

First, let’s consider how we might prove the equality of multiple Pedersen commitments.

If we have elliptic curve points GG and BB with unknown discrete logs, and blinding terms α\alpha and β\beta we can construct Pedersen committments LL and RR where

L=aG+αBL = aG + \alpha B
R=bG+βBR = bG + \beta B

The verifier can check if a=ba = b if the prover provides the difference in the blinding terms. The verifier cannot simply check L=RL = R because the blinding terms will generally not be equal to each other, i.e. αβ\alpha \neq \beta.

If the prover wishes to convince the verifier that aa and bb are committed to LL and RR respectively, but without revealing aa and bb, the prover can compute

π=αβ\pi = \alpha - \beta

And give π\pi to the verifier. The verifier computes

L=?R+πBL \stackrel{?}{=} R + \pi B

Under the hood, this expands to

(aG+αB)=(bG+βB)+(αβ)B(aG + \alpha B) = (bG + \beta B) + (\alpha - \beta) B

All the blinding terms will cancel out leaving aG=?bGaG \stackrel{?}{=} bG.

But suppose the prover wishes to establish equality for several commitments, i.e. L1=L2,L2=R2,...,Lm=RmL_1 = L_2, L_2 = R_2, ..., L_m = R_m. The naïve solution is to send mm blinding terms π1,...,πm\pi_1,...,\pi_m and the verifier will run mm equality checks. This will require sending mm field elements (π1,...,πm\pi_1,...,\pi_m) and the verifier’s algorithm will run in O(m)\mathcal{O}(m) time.

Why the prover cannot simply add up all the commitments

Suppose we have l1,l2,r1,r2l_1, l_2, r_1, r_2 with commitments L1,L2,R1,R2L_1, L_2, R_1, R_2 respectively. Suppose also the prover wants to show that l1=r1l_1 = r_1 and l2=r2l_2 = r_2 without revealing them.

The following check is not secure:

L1+L2=R1+R2+πBL_1 + L_2 = R_1 + R_2 + \pi B

where π\pi is the difference in the blinding terms. As a counterexample, consider the case where l1=1,r1=2,l2=2,r2=1l_1 = 1, r_1 = 2, l_2 = 2, r_2 = 1. The sums are balanced, but the original claim is incorrect.

Random linear combinations

However, if the prover is required to show that

L1+L2z=R1+R2z+πBL_1 + L_2z = R_1 + R_2z + \pi B

for a random value zz they cannot predict, then the scheme is secure.

Specifically, the prover and verifier do the following algorithm:

Randomized proof of equality

Setup

The prover and verifier agree on elliptic curve points GG and BB, where the discrete logs are unknown.

Prover sends commitments

The prover generates blinding terms α1,α2,β1,β2\alpha_1, \alpha_2, \beta_1, \beta_2 and creates the Pedersen commitments

L1=l1G+α1BL_1 = l_{1}G + \alpha_1 B
R1=r1G+β1BR_1 = r_{1}G + \beta_1 B
L2=l2G+α2BL_2 = l_{2}G + \alpha_2 B
R2=r2G+β2BR_2 = r_{2}G + \beta_2 B

and sends (L1,L2,R1,R2)(L_1, L_2, R_1, R_2) to the verifier.

Verifier picks a random zz

The verifier chooses a random field element zz and sends it to the prover.

Prover computes the difference in blinding terms

The prover computes π=α1+α2zβ1β2z\pi = \alpha_1+\alpha_2\cdot z-\beta_1-\beta_2\cdot z and sends π\pi to the verifier.

Final verification check

The verifier checks that

L1+L2z=?R1+R2z+πBL_1+L_2z\stackrel{?}=R_1+R_2z+\pi B

Security analysis

If l1=r1l_1 = r_1 and l2=r2l_2 = r_2 then the equation will be balanced regardless of the choice of zz, assuming the prover computed π\pi correctly.

Now suppose l1r1l_1\neq r_1 or l2r2l_2 \neq r_2. The prover still will not be able to produce a valid π\pi because doing so would require solving for the discrete logs of GG and BB.

Generalizing to mm checks

If we have mm equality checks, L1=R1,L2=R2,...,Lm=RmL_1 = R_1, L_2 = R_2, ..., L_m = R_m, the verifier could send mm random elements z1,,zmz_1,\dots,z_m and the prover could provide π\pi such that

L1+L2z1+L3z2+...Lmzm1=?R1+R2z1+R3z2++Rmzm1+πBL_1 + L_2z_1 + L_3z_2 + ... L_mz_{m-1} \stackrel{?}{=}R_1 + R_2z_1+R_3z_2+\dots+R_mz_{m-1} + \pi B

However, this requires the verifier to send mm elements, leading to a linear communication overhead. The communication overhead can be reduced to constant if the verifier only sends zz and the prover and verifier separate the commitments by successive powers of zz:

L1+L2z+L3z2+...Lmzm1=?R1+R2z+R3z2+Rmzm1+πBL_1 + L_2z + L_3z^2 + ... L_mz^{m-1} \stackrel{?}{=}R_1+R_2z+R_3z^2\dots+R_mz^{m-1} + \pi B

Security analysis

The left-hand-side and right-hand-side are both polynomials of degree m1m-1. If they are unequal to each other, then they intersect in at most m1m-1 points by the Schwartz Zippel Lemma. If mpm\ll p where pp is the order of the finite field, then again the probability of zz being an intersection point is negligible.

Random linear combinations of inner products

We can generalize the above technique to combine multiple inner products together.

Suppose we have two inner products

aL,aR=v1\langle \mathbf{a}_L, \mathbf{a}_R\rangle = v_1 and aL,aW=v2\langle \mathbf{a}_L, \mathbf{a}_W\rangle=v_2

Because the two inner products share a common term, it is algebraically possible to combine them as follows:

aL,aR+aW=v1+v2\langle\mathbf{a}_L, \mathbf{a}_R + \mathbf{a}_W\rangle = v_1 + v_2

However, this is not secure from a soundness perspective because it is possible that aL,aRv1\langle \mathbf{a}_L, \mathbf{a}_R\rangle \neq v_1 and aL,aWv2\langle \mathbf{a}_L, \mathbf{a}_W\rangle\neq v_2 but aL,aR+aW=v1+v2\langle\mathbf{a}_L, \mathbf{a}_R + \mathbf{a}_W\rangle = v_1 + v_2.

As expected, we can solve this by using a random linear combination.

aL,aR=v1 // first inner productzaL,aW=zv2 // second inner productaL,zaW=zv2 // bring z insideaL,aR+zaW=v1+zv2 // combine into one inner product\begin{align*} &\langle \mathbf{a}_L, \mathbf{a}_R\rangle = v_1 &&\text{ // first inner product}\\ &z\langle \mathbf{a}_L, \mathbf{a}_W\rangle=z\cdot v_2 &&\text{ // second inner product}\\ &\langle \mathbf{a}_L, z\cdot\mathbf{a}_W\rangle=z\cdot v_2 &&\text{ // bring } z \text{ inside}\\ &\langle\mathbf{a}_L, \mathbf{a}_R + z\cdot\mathbf{a}_W\rangle = v_1 + z\cdot v_2&&\text{ // combine into one inner product} \end{align*}

We only need to create an inner product proof for a single inner product instead of two. It is crucial that the prover receives zz after they have sent the relevant commitments, but we leave the exact details for the next chapter when we see an example of an algorithm using this technique: range proofs.

This tutorial is part of a series on ZK Bulletproofs.

Ready to Get Started?Join Thousands of Users Today

Start your free trial now and experience the difference. No credit card required.

© 2025 Better-Start. All rights reserved.