VOOZH about

URL: https://www.geeksforgeeks.org/dsa/lagranges-interpolation/

⇱ Lagrange's Interpolation - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Lagrange's Interpolation

Last Updated : 23 Jul, 2025

What is Interpolation?
Interpolation is a method of finding new data points within the range of a discrete set of known data points (Source Wiki). In other words interpolation is the technique to estimate the value of a mathematical function, for any intermediate value of the independent variable. 
For example, in the given table we're given 4 set of discrete data points, for an unknown function f(x):


How to find?
Here we can apply the Lagrange's interpolation formula to get our solution. 
The Lagrange's Interpolation formula: 
If, y = f(x) takes the values y0, y1, ... , yn corresponding to x = x0, x1 , ... , xn then,


This method is preferred over its counterparts like Newton's method because it is applicable even for unequally spaced values of x.
We can use interpolation techniques to find an intermediate data point say at x = 3. 

Advantages of Lagrange Interpolation:

  • This formula is used to find the value of the function even when the arguments are not equally spaced.
  • This formula is used to find the value of independent variable x corresponding to a given value of a function.

Disadvantages of Lagrange Interpolation:

  • A change of degree in Lagrangian polynomial involves a completely new computation of all the terms.
  • For a polynomial of high degree, the formula involves a large number of multiplications which make the process quite slow.
  • In the Lagrange Interpolation, the degree of polynomial is chosen at the outset. So it is difficult to find the degree of approximating polynomial which is suitable for given set of tabulated points.

Output:

Value of f(3) is : 35

Complexity:
The time complexity of the above solution is O(n2) and auxiliary space is O(1).

References:

Comment
Article Tags:
Article Tags: