Numerical Methods -- Interpolation -- Module 2


Index

  1. Interpolation and it's methods.
  2. 1. Newton's Forward and Backward interpolation methods.
  3. The Newton forward interpolation polynomial is written as
  4. The Newton backward interpolation polynomial is given by
  5. The Lagrange Interpolation Formula
  6. 3. Newton's Divided Difference interpolation

Interpolation and it's methods.

In numerical analysis, interpolation is a method of estimating values within a range of known data points, essentially finding new data points based on the values of a function at a limited number of points.

Methods of Interpolation

Depending on the interval between the data points, there are different interpolation methods.

Equal Intervals

1. Newton's Forward and Backward interpolation methods.

Let's try to understand these methods with an example.

https://www.youtube.com/watch?v=Aw6LvaPtESE&list=PLU6SqdYcYsfLrTna7UuaVfGZYkNo0cpVC&index=5

Pasted image 20250401114926.png

So we have these values given for a 10 year interval.

We will start by tabulating these values.

We set the intervals to x and it's values list to f(x).

x f(x)
1891 46
1901 66
1911 81
1921 93
1931 101

The gaps between the cells are intentional, as you will see below.

Now we set the next column to Δ f(x) and the next to Δ2 f(x) and the next to Δ3 f(x) and so on....

x f(x) Δ f(x) Δ2 f(x) Δ3 f(x) Δ4 f(x)
1891 46
20
1901 66
15
1911 81
12
1921 93
8
1931 101

Now we find the value of Δ f(x) by taking the difference of the values of f(x).

So between 1891 and 1901 the value will be given by 6646=20

Then between 1901 and 1911 it will be 8166=15

And between 1921 and 1911 it will be 9381=12

And between 1921 and 1931 it will be 10193=8

Now we will populate the values of the other columns similarly

x f(x) Δ f(x) Δ2 f(x) Δ3 f(x) Δ4 f(x)
1891 46
20
1901 66 -5
15 2
1911 81 -3 -3
12 -1
1921 93 -4
8
1931 101

This can keep going on as long as we would like but it's better to stop at Δ4f(x) for now.

Now there are two formulae for Newton's Interpolation


The Newton forward interpolation polynomial is written as:

P(x)=f(x0)+pΔf(x0)+p(p1)2!Δ2f(x0)+p(p1)(p2)3!Δ3f(x0) + 

where - Step Size (h):

And :

The Newton backward interpolation polynomial is given by:

P(x)=f(xn)+pf(xn)+p(p+1)2!2f(xn)+p(p+1)(p+2)3!3f(xn)+

Parameter p:


Which one to use and when?

That will depend on the given question.

Pasted image 20250401114926.png

We have been asked to estimate the population between 1895 to 1925

x f(x) Δ f(x) Δ2 f(x) Δ3 f(x) Δ4 f(x)
1891 46
20
1901 66 -5
15 2
1911 81 -3 -3
12 -1
1921 93 -4
8
1931 101

So in this case we need to use Newton's forward interpolation formula as our range lies between 1891 and 1901.

So we will be using this formula:

P(x)=f(x0)+pΔf(x0)+p(p1)2!Δ2f(x0)+p(p1)(p2)3!Δ3f(x0) + 

Here h is the step size which is the interval, which is 10 in our dataset.

Now we need to find p

Since we are using forward interpolation we use :

p=x  x0h

Here x is the first end of our required range, i.e 1895.

and x0 is the first entry in the table i.e 1891.

So p=1895189110 = 0.4

And for the first part of the formula we have f(x0) as 46 from the table.

So $$P(1895) = 46 + 0.4 \times 20 + \frac{0.4(0.4-1)}{2!} \times (-5) + \frac{0.4(0.4-1)(0.4-2)}{3!} \times 2$$

+0.4(0.41)(0.42)(0.43)4!×3=54.8528

Now for the population of 1925.

We refer to our table again.

x f(x) Δ f(x) Δ2 f(x) Δ3 f(x) Δ4 f(x)
1891 46
20
1901 66 -5
15 2
1911 81 -3 -3
12 -1
1921 93 -4
8
1931 101

We will use Newton's backward interpolation this time as the range lies towards the end of the table.

So $$p = \frac{1925-1931}{10} = -0.6$$
Therefore according to the Newton's Backward interpolation formula

