
The R1CS & QAP Blueprint for zk-SNARKs | From Zero to Deku
This beginner friendly article is an extended version of Vitalik’s article on Quadratic Arithmetic Programs. We will provide a deeper technical dive on how to transition from a Problem to R1CS and from R1CS to QAP. As mentioned by Vitalik, “zk-SNARKs cannot be applied to any computational problem directly; rather, you have to convert the problem into the right “form” for the problem to operate on. The form is called a “quadratic arithmetic program” (QAP)”Along with the process for converting ...

SumCheck Protocol | A Love Story between a Prover and a Verifier
IntroductionHow can a Prover convince a Verifier that he can accurately compute the sum of the evaluation of a function $$g$$ over all possible inputs $${ 0,1 }$$ ? Let's say the Prover has a function $$g$$ that takes several binary variables, $$b_1,b_2,…,b_l$$, where each variable can only be either $$0$$ or $$1$$. The goal is for the Prover to convince the Verifier that he can compute the sum of the function $$g$$ evaluated on all possible combinations of these binary inputs correctly ...

Multilinear Extensions Part I | ZKP
Let’s be real—there’s nothing worse than gridding through a long-ass article only to realize you’ve spent 20 minutes getting to the good part. So, here’s the deal: before we dive in, we’re giving you the why. Why are multilinear extensions a big deal in the world of ZKPs? Because trust me, they are. This article cuts through the noise and gives you everything you need to understand them—without endlessly searching the internet or looping through videos (like I did). I’ve got you covered. Read...
Blockchain Developer | Security Researcher | ZKP | AI/ML | Econ Building The Next Generation of Stablecoins

The R1CS & QAP Blueprint for zk-SNARKs | From Zero to Deku
This beginner friendly article is an extended version of Vitalik’s article on Quadratic Arithmetic Programs. We will provide a deeper technical dive on how to transition from a Problem to R1CS and from R1CS to QAP. As mentioned by Vitalik, “zk-SNARKs cannot be applied to any computational problem directly; rather, you have to convert the problem into the right “form” for the problem to operate on. The form is called a “quadratic arithmetic program” (QAP)”Along with the process for converting ...

SumCheck Protocol | A Love Story between a Prover and a Verifier
IntroductionHow can a Prover convince a Verifier that he can accurately compute the sum of the evaluation of a function $$g$$ over all possible inputs $${ 0,1 }$$ ? Let's say the Prover has a function $$g$$ that takes several binary variables, $$b_1,b_2,…,b_l$$, where each variable can only be either $$0$$ or $$1$$. The goal is for the Prover to convince the Verifier that he can compute the sum of the function $$g$$ evaluated on all possible combinations of these binary inputs correctly ...

Multilinear Extensions Part I | ZKP
Let’s be real—there’s nothing worse than gridding through a long-ass article only to realize you’ve spent 20 minutes getting to the good part. So, here’s the deal: before we dive in, we’re giving you the why. Why are multilinear extensions a big deal in the world of ZKPs? Because trust me, they are. This article cuts through the noise and gives you everything you need to understand them—without endlessly searching the internet or looping through videos (like I did). I’ve got you covered. Read...
Blockchain Developer | Security Researcher | ZKP | AI/ML | Econ Building The Next Generation of Stablecoins

Subscribe to FarFromAverage

Subscribe to FarFromAverage
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers


