Examples of Lagrange Interpolation

Example No 1: Interpolate the value of the function corresponding to X  = 4 , using Lagrange’s Interpolation formula from the following set of data:

X

2

3

5

8

12

f\left( X \right)

10

15

25

40

60

 
Solution: Using formula of Lagrange Interpolation, we have

\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}

\begin{gathered} f\left( 4 \right) = \frac{{\left( {4 - 3} \right)\left( {4 - 5}  \right)\left( {4 - 8} \right)\left( {4 - 12} \right)}}{{\left( {2 - 3}  \right)\left( {2 - 5} \right)\left( {2 - 8} \right)\left( {2 - 12}  \right)}}\left( {10} \right) + \frac{{\left( {4 - 2} \right)\left( {4 - 5}  \right)\left( {4 - 8} \right)\left( {4 - 12} \right)}}{{\left( {3 - 2}  \right)\left( {3 - 5} \right)\left( {3 - 8} \right)\left( {3 - 12}  \right)}}\left( {15} \right) \\ \,\,\,\,\,\,\,\,\,\,\,\,\, + \frac{{\left( {4 - 2} \right)\left( {4 - 3}  \right)\left( {4 - 8} \right)\left( {4 - 12} \right)}}{{\left( {5 - 2} \right)\left(  {5 - 3} \right)\left( {5 - 8} \right)\left( {5 - 12} \right)}}\left( {25}  \right) + \frac{{\left( {4 - 2} \right)\left( {4 - 3} \right)\left( {4 - 5}  \right)\left( {4 - 12} \right)}}{{\left( {8 - 2} \right)\left( {8 - 3}  \right)\left( {8 - 5} \right)\left( {8 - 12} \right)}}\left( {40} \right) \\ \,\,\,\,\,\,\,\,\,\,\,\,\, + \frac{{\left( {4 - 2} \right)\left( {4 - 3}  \right)\left( {4 - 5} \right)\left( {4 - 8} \right)}}{{\left( {12 - 2}  \right)\left( {12 - 3} \right)\left( {12 - 5} \right)\left( {12 - 8}  \right)}}\left( {60} \right) \\ \end{gathered}


Now simplify the brackets terms and write them in brackets with their proper sign

\begin{gathered} f\left( 4 \right) = \frac{{\left( 1 \right)\left( { - 1} \right)\left( {  - 4} \right)\left( { - 8} \right)}}{{\left( { - 1} \right)\left( { - 3}  \right)\left( { - 6} \right)\left( { - 10} \right)}}\left( {10} \right) +  \frac{{\left( 2 \right)\left( { - 1} \right)\left( { - 4} \right)\left( { - 8}  \right)}}{{\left( 1 \right)\left( { - 2} \right)\left( { - 5} \right)\left( { -  9} \right)}}\left( {15} \right) + \frac{{\left( 2 \right)\left( 1 \right)\left(  { - 4} \right)\left( { - 8} \right)}}{{\left( 3 \right)\left( 2 \right)\left( {  - 3} \right)\left( { - 7} \right)}}\left( {25} \right) \\ \,\,\,\,\,\,\,\,\,\,\,\,\, + \frac{{\left( 2 \right)\left( 1 \right)\left(  { - 1} \right)\left( { - 8} \right)}}{{\left( 6 \right)\left( 5 \right)\left( 3  \right)\left( { - 4} \right)}}\left( {40} \right) + \frac{{\left( 2  \right)\left( 1 \right)\left( { - 1} \right)\left( { - 4} \right)}}{{\left(  {10} \right)\left( 9 \right)\left( 9 \right)\left( 4 \right)}}\left( {60}  \right) \\ \end{gathered}