P(x)=f(xn)+pf(xn)+p(p+1)2!2f(xn)+p(p+1)(p+2)3!3f(xn)+P(1925)=101+(0.6)×8+0.6(0.6+1)2!×(4)+0.6(0.6+1)(0.6+2)3!×(1)+0.6(0.6+1)(0.6+2)(0.6+3)4!×3=1014.8+(0.6)(0.4)(4)2+(0.6)(0.4)(1.4)(1)6+(0.6)(0.4)(1.4)(3)24=96.2  0.48 + 0.0056+0.042=95.7676

or we can round to 96 to match with the video

96.8368

So we have the population in the years 1895 and 1925 as 54.8528 and 96.8368 accordingly.


Let's try out another example

Pasted image 20250402182238.png

Note that instead of fixed values we have been given ranges for x, that represent cumulative frequencies.

So we will construct the table in this way.

Ways (x) Frequency (f(x)) Δf(x) Δ2f(x) Δ3f(x)
Below 10 9
39 - 9 = 30
Below 20 30 + 9 = 39 35 - 30 = 5
74 - 39 = 35 7-5 = 2
Below 30 39 + 35 = 74 42 - 35 = 7
116 - 74 = 42
Below 40 74 + 42 = 116

The reason we added up the values in f(x) was because of the fact that x is given to use as intervals, so the values of f(x) overlap with that of the previous intervals.

And after that it's just like before, we find the difference to fill up the rest of the columns

Now since we have an interval of 10, so h=10

And we are asked to find f(15). Why?

The table represents the cumulative frequency up to wage (not the wage itself) x. So f(10)=9 means there are 9 men with wages below 10 rupees, f(20)=39 means there are 39 men with wages below 20 rupees, and so on.

So if we want to find the number of men getting between wages rupees 10 and 15, we need a number greater than f(10) and less than f(20) .

So f(15) is the best fit here.

So our x0 will be 10 instead of 0

So we will use Newton's Forward Interpolation formula here

P(x)=f(x0)+pΔf(x0)+p(p1)2!Δ2f(x0)+p(p1)(p2)3!Δ3f(x0) + 

So p=151010 = 0.5

Now it's just plain old calculation.

Solving that we should get

P(15) 24

Now this is not the final answer yet as we need to find the number of men getting wages between rupees 10 and 15, and since we are given the cumulative frequency and not fixed values, we need to do :

F(15)  F(10)

to effectively find the number of men getting wages between rupees 15 and 10.

So that will be 249=15


Unequal Intervals

2. Lagrange's Interpolation for Unequal intervals

Lagrange’s Interpolation is a versatile polynomial interpolation method that works well even when the data points are not equally spaced. Unlike Newton's formulas, it does not require the data to have equal intervals, and it directly constructs the polynomial that exactly fits the given points

The Lagrange Interpolation Formula

Given a set of n+1 data points:

(x0,y0), (x1,y1), , (xn,yn),

the Lagrange interpolation polynomial P(x) is given by:

P(x)=j=0nyjLj(x)

where the Lagrange basis polynomial Lj(x) is defined as:

Lj(x)=i=0ijnxxixjxi

Key Points:


Looks quite complicated no? Let's solve this using an example then.

https://www.youtube.com/watch?v=zdyUwzOm1zw&list=PLU6SqdYcYsfLrTna7UuaVfGZYkNo0cpVC&index=4

The first example of this video deals with Lagrange's Interpolation however the second version deals with Newton's divided interpolation.

So first off we start with this table

Pasted image 20250402122834.png

For creating the Lagrange basis polynomial we follow a trick:

So we create pairs first :

(x0,y0)=(5,12)(x1,y1)=(6,13)(x2,y2)=(9,14)(x3,y3)=(11,16)

So we first "hide" the first x0. And make the first Lagrange polynomial as:

L0=(x6)(x9)(x11)

And now we put the "hidden" number in place of x in the denominator as:

L0=(x6)(x9)(x11)(56)(59)(511))

Then we multiply it times it's y component, in this case y0 which is 12.

L0=((x6)(x9)(x11)(56)(59)(511))) ×12

Similarly we construct the other Lagrange polynomials as well :

We hide x1 or 6

L1=((x5)(x9)(x11))(65)(69)(611)) ×13

And for L2

L2=((x5)(x6)(x11)(95)(96)(911)) ×14

And for L3