If you’re familiar with the Lagrange interpolation, you may know that it is used to construct the interpolation polynomial for a set of points in one dimension and if you’re not, no worries you can just watch these two videos (Video 1, Video 2) before proceeding. Our main focus today is using Lagrange interpolation in multilinear extensions. Don’t be overwhelmed by the upcoming formulas, you only need to understand what they do. We will provide you with a much simpler formula to use when dealing with MLEs at the end of the article, after understanding everything.
The formulation of the multilinear extension can be thought of as a multi-dimensional extension of the Lagrange interpolation formula. The idea is to maintain the properties of the function at the vertices while allowing for interpolation within the entire hypercube.
Given as input all evaluations of a function , for any point there is an -time algorithm for evaluating .
Multilinear Extension Formula:
where is the Multilinear Lagrange basis Polynomial corresponding to :
$$\tilde{\delta}w(r) = \Pi{i=1}^l(r_iw_i + (1-r_i)(1-w_i))$$
The formula is part of a multilinear extension (MLE), which allows us to extend a function defined on binary inputs to work with real inputs between 0 and 1.
It works by multiplying together simple terms that either "pick" or depending on whether the binary value is 1 or 0. This product ensures a smooth transition between the values at each binary point. Essentially, it blends between these binary points based on the real values of , allowing us to interpolate the function over continuous inputs.
If you still don’t understand how it works, no worries you don’t need to. Just keep going and you’ll get a much simpler formula that you can use easily at the end.
Basis Structure: , can be seen as a generalization of Lagrange basis polynomials. They ensure that at each vertex , the extension matches the value of , similar to how Lagrange interpolation ensures the polynomial passes through each point.
A Boolean hypercube is a geometric representation of all possible binary values in n-dimensional space. Each vertex of the hypercube corresponds to an n-length binary string, and there are n vertices in total, representing all possible combinations of 0 and 1.
For example:
In a 1-dimensional Boolean hypercube, you have 2 vertices: and , which is just a line.
In a 2-dimensional Boolean hypercube, you have 4 vertices: , forming a square.
In a 3-dimensional Boolean hypercube, you have 8 vertices: forming a cube.
In ZKPs, you often need to work with functions that are defined over binary inputs. For instance, a function might be defined on inputs of length that are either 0 or 1, meaning is naturally defined on the vertices of a Boolean hypercube of dimension . So a Boolean Hypercube is another way of describing our multivariate function.
Building the Formula
Choose the points for interpolation: For bilinear interpolation in two dimensions, you generally have four points:
Each equals 1 at vertex and 0 at the other vertices meaning:
is 1 when $$𝑥1 = x{v_0}𝑥2 = y{v_0}𝑥
Final Formula (Simplified):
You only need to understand this formula when dealing with MLEs without going through all of the math behind it.
So the Final Formula is basically this formula but written in a more elegant way.
We define a bivariate function over the domain :

The MLE of the bivariate function will look like this:
which we can simplify it to:
Notice that each of the four terms on the right hand side of the equation ensures that the MLE evaluates equally to our predefined values for the bivariate function:
So our MLE looks like this:

By replacing and in by the indexes (4,5) we will get 54 which is the most bottom right cell.
Both of these formulas represent multilinear extensions (MLE) of a Boolean function defined on binary points like to a continuous domain.
The first formula is the general case for an -dimensional Boolean function, where you're summing over all possible binary vectors .
The second formula is the specific bivariate (2-dimensional) case, where , and you're interpolating between the four possible binary inputs as we saw in the previous example.
This is all you need to know about Multi-dimensional Lagrange Interpolation for Multilinear extensions. Hope this article was helpful. The next article will be a full guide on the sumcheck protocol. We’ll be applying everything we’ve learned so far.
If you’re familiar with the Lagrange interpolation, you may know that it is used to construct the interpolation polynomial for a set of points in one dimension and if you’re not, no worries you can just watch these two videos (Video 1, Video 2) before proceeding. Our main focus today is using Lagrange interpolation in multilinear extensions. Don’t be overwhelmed by the upcoming formulas, you only need to understand what they do. We will provide you with a much simpler formula to use when dealing with MLEs at the end of the article, after understanding everything.
The formulation of the multilinear extension can be thought of as a multi-dimensional extension of the Lagrange interpolation formula. The idea is to maintain the properties of the function at the vertices while allowing for interpolation within the entire hypercube.
Given as input all evaluations of a function , for any point there is an -time algorithm for evaluating .
Multilinear Extension Formula:
where is the Multilinear Lagrange basis Polynomial corresponding to :
$$\tilde{\delta}w(r) = \Pi{i=1}^l(r_iw_i + (1-r_i)(1-w_i))$$
The formula is part of a multilinear extension (MLE), which allows us to extend a function defined on binary inputs to work with real inputs between 0 and 1.
It works by multiplying together simple terms that either "pick" or depending on whether the binary value is 1 or 0. This product ensures a smooth transition between the values at each binary point. Essentially, it blends between these binary points based on the real values of , allowing us to interpolate the function over continuous inputs.
If you still don’t understand how it works, no worries you don’t need to. Just keep going and you’ll get a much simpler formula that you can use easily at the end.
Basis Structure: , can be seen as a generalization of Lagrange basis polynomials. They ensure that at each vertex , the extension matches the value of , similar to how Lagrange interpolation ensures the polynomial passes through each point.
A Boolean hypercube is a geometric representation of all possible binary values in n-dimensional space. Each vertex of the hypercube corresponds to an n-length binary string, and there are n vertices in total, representing all possible combinations of 0 and 1.
For example:
In a 1-dimensional Boolean hypercube, you have 2 vertices: and , which is just a line.
In a 2-dimensional Boolean hypercube, you have 4 vertices: , forming a square.
In a 3-dimensional Boolean hypercube, you have 8 vertices: forming a cube.
In ZKPs, you often need to work with functions that are defined over binary inputs. For instance, a function might be defined on inputs of length that are either 0 or 1, meaning is naturally defined on the vertices of a Boolean hypercube of dimension . So a Boolean Hypercube is another way of describing our multivariate function.
Building the Formula
Choose the points for interpolation: For bilinear interpolation in two dimensions, you generally have four points:
Each equals 1 at vertex and 0 at the other vertices meaning:
is 1 when $$𝑥1 = x{v_0}𝑥2 = y{v_0}𝑥
Final Formula (Simplified):
You only need to understand this formula when dealing with MLEs without going through all of the math behind it.
So the Final Formula is basically this formula but written in a more elegant way.
We define a bivariate function over the domain :