Now, count the number of negative signs in the numerator and the denominator of each term. For example the 1st term contains seven negative signs while the 2nd term contains six negative signs, etc. If the number of negative signs in a term are even (i.e. 0, 2, 4, 6, … etc.), place a positive sign before that term in the next step. If the number of negative signs are odd (i.e. 1, 3, 5, 7, … etc.), place a negative sign before that term in the next step. Once the sign of each term is ascertained, forget the negative signs in each bracket, treating all of them as positive, simplify term by term, cancel the common factors occurring in the numerator and denominator, thus,

\begin{gathered} f\left( 4 \right)  = - \frac{{1 \times 1 \times 4 \times  8}}{{1 \times 3 \times 6 \times 10}}\left( {10} \right) + \frac{{2 \times 1  \times 4 \times 8}}{{1 \times 2 \times 5 \times 9}}\left( {15} \right) +  \frac{{2 \times 1 \times 4 \times 8}}{{3 \times 2 \times 3 \times 7}}\left(  {25} \right) \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, - \frac{{2 \times 1 \times 1 \times  8}}{{6 \times 5 \times 3 \times 4}}\left( {40} \right) + \frac{{2 \times 1  \times 1 \times 4}}{{10 \times 9 \times 7 \times 4}}\left( {60} \right) \\ \end{gathered}

 \begin{gathered} f\left( 4 \right)  = - \frac{{16}}{9} + \frac{{32}}{3} +  \frac{{800}}{{63}} - \frac{{16}}{9} + \frac{{12}}{{63}} \\ \,\,\,\,\,\,\,\,\,\,\,\,\, = \frac{{ - 112 + 672 + 800 - 112 +  12}}{{63}} = \frac{{1260}}{{63}} = 20 \\ \end{gathered}


Hence, the value of the function corresponding to X = 4  is 20.

Example No 2: The populations of Mississippi during three census period were as follows:

Year:

1951

1961

1971

Population (Million):

2.8

3.2

4.5

Interpolate the following population during 1966.

Solution: Using formula of Lagrange Interpolation, we have
a =  1951,\,\,\,\,\,\,\,b = 1961,\,\,\,\,\,\,\,c = 1971      X = 1966
If we proceed to interpolate with these values we might do some mistake in calculation, it is therefore advised that we should reduce these values by (1) subtracting some values as origin e.g., 1951, (2) if possible, dividing each subtracted value by the common factor. We may use either both techniques of reduction or only the 1st one. Thus subtraction 1951 as origin and dividing by the common factor 5, the new values are
    {a_1} =  0,\,\,\,\,\,\,\,\,\,\,{b_1} = 2,\,\,\,\,\,\,\,\,\,\,{c_1} = 4         {X_1}  = 3
Substituting these in the Lagrange’s Interpolation formula, we get

\begin{gathered} Pop\left( {1966}  \right) = \frac{{\left( {3 - 2} \right)\left( {3 - 4} \right)}}{{\left( {0 - 2}  \right)\left( {0 - 4} \right)}}\left( {2.8} \right) + \frac{{\left( {3 - 0}  \right)\left( {3 - 4} \right)}}{{\left( {2 - 0} \right)\left( {2 - 4}  \right)}}\left( {3.2} \right) + \frac{{\left( {3 - 0} \right)\left( {3 - 2}  \right)}}{{\left( {4 - 0} \right)\left( {4 - 2} \right)}}\left( {4.5} \right) \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, = \frac{{\left( 1  \right)\left( { - 1} \right)}}{{\left( { - 2} \right)\left( { - 4}  \right)}}\left( {2.8} \right) + \frac{{\left( 3 \right)\left( { - 1} \right)}}{{\left(  2 \right)\left( { - 2} \right)}}\left( {3.2} \right) + \frac{{\left( 3  \right)\left( 1 \right)}}{{\left( 4 \right)\left( 2 \right)}}\left( {4.5}  \right) \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, = - \frac{{2.8}}{8} + \frac{{9.6}}{4} +  \frac{{13.5}}{8} = \frac{{29.9}}{8} = 3.737 \\ \end{gathered}


Hence, the population of Mississippi during 1966 was about 3.74 million.