GeeksforGeeks App
Open App
Browser
Continue

# Lagrange Interpolation Formula

Lagrange Interpolation Formula finds a polynomial called Lagrange Polynomial that takes on certain values at an arbitrary point. It is an nth degree polynomial expression to the function f(x). The interpolation method is used to find the new data points within the range of a discrete set of known data points.

### Lagrange Interpolation Formula

Given few real values x1, x2, x3, …, xn and y1, y2, y3, …, yn and there will be a polynomial P with real coefficients satisfying the conditions P(xi) = yi, ∀i = {1, 2, 3, …, n} and degree of polynomial P must be less than the count of real values i.e., degree(P) < n. The Lagrange Interpolation formula for different orders i.e., nth order is given as,

Lagrange Interpolation Formula for nth order is-

If the Degree of the polynomial is 1 then,

Lagrange Interpolation Formula for 1st order polynomial is-

Similarly for 2nd Order polynomial, the Lagrange Interpolation formula is-

Proof of Lagrange Theorem

Let’s consider a nth degree polynomial of given form

Substitute observations xi to get Ai

Put x = x0 then we get A0

f(x0) = y0 = A0(x0 – x1)(x0 – x2)(x0 – x3)…(x0 – xn)

A0 = y0/(x0 – x1)(x0 – x2)(x0 – x3)…(x0 – xn)

By substituting x = x1 we get A1

f(x1) = y1 = A1(x1 – x0)(x1 – x2)(x1 – x3)…(x1 – xn)

A1 = y1/(x1 – x0)(x1 – x2)(x1 – x3)…(x1 – xn)

In similar way by substituting x = xn we get An

f(xn) = yn = An(xn – x0)(xn – x1)(xn – x2)…(xn – xn-1)

An = yn/(xn – x0)(xn – x1)(xn – x2)…(xn – xn-1)

If we substitute all values of Ai in function f(x) where i = 1, 2, 3, …n then we get Lagrange Interpolation Formula.

Let’s look into a few sample questions on Lagrange Interpolation Formula.

### Sample Problems

Question 1: Find the value of y at x = 2 for the given set of points (1, 2),(3, 4)

Solution:

Given,

(x0, y0) = (1, 2)

(x1, y1) = (3, 4)

x = 2

As per the 1st order Lagrange Interpolation Formula,

= (-2/-2) + (4/2)

= 1 + 2

y = 3

Question 2: Find the value of y at x = 5 for the given set of points (9, 2), (3, 10)

Solution:

Given,

(x0, y0) = (9, 2)

(x1, y1) = (3, 10)

x = 5

As per the 1st order Lagrange Interpolation Formula,

= (4/6) + (-40/-6)

= (2/3) + (20/3)

= 22/3

y = 7.33

Question 3: Find the value of y at x = 1 for the given set of points (1, 6), (3, 4), (2, 5)

Solution:

Given,

(x0, y0) = (1, 6)

(x1, y1) = (3, 4)

(x2, y2) = (2, 5)

x = 1

As per the 2nd order Lagrange Interpolation Formula

= (12/2) + 0 + 0

y = 6

Question 4: Find the value of y at x = 10 for the given set of points (9, 6), (3, 5), (1, 12)

Solution:

Given,

(x0, y0) = (9, 6)

(x1, y1) = (3, 5)

(x2, y2) = (1, 12)

x = 10

As per the 2nd order Lagrange Interpolation Formula,

= (63/8) + (-15/4) + (21/4)

= (63-30 + 42)/8

= 75/8

y = 9.375

Question 5: Find the value of y at x = 7 for the given set of points (1, 10), (2, 4), (3, 4), (5, 7)

Solution:

Given,

(x0, y0) = (1, 10)

(x1, y1) = (2, 4)

(x2, y2) = (3, 4)

(x3, y3) = (5, 7)

x = 7

As per the 3rd order Lagrange Interpolation Formula,

= -50 + 64 – 60 + 35

= 99 – 110

y = -11

Question 6: Find the value of y at x = 10 for the given set of points (5, 12), (6, 13), (7, 14), (8, 15)

Solution:

Given,

(x0, y0) = (5, 12)

(x1, y1) = (6, 13)

(x2, y2) = (7, 14)

(x3, y3) = (8, 15)

x = 10

As per the 3rd order Lagrange Interpolation Formula

= -48 + 195 – 280 + 150

y = 17

Question 7: Find the value of y at x = 0 for the given set of points (-2, 5),(1, 7)

Solution:

Given,

(x0, y0) = (-2, 5)

(x1, y1) = (1, 7)

x = 0

As per the 1st order Lagrange Interpolation Formula

= (5/3) + (14/3)

= 19/3

y = 6.33

My Personal Notes arrow_drop_up
Related Tutorials