ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Function Interpolation and Approximation

Updated on January 7, 2013

Let say that the temperature at the noon is 140C and two hours later it increase to 160C. What is the temperature at 1 pm.? Of course, we can't know exactly what was the temperature at 1p.m. based on these two values but we are rather sure that it was somewhat between.

In many situation, in science and engineering and other areas we need a concrete figure as the answer to the question like above one. Among many possible ways of the temperature change from noon to 2 pm., we can assume the one for which the temperature at 1 pm. was 150C. This is easy to calculate (the value is the mean of the two values since 1 pm is in the middle of the given period) and the most probably close to the real value.

The method we just describe on this simple example is called linear interpolation. Among the interpolation methods linear interpolation is conceptually the simplest and it is often used.

Two basic method of function interpolation are interpolations by

  • Lagrange polynomial and
  • Newton polynomial.

In this article we will describe, explain and illustrate both of techniques. One can find a concrete case study that compare the two procedure on the same data (see Example 1 and Example 2).

Function Interpolation

In many occasions we don't know analytical expression of some function f but only its values in several points: x0<x1<x2<...<xn. Situations like these demand to calculate i.e. to estimate the function value in some points different than the given ones – for which we know the value of function. A procedure of determination of function g on the interval [x0,xn] where it holds

g(xi)=f(xi), i=0,1,2,...

is called function interpolation.

A function g can be chose from the class of polynomials, trigonometric, rational and other function. Probable the most common is polynomial interpolation (i.e. linear and polynomial since a polynomial of the degree two we call linear function).

Close to the term function interpolation is approximation of a function. The main difference is that within interpolation we are looking for "a missing value" between the two known function values while within approximation we are looking for a simpler function replacing a complex one (which is either known or unknown). While obtained function within interpolation have to contain all already known values it is not case in approximation. In that case obtain function have to fit known values "as best as possible" – the criterion for this adhesion is usually defined by the minimum squares method. Function approximation will be explained later in this article.

Interpolation by the Lagrange polynomial of the degree two.
Interpolation by the Lagrange polynomial of the degree two.

Interpolation by Lagrange Polynomial

Now, polynomial interpolation will be exposed by means of two methods i.e. using the Lagrange polynomial and Newton polynomial.

Let the pair of points (x0,f(x0)), (x1,f(x1)),...,(xn,f(xn)) are given, representing known values of a function. The general expression of Lagrange polynomial then is

For Lagrange polynomials of the degrees one and two it holds:

Lagrange polynomials of the degree one and two
Lagrange polynomials of the degree one and two

Example 1. What is the Lagrange polynomial which graph contains the points T0(-2,-3), T1(0,-1) and T2(1,6).

Since we have three function value known, polynomial of the degree two will be chosen. Lagrange polynomial of the degree two is presented on the figure above. Substituting the values we get:

Calculation of the Lagrange polynomial for the points (-2,-3), (0,-1), (1,6)
Calculation of the Lagrange polynomial for the points (-2,-3), (0,-1), (1,6)

Thus, the solution is polynomial 2x2+5x-1 which graph is presented on the first figure. It is visible that the graph contain all three given points.

Interpolation by Newton Polynomial

The general expression of Newton polynomial is given by


Coefficients in the Newton polynomial
Coefficients in the Newton polynomial

As an illustration, it follows Newton polynomials of the degrees one and two.

Calculation of the coefficients in Newton polynomial is practical if one use this differences table:

Practical calculation of the coefficients in Newton polynomial
Practical calculation of the coefficients in Newton polynomial

Contrary to Lagrange method, here one can additionally add a new pair of points (adding one sequence in the table). Furthermore, if some of data changes it is not necessary to count all over again but only the related differences.

The next example illustrates the method on the same case as we have in the first example.

Example 2. For the points T0(-2,-3), T1(0,-1) and T2(1,6) find interpolation polynomial by means of Newton's method.

Firstly, the table of differences should be determined:


As a second and final step, coefficients obtained by the table above we substitute in the Newton polynomial of the degree two. As we expected, the solution is the same as in case when Lagrange method were used.

Function Approximation

In the above we dealt with function interpolation, which means that that function f is replaced by a function g so that its value are equal in the given points.

Here we should to replace a function f with some more simple function that will “very well present f on the whole domain. The “quality” of the approximation will be measured by minimum sum squares method. More precisely, a function g have to be determined, with the following condition, where n is the number of known function value:

Linear Function Approximation

Let pairs (x1,y1), (x2,y2),...,(xn,yn) represent n known values of the function f. The equations of linear function which approximate the given set my means of minimum sum squares method is

where we have the mean of both x and y values and where it holds


Example 3. Given the set of points as in the table below, we have to find linear function by means of minimum squares method.

The whole calculation can be seen in the next table. Once we substitute the obtained values (the last row in the table) in the general linear function equation above, final solution follows: g(x)=0.951192*x+0.092724.

The obtained function g and previously given data one can see in the next figure.

A video at the end shows how we can use function interpolation in order to find a missing data. In this example we use the simplest possible case- linear interpolation. Although linear interpolation is the simplest type of interpolation it is suitable in most of the situations.

Example of linear function approximation
Example of linear function approximation

Simple Function Interpolation

An easy and short question... (assuming linear increase)

view quiz statistics

Three excellent books on function interpolation and approximation from Amazon


    0 of 8192 characters used
    Post Comment

    No comments yet.


    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: ""

    Show Details
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the or domains, for performance and efficiency reasons. (Privacy Policy)
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)