Lagrange interpolation is a way to pass a polynomial of degree N-1 through N points. In the applet below you can modify each of the points (by dragging it to the desired position) and the number of points by clicking at the number shown in the lower left corner of the applet.
As of 2018, Java plugins are not supported by any browsers (find out more). This Wolfram Demonstration, Cubic Spline Interpolation versus Interpolating Polynomial, shows an item of the same or similar topic, but is different from the original Java applet, named 'Lagrange'. The originally given instructions may no longer correspond precisely.
Note how dragging just one point affects the whole graph. Compare this to the behavior of the cubic spline.
Lagrange polynomials are the interpolating polynomials that equal zero in all given points, save one. Say, given points x1, x2, ..., xN, Lagrange's polynomial #k is the product
such that Pk(xk) = 1 and Pk(xj) = 0, for j different from k. There is a simpler way to write Lagrange polynomials. Let
|P(x) = ∏(x - xi),|
where product is taken over all possible indices i (1 ≤ i ≤ N). Define also
|P'k(x) = ∏'(x - xi),|
where the "prime" indicates the omission of one of the factors, viz., (x - xk). Using P'k Lagrange polynomials appear in a very compact form:
|Pk(x) = P'k(x) / P'k (xk).|
In terms of Lagrange's polynomials the polynomial interpolation through the points
|(1)||P(x) = y1P1(x) + y2P2(x) + ... + yNPN(x).|
You can observe Lagrange's polynomials by clicking on the number to the right of "Show polynomial #". If the number is 0, the starting function is a parabola instead.
(The form (1) of the interpolating polynomial, while correct, is quite inconvenient in several respects for numerical computations. Usually, another one that makes use of Newton's divided differences is implemented instead. This is the route taken by the applet above.)