# Lagrange Interpolation Formula

Lagrange’s formula is applicable to problems where the independent variable occurs at equal and unequal intervals, but preferably this formula is applied in a situation where there are unequal intervals for the given independent series. The values of the independent variables $\left( X \right)$ are given as $a,b,c,d,…$   etc., and the corresponding values of the function (dependent variable) are $f\left( a \right),f\left( b \right),f\left( c \right),f\left( d \right),…$  etc. So the value of the function corresponding to a given value of $X = {X_o}$  is given by $f\left( {{X_o}} \right)$ which is calculated by the formula presented by Lagrange. Thus, if

 $X$ $f\left( X \right)$ $a$ $f\left( a \right)$ $b$ $f\left( b \right)$ $c$ $f\left( c \right)$ $d$ $f\left( d \right)$ $\vdots$ $\vdots$

then $f\left( {{X_o}} \right)$ is given as:

$\begin{gathered} f\left( {{X_o}} \right) = \frac{{\left( {{X_o} – a} \right)\left( {{X_o} – b} \right)\left( {{X_o} – c} \right) \cdots }}{{\left( {a – b} \right)\left( {a – c} \right)\left( {a – d} \right) \cdots }}f\left( a \right) \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, + \,\,\frac{{\left( {{X_o} – a} \right)\left( {{X_o} – c} \right)\left( {{X_o} – d} \right) \cdots }}{{\left( {b – b} \right)\left( {b – c} \right)\left( {b – d} \right) \cdots }}f\left( b \right) \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, + \,\,\frac{{\left( {{X_o} – a} \right)\left( {{X_o} – b} \right)\left( {{X_o} – d} \right) \cdots }}{{\left( {c – a} \right)\left( {c – b} \right)\left( {c – d} \right) \cdots }}f\left( c \right) \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, + \,\,\frac{{\left( {{X_o} – a} \right)\left( {{X_o} – b} \right)\left( {{X_o} – c} \right) \cdots }}{{\left( {d – a} \right)\left( {d – b} \right)\left( {d – c} \right) \cdots }}f\left( d \right) \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, + \,\,\, \cdots \,\,\,\,\, \cdots \,\,\,\,\, \cdots \,\,\,\,\, \cdots \,\,\,\,\,\, \cdots \,\,\,\,\,\, \cdots \,\,\,\,\,\, \cdots \,\,\,\,\,\, \cdots \\ \end{gathered}$

Although this formula looks somewhat lengthy, is in fact very easy to remember and write. The first thing to note is that successive terms are multiplied by $f\left( a \right),f\left( b \right),f\left( c \right),…$  etc. respectively, and hence there will be as many terms as the number of items in the data. Thus, for example, if we have four yearly observations on the production of rice we will only need to write four such terms.

The numerator in each term contain factors like $\left( {{X_o} – a} \right)\left( {{X_o} – b} \right)\left( {{X_o} – c} \right) \cdots$  etc. The point to note here is that the first term omits $\left( {{X_o} – a} \right)$ , the second term omits $\left( {{X_o} – b} \right)$, the third term omits $\left( {{X_o} – c} \right)$ and so on.

The denominator in each term contains different factors of the independent variable. In the first term the difference is taken from $a$, in the second term the difference is taken from $b$, in the third term the difference is taken from $c$ and so on.

When interpolating with this formula it is recommended that you do not look at the formula to write the values of $a,b,c,…$  and $f\left( a \right),f\left( b \right),f\left( c \right),…$ etc. but rather directly write down the values as if you are writing the formula with the given values. This is suggested because confusion arises while writing the values of $a,b,c$ etc. in the formula.