# Lagrange Interpolation

Interpolating Polynomial
Graph
Points:

• Click and drag points to move them and change the polynomial
• Click and drag the grid to pan around the graph
• Click and scroll to zoom in/out
• Double click on grid to add a new point
• Double click existing point to remove

## Lagrange Interpolation

Lagrange interpolation is used to find a unique polynomial of least degree that best fits a set of distinct data points. To find the polynomial that passes through a set of $k+1$ data points $(x_0, y_0), (x_1, y_1), \ldots, (x_k, y_k)$ begin by finding the basis polynomials for each point. The scaled basis polynomial $L_i(x)$ corresponding to the point $(x_i,y_i)$ is given by $L_i(x) = y_i \frac{(x-x_0)}{(x_i-x_0)}\cdot\frac{(x-x_1)}{(x_i-x_1)}\cdots\frac{(x-x_{i-1})}{(x_i-x_{i-1})}\cdot\frac{(x-x_{i+1})}{(x_i-x_{i+1})}\cdots \frac{(x-x_k)}{(x_i-x_k)}$ Each basis polynomial will then have a root at each $x_j \neq x_i$, and will pass through the point $(x_i,y_i)$. The final interpolating polynomial $f(x)$ that passes through all data points is the sum of these basis polynomials: $f(x) = L_0(x) + L_1(x) + \cdots + L_k(x)$