The 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. 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
y =~\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
Similar Reads
Linear Interpolation Formula
Linear Interpolation Formula is a method that constructs the new data points from the given set of data points. Linear interpolation is used for fitting curves using linear polynomials. It finds the unknown values in the table. What is the Linear Interpolation Formula?The formula of linear interpola
4 min read
Interpolation Formula
Interpolation formula is a method to find new values of any function using the set of available values through interpolation. It is an important statistical tool used to calculate the value between two points on the curve of a function from the given points which also lie on the same curve. In stati
9 min read
Interquartile Range Formula
Interquartile Range is related to the quartile concept which comes under parent topic statistics which is a study of the collection of data, analyzing, interpreting, presenting the data in an organized manner. The interquartile range finds the difference between the upper quartile and lower quartile
4 min read
Gregory Newton Interpolation Formula
Newton-Gregory Forward Interpolation Formula is an interpolation method when our data points are evenly spaced. Interpolation is a method in maths used to make educated guesses about values between two points we already know. We can say that the GregoryâNewton forward difference formula involves fin
8 min read
Scala | String Interpolation
String Interpolation refers to substitution of defined variables or expressions in a given String with respected values. String Interpolation provides an easy way to process String literals. To apply this feature of Scala, we must follow few rules: String must be defined with starting character as s
3 min read
Interpolation in Machine Learning
In machine learning, interpolation refers to the process of estimating unknown values that fall between known data points. This can be useful in various scenarios, such as filling in missing values in a dataset or generating new data points to smooth out a curve. In this article, we are going to exp
7 min read
Quadratic Interpolation
A quadratic polynomial is used in the mathematical process of quadratic interpolation to estimate values between data points. When you have a set of three data points and wish to estimate the behaviour of a smooth curve passing through these points, you frequently use this formula. To try to predict
12 min read
Gauss's Forward Interpolation
Interpolation refers to the process of creating new data points given within the given set of data. The below code computes the desired data point within the given range of discrete data sets using the formula given by Gauss and this method is known as Gauss's Forward Method. Gauss's Forward Method:
3 min read
3D Array Interpolation MATLAB
Interpolation is a method of finding the value of queried data points based on the trend created by existing data points. MATLAB provides many options to perform interpolation on data of N-dimensions. In this article, we shall discuss how to interpolate data in a 3D array with the help of some exam
3 min read
Linear Interpolation in MATLAB
Interpolation is a numerical method of finding new data points by finding a pattern in a given set of discrete data points. There are various types and methods of interpolation in the field of Numerical Analysis such as linear interpolation, cubic interpolation, spline interpolation, etc. The key p
3 min read