# Lagrange Interpolation

## 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) \]## About the Applet

This applet was created using JavaScript and the P5 library. No other libraries/dependencies are required. If you are having trouble viewing the applet, be sure JavaScript is enabled in your browser. Click here for instructions. Internet Explorer is not recommended for this applet.This applet was last updated July 2019.