s0ft said:
Yes, I don't understand how that expression comes.
More generally, Lagrange's method for a n- 1 polynomial interpolating n given data points, [itex](x_i, y_i)[/itex], requires calculating n terms
[tex]\frac{(x- x_1)(x- x_2)\cdot\cdot\cdot(x-x_{i-1})(x- x_{i+1}\cdot\cdot\cdot(x- x_{n-1})(x- x_n)}{x_i- x_1)(x_i- x_2)\cdot\cdot\cdot(x_i- x_{i- 1})(x_i- x_{i+1}\cdot\cdot\cdot(x_i- x_{n-1})(x- x_n)}y_i[/tex]
with i from 1 to n, and adding them.
Look closely at that fraction. The numerator has the variable "x" minus each [itex]x_j[/itex] except the ith one. The denominator then has that [itex]x_i[/itex] minus each of the other [itex]x_j[/itex]. For x equal to each [itex]x_j[/itex] except [itex]x_i[/itex] that fraction will be 0 because there will be a factor of 0 in the numerator. For [itex]x= x_i[/itex] that fraction will be 1 because each factor in the numerator has an identical factor in the denominator.
That means that at [itex]x= x_i[/itex] will will have [itex]y_i[/itex] times 1 and all other y values times 0.
In the three point example arildno gave,
[tex]\frac{(x- x_2)(x- x_3)}{(x_1- x_2)(x_1- x_3)}y_1+ \frac{(x- x_1)(x- x_3)}{(x_2- x_1)(x_2- x_3)}y_2+ \frac{(x- x_1)(x- x_2)}{(x_3- x_1)(x_3- x_2)}y_3[/tex]
when [itex]x= x_1[/itex], the second and third fractions are 0 because of the [itex]x_1- x_1[/itex] in the numerator while the first fraction is
[tex]\frac{x_1- x_2)(x_1- x_3)}{(x_1- x_2)(x_1- x_3)}y_1= y_1[/tex]
and similarly for [itex]x= x_2[/itex] and [itex]x= x_3[/itex].