Skip to main content

Lagrange basis in multiplicative subgroups

What's a lagrange base?

Li(x)=1L_i(x) = 1 if x=gix = g^i, 00 otherwise.

What's the formula?

Arkworks has the formula to construct a lagrange base:

Evaluate all Lagrange polynomials at τ\tau to get the lagrange coefficients. Define the following as

  • HH: The coset we are in, with generator gg and offset hh
  • mm: The size of the coset HH
  • ZHZ_H: The vanishing polynomial for HH. ZH(x)=i[m](xhgi)=xmhmZ_H(x) = \prod_{i \in [m]} (x - h \cdot g^i) = x^m - h^m
  • viv_i: A sequence of values, where v0=1mhm1v_0 = \frac{1}{m * h^{m-1}}, and vi+1=gviv_{i + 1} = g \cdot v_i

We then compute Li,H(τ)L_{i,H}(\tau) as Li,H(τ)=ZH(τ)viτhgiL_{i,H}(\tau) = Z_H(\tau) \cdot \frac{v_i}{\tau - h g^i}

However, if τ\tau in HH, both the numerator and denominator equal 0 when i corresponds to the value tau equals, and the coefficient is 0 everywhere else. We handle this case separately, and we can easily detect by checking if the vanishing poly is 0.

following this, for h=1h=1 we have:

  • L0(x)=ZH(x)m(x1)L_0(x) = \frac{Z_H(x)}{m(x-1)}
  • L1(x)=ZH(x)gm(xg)L_1(x) = \frac{Z_H(x)g}{m(x-g)}
  • L2(x)=ZH(x)g2m(xg2)L_2(x) = \frac{Z_H(x)g^2}{m(x-g^2)}
  • and so on

What's the logic here?

https://en.wikipedia.org/wiki/Lagrange_polynomial#Barycentric_form