L3=((x5)(x6)(x9)(115)(116)(119)) ×16

Now we solve them and add the polynomials

L0+L1+L2+L3=(x6)(x9)(x11)(1)(4)(6) ×12 + (x5)(x9)(x11)(1)(3)(5) ×13+ (x5)(x6)(x11)(4)(3)(2) ×14 + (x5)(x6)(x9)(6)(5)(2) ×16

Now, for x=10

=424 ×12 + 515 ×13 + 2024 ×14 + 2060 ×16=126 + (13)(3) + 706 + 163=2  133 + 353 + 163=2  133 + 51321 + 383 = 6+383 = 443

Final Answer

y(10)  14.666666667

Let's try another example

Pasted image 20250402132848.png

Let's create the pairings of the data first.

(x0,y0)=(1,8)(x1,y1)=(0,3)(x2,y2)=(2,1)(x3,y3)=(3,2)

So, $$L_0 \ = \ \frac{(x-0)(x-2)(x-3)}{(-1-0)(-1-2)(-1-3)} \ \times -8 \ = \ \frac{2(x-0)(x-2)(x-3)}{3}$$

L1 = (x+1)(x2)(x3)(0+1)(02)(03) ×3 = (x+1)(x2)(x3)2L2 = (x+1)(x0)(x3)(2+1)(20)(23) ×1 = (x+1)(x0)(x3)(6)L3 = (x+1)(x0)(x2)(3+1)(30)(32) ×2 = (x+1)(x0)(x2)6

For y(2) :

 2(20)(22)(23)3 + (2+1)(22)(23)2 + (2+1)(20)(23)6+ (2+1)(20)(22)6= (4)(4)(5)3 + (1)(4)(5)2 + (1)(2)(5)6+ (1)(2)(4)6= 803  202 + 106 + 86=803  101 + 53 + 43 = 101 + 793 = 30793 = 1093  36.333

Now in a similar manner, we can find the values of y(1) and y(4) as:

Pasted image 20250402145929.png


3. Newton's Divided Difference interpolation

Newton’s Divided Difference formula is used to find a polynomial that passes through a given set of points:

(x0,y0),(x1,y1),(x2,y2),...,(xn,yn)

It builds the interpolating polynomial in a way that doesn’t require equally spaced x-values — unlike Newton’s Forward/Backward Difference, which assumes the x-values are evenly spaced.

Building the difference table.

Unlike Newton's forward and backward interpolation which use the same difference table, the divided difference has a different type of table.

The process uses a table, and it’s all about recursive differences.
For each pair of values, you compute:

First-order divided difference:

f[x_0, x_1] = \frac{f(x_1) - f(x_0)}{x_1 - x_0}$$​ #### Second-order divided difference: $$f[x_0, x_1, x_2] = \frac{f[x_1, x_2] - f[x_0, x_1]}{x_2 - x_0}$$​ #### Third-order divided difference: $$f[x_0, x_1, x_2, x_3] = \frac{f[x_1, x_2, x_3] - f[x_0, x_1, x_2]}{x_3 - x_0}$$​ ...and so on. --- ### **The Final Polynomial:** Once you’ve got the divided differences, the interpolating polynomial looks like this: $$P(x) = f(x_0) + (x - x_0) \ \Delta f(x_0) + (x - x_0)(x - x_1) \ \Delta^2 \ f(x_0) + \ldots

Each new term:


💡 Why is it Efficient?


Example 1.

https://www.youtube.com/watch?v=zdyUwzOm1zw&list=PLU6SqdYcYsfLrTna7UuaVfGZYkNo0cpVC&index=4

Pasted image 20250413130121.png

So we have the first example from the Lagrange's Interpolation problem.

Let's start with building the table :

x f(x) Δf(x) Δ2f(x) Δ3f(x)
5 12
131265 = 1
6 13 13195 = 16
141396 = 13 120
9 14 1  13116 = 215
1614119 = 1
11 16

Now we can simply apply the values from the table in the formula as

P(x) = 12 + (x5)(1) + (x5)(x6)(16) + (x5)(x6)(x9)(120)

Now, for x =10

 P(10) = 12 + (10  5)(1) + (10  5)(10  6)(16) + (10  5)(10  6)(10  9)(120)P(10) = 12 + 5  103 + 1P(10) = 18  103P(10)  14.667

So we get the same answer using Newton's divided difference method as well.