The MLE of the bivariate function will look like this:
which we can simplify it to:
Notice that each of the four terms on the right hand side of the equation ensures that the MLE evaluates equally to our predefined values for the bivariate function:
So our MLE looks like this:

By replacing and in by the indexes (4,5) we will get 54 which is the most bottom right cell.
Both of these formulas represent multilinear extensions (MLE) of a Boolean function defined on binary points like to a continuous domain.
The first formula is the general case for an -dimensional Boolean function, where you're summing over all possible binary vectors .
The second formula is the specific bivariate (2-dimensional) case, where , and you're interpolating between the four possible binary inputs as we saw in the previous example.
This is all you need to know about Multi-dimensional Lagrange Interpolation for Multilinear extensions. Hope this article was helpful. The next article will be a full guide on the sumcheck protocol. We’ll be applying everything we’ve learned so far.
Generalization: The multilinear extension extends the concept of interpolation from one dimension to multiple dimensions. The basis polynomials in both cases are structured to ensure that the extended function preserves the behavior of the original function at specified points (the vertices).
000---------001
/ | / |
/ | / | 3-Dimensional Boolean Hypercube:
010--------011 | {000,001,010,011,100,101,110,111}
| | | |
| 100------|-101
| / | /
| / | /
110--------111
$$v_1 = ( 𝑥_{𝑣 1} , 𝑦{𝑣 _1})$$
$$v_2 = ( 𝑥_{𝑣 2} , 𝑦{𝑣 _2})$$
$$v_3 = ( 𝑥_{𝑣3} , 𝑦{𝑣 _3})$$
Lagrange Basis Functions:
To construct the MLE, we first need to define the Lagrange basis functions. These functions will ensure that the MLE passes through the vertex values of .
The Lagrange basis functions for the vertices , and are:
is 1 when $$𝑥1 = x{v_1}𝑥2 = y{v_0}𝑥1 = x{v_0}𝑥2 = y{v_1}$$
is 1 when $$𝑥1 = x{v_0}𝑥2 = y{v_1}𝑥1 = x{v_1}𝑥2 = y{v_0}$$
is 1 when $$𝑥1 = x{v_1}𝑥2 = y{v_1}𝑥1 = x{v_0}𝑥2 = y{v_0}$$
Formulating the Multilinear Extension:
Now, we can express the multilinear extension using the function values at the vertices and the Lagrange basis functions:
Generalization: The multilinear extension extends the concept of interpolation from one dimension to multiple dimensions. The basis polynomials in both cases are structured to ensure that the extended function preserves the behavior of the original function at specified points (the vertices).
000---------001
/ | / |
/ | / | 3-Dimensional Boolean Hypercube:
010--------011 | {000,001,010,011,100,101,110,111}
| | | |
| 100------|-101
| / | /
| / | /
110--------111
$$v_1 = ( 𝑥_{𝑣 1} , 𝑦{𝑣 _1})$$
$$v_2 = ( 𝑥_{𝑣 2} , 𝑦{𝑣 _2})$$
$$v_3 = ( 𝑥_{𝑣3} , 𝑦{𝑣 _3})$$
Lagrange Basis Functions:
To construct the MLE, we first need to define the Lagrange basis functions. These functions will ensure that the MLE passes through the vertex values of .
The Lagrange basis functions for the vertices , and are:
is 1 when $$𝑥1 = x{v_1}𝑥2 = y{v_0}𝑥1 = x{v_0}𝑥2 = y{v_1}$$
is 1 when $$𝑥1 = x{v_0}𝑥2 = y{v_1}𝑥1 = x{v_1}𝑥2 = y{v_0}$$
is 1 when $$𝑥1 = x{v_1}𝑥2 = y{v_1}𝑥1 = x{v_0}𝑥2 = y{v_0}$$
Formulating the Multilinear Extension:
Now, we can express the multilinear extension using the function values at the vertices and the Lagrange basis functions:
No activity yet