Open In App

Lagrange Interpolation Formula

Last Updated : 26 Aug, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

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 of 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.

In this article, we will learn about, Lagrange Interpolation, Lagrange Interpolation Formula, Proof for Lagrange Interpolation Formula, Examples based on Lagrange Interpolation Formula, and others in detail.

What is Lagrange Interpolation?

Lagrange Interpolation is a way of finding the value of any function at any given point when the function is not given. We use other points on the function to get the value of the function at any required point.

Suppose we have a function y = f(x) in which substituting the values of x gives different values of y. And we are given two points (x1, y1) and (x2, y2) on the curve then the value of y at x = a(constant) is calculated using Lagrange Interpolation Formula.

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.

Lagrange Interpolation Formula for nth Order

The Lagrange Interpolation formula for nth degree polynomial is given below:

Lagrange Interpolation Formula for the nth order is,

f(x)=\frac{(x-x_1)(x-x_2)...(x-x_n)}{(x_0-x_1)(x_0-x_2)...(x_0-x_n)}\times y_0+\frac{(x-x_0)(x-x_2)...(x-x_n)}{(x_1-x_0)(x_1-x_2)...(x_1-x_n)}\times y_1+...+\frac{(x-x_0)(x-x_1)...(x-x_n-1)}{(x_n-x_0)(x_n-x_1)...(x_n-x_n-1)}\times y_n

Lagrange First Order Interpolation Formula

If the Degree of the polynomial is 1 then it is called the First Order Polynomial. Lagrange Interpolation Formula for 1st order polynomials is,

f(x)~=~\frac{(x-x_1)}{(x_0-x_1)}\times y_0+\frac{(x-x_0)}{(x_1-x_0)}\times y_1

Lagrange Second Order Interpolation Formula

If the Degree of the polynomial is 2 then it is called Second Order Polynomial. Lagrange Interpolation Formula for 2nd order polynomials is,

f(x)~=~\frac{(x-x_1)(x-x_2)}{(x_0-x_1)(x_0-x_2)}\times y_0+\frac{(x-x_0)(x-x_2)}{(x_1-x_0)(x_1-x_2)}\times y_1+\frac{(x-x_0)(x-x_1)}{(x_2-x_0)(x_2-x_1)}\times y_2

Proof of Lagrange Theorem

Let’s consider a nth-degree polynomial of the given form,

f(x) = A0(x – x1)(x – x2)(x – x3)…(x – xn) + A1(x – x1)(x – x2)(x – x3)…(x – xn) + … + A(n-1)(x – x1)(x – x2)(x – x3)…(x – xn)

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)

Similarly, 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 as,

f(x)~=~\frac{(x-x_1)(x-x_2)...(x-x_n)}{(x_0-x_1)(x_0-x_2)...(x_0-x_n)}\times y_0+\frac{(x-x_0)(x-x_2)...(x-x_n)}{(x_1-x_0)(x_1-x_2)...(x_1-x_n)}\times y_1+...+\frac{(x-x_0)(x-x_1)...(x-x_n-1)}{(x_n-x_0)(x_n-x_1)...(x_n-x_n-1)}\times y_n

Properties of Lagrange Interpolation Formula

Various properties of the Lagrange Interpolation Formula are discussed below,

  •  This formula is used to find the value of the function at any point even when the function itself is not given.
  • It is used even if the points given are not evenly spaced.
  • It gives the value of the depennt variable for any independent variable belong to any function and thus is used in Numeracial Analysis for finding the values of the function, etc.

Uses of Lagrange Interpolation Formula

Various uses of the Lagrange Interpolation Formula are discussed below,

  • It is used to find the value of the dependent variable at any particular independent variable even if the function itself is not given.
  • It is used in image scaling.
  • It is used in AI modeling.
  • It is used to teach NLPs, etc.

Read More,

Examples Using Lagrange Interpolation Formula

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

Example 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)

First order Lagrange Interpolation Formula is,

y~=~\frac{(x-x_1)}{(x_0-x_1)}\times y_0+\frac{(x-x_0)}{(x_1-x_0)}\times y_1

At x = 2

=~\frac{(2-3)}{(1-3)}\times 2+\frac{(2-1)}{(3-1)}\times 4

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

y = 1 + 2 = 3

The value of y at x = 2 is 3

Example 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)

First order Lagrange Interpolation Formula is,

y~=~\frac{(x-x_1)}{(x_0-x_1)}\times y_0+\frac{(x-x_0)}{(x_1-x_0)}\times y_1

At x = 5

y~=~\frac{(5-3)}{(9-3)}\times 2+\frac{(5-9)}{(3-9)}\times 10

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

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

y = 22/3 = 7.33

The value of y at x = 5 is 7.33

Example 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)

Second Order Lagrange Interpolation Formula is,

y~=~\frac{(x-x_1)(x-x_2)}{(x_0-x_1)(x_0-x_2)}\times y_0+\frac{(x-x_0)(x-x_2)}{(x_1-x_0)(x_1-x_2)}\times y_1+\frac{(x-x_0)(x-x_1)}{(x_2-x_0)(x_2-x_1)}\times y_2

At x = 1

y~=~\frac{(1-3)(1-2)}{(1-3)(1-2)}\times 6+\frac{(1-1)(1-2)}{(3-1)(3-2)}\times 4+\frac{(1-1)(1-3)}{(2-1)(2-3)}\times 5\\ y~=~\frac{(-2)(-1)}{(-2)(-1)}\times 6+\frac{(0)(-1)}{(2)(1)}\times 4+\frac{(0)(-2)}{(1)(-1)}\times 5

y = (12/2) + 0 + 0

y = 6

The value of y at x = 1 is 6

Example 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)

Second Order Lagrange Interpolation Formula is,

y~=~\frac{(x-x_1)(x-x_2)}{(x_0-x_1)(x_0-x_2)}\times y_0+\frac{(x-x_0)(x-x_2)}{(x_1-x_0)(x_1-x_2)}\times y_1+\frac{(x-x_0)(x-x_1)}{(x_2-x_0)(x_2-x_1)}\times y_2

At x = 10

y~=~\frac{(10-3)(10-1)}{(9-3)(9-1)}\times 6+\frac{(10-9)(10-1)}{(3-9)(3-1)}\times 5+\frac{(10-9)(10-3)}{(1-9)(1-3)}\times 12 \\ y~=~\frac{(7)(9)}{(6)(8)}\times 6+\frac{(1)(9)}{(-6)(2)}\times 5+\frac{(1)(7)}{(-8)(-2)}\times 12

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

y = (63-30 + 42)/8

y = 75/8 = 9.375

The value of y at x = 10 is 9.375

Example 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)

Third Order Lagrange Interpolation Formula is,

y~=~\frac{(x-x_1)(x-x_2)(x-x_3)}{(x_0-x_1)(x_0-x_2)(x_0-x_3)}\times y_0+\frac{(x-x_0)(x-x_2)(x-x_3)}{(x_1-x_0)(x_1-x_2)(x_1-x_3)}\times y_1+\frac{(x-x_0)(x-x_1)(x-x_3)}{(x_2-x_0)(x_2-x_1)(x_2-x_3)}\times y_2+\frac{(x-x_0)(x-x_1)(x-x_2)}{(x_3-x_0)(x_3-x_1)(x_3-x_2)}\times y_3

At x = 7

y~=~\frac{(7-2)(7-3)(7-5)}{(1-2)(1-3)(1-5)}\times 10+\frac{(7-1)(7-3)(7-5)}{(2-1)(2-3)(2-5)}\times 4+\frac{(7-1)(7-2)(7-5)}{(3-1)(3-2)(3-5)}\times 4+\frac{(7-1)(7-2)(7-3)}{(5-1)(5-2)(5-3)}\times 7 \\ y~=~\frac{(5)(4)(2)}{(-1)(-2)(-4)}\times 10+\frac{(6)(4)(2)}{(1)(-1)(-3)}\times 4+\frac{(6)(5)(2)}{(2)(1)(-2)}\times 4+\frac{(6)(5)(4)}{(4)(3)(2)}\times 7

y = -50 + 64 – 60 + 35

y = 99 – 110 = -11

The value of y at x = 7 is -11

Example 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)

Third Order Lagrange Interpolation Formula is,

y~=~\frac{(x-x_1)(x-x_2)(x-x_3)}{(x_0-x_1)(x_0-x_2)(x_0-x_3)}\times y_0+\frac{(x-x_0)(x-x_2)(x-x_3)}{(x_1-x_0)(x_1-x_2)(x_1-x_3)}\times y_1+\frac{(x-x_0)(x-x_1)(x-x_3)}{(x_2-x_0)(x_2-x_1)(x_2-x_3)}\times y_2+\frac{(x-x_0)(x-x_1)(x-x_2)}{(x_3-x_0)(x_3-x_1)(x_3-x_2)}\times y_3

At x = 10,

y~=~\frac{(10-6)(10-7)(10-8)}{(5-6)(5-7)(5-8)}\times 12+\frac{(10-5)(10-7)(10-8)}{(6-5)(6-7)(6-8)}\times 13+\frac{(10-5)(10-6)(10-8)}{(7-5)(7-6)(7-8)}\times 14+\frac{(10-5)(10-6)(10-7)}{(8-5)(8-6)(8-7)}\times 15\\  y~=~\frac{(4)(3)(2)}{(-1)(-2)(-3)}\times 12+\frac{(5)(3)(2)}{(1)(-1)(-2)}\times 13+\frac{(5)(4)(2)}{(2)(1)(-1)}\times 14+\frac{(5)(4)(3)}{(3)(2)(1)}\times 15

y = -48 + 195 – 280 + 150

y = 17

The value of y at x = 10 is 17

Example 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)

First Order Lagrange Interpolation Formula is,

y~=~\frac{(x-x_1)}{(x_0-x_1)}\times y_0+\frac{(x-x_0)}{(x_1-x_0)}\times y_1

At x = 0,

y~=~\frac{(0-1)}{(-2-1)}\times 5+\frac{(0+2)}{(1+2)}\times 7

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

y = 19/3 = 6.33

The value of y at x = 0 is 6.33

FAQs on Lagrange Interpolation Formula

1. What is Lagrange Interpolation Formula?

Lagrange Interpolation Formula is a formula that is used to find the value of the dependent variable of the function for any independent variable even though the function itself is not given.

2. What are the Applications of Lagrange Interpolation Formula?

Lagranges Formula has various application in modern Mathematics and Data Sciences,

  • It is used to AI model Traning.
  • It is used in Image Processing.
  • It is used in Graphing 3-D and higher curves, etc.

3. What is First Order Lagrange Interpolation Formula?

The First Order Lagranges Interpolation Formula is,

f(x) = (x – x1)/(x0 – x1)×f0 + (x – x0)/(x1 – x0)×f1

4. What is Second Order Lagrange Interpolation Formula?

The Second Order Lagranges Interpolation Formula is,

f(x) = [(x – x1)(x – x2)/(x0 – x1)(x0 – x2)]×f0 + [(x – x0)(x – x2)/(x1 – x0)(x1 – x2)]×f1 + [(x – x0)(x – x1)/(x2 – x0)(x2 – x2)]×f0



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads