Interpolation means estimating a value between known data points. If the xx-value you want is inside the range of the data you already know, interpolation gives you a way to estimate the missing yy-value.

The simplest case is linear interpolation, which uses a straight line between two points. Polynomial interpolation uses one polynomial that passes through several points exactly. Lagrange interpolation is a standard formula for writing that polynomial when the known xx-values are distinct.

If the unknown xx lies outside the known range, you are extrapolating instead. That is a different task and is usually less reliable.

Linear Interpolation Formula

Suppose you know points (x0,y0)(x_0, y_0) and (x1,y1)(x_1, y_1) with x0x1x_0 \ne x_1. For an xx between x0x_0 and x1x_1, linear interpolation uses

y=y0+xx0x1x0(y1y0)y = y_0 + \frac{x - x_0}{x_1 - x_0}(y_1 - y_0)

This works by taking the fraction of horizontal distance from x0x_0 to xx and applying the same fraction of the vertical change from y0y_0 to y1y_1. It is exact if the true relationship is linear on that interval; otherwise it is a local estimate.

Linear Interpolation Example

Suppose the known points are (1,3)(1, 3) and (4,15)(4, 15), and you want the value at x=2x = 2.

Use the linear interpolation formula:

y=3+2141(153)y = 3 + \frac{2 - 1}{4 - 1}(15 - 3)

Now simplify:

y=3+1312y = 3 + \frac{1}{3} \cdot 12 y=3+4=7y = 3 + 4 = 7

So the interpolated value is y=7y = 7. This makes sense because x=2x = 2 is one third of the way from 11 to 44, so the output moves one third of the way from 33 to 1515.

Polynomial Interpolation Means Exact Fit Through Several Points

If you have more than two points with distinct xx-values, polynomial interpolation looks for one polynomial that passes through all of them. For n+1n+1 points with distinct xx-values, there is exactly one polynomial of degree at most nn that fits them.

For example, two points determine a line, three points determine a quadratic at most, and four points determine a cubic at most. This is useful when you want a smooth formula that matches sampled values exactly.

The tradeoff is that exact fit does not always mean good behavior between points. With many points or widely spaced points, a high-degree interpolating polynomial can oscillate a lot, especially near the ends of the interval.

Lagrange Interpolation Formula

Lagrange interpolation is a direct way to write the interpolating polynomial. If you have points (x0,y0),(x1,y1),,(xn,yn)(x_0, y_0), (x_1, y_1), \dots, (x_n, y_n) with distinct xix_i, the Lagrange form is

P(x)=i=0nyiLi(x)P(x) = \sum_{i=0}^{n} y_i L_i(x)

where

Li(x)=j=0jinxxjxixjL_i(x) = \prod_{\substack{j=0 \\ j \ne i}}^{n} \frac{x - x_j}{x_i - x_j}

Each basis polynomial Li(x)L_i(x) is built so that it equals 11 at xix_i and 00 at the other known xx-values. That is why the sum keeps the correct yiy_i at each data point.

You usually use the Lagrange form when you want an exact interpolating polynomial from a small set of points. It is conceptually clean, but for larger numerical problems other forms are often preferred because they are more stable to compute.

Interpolation vs. extrapolation

Interpolation means estimating inside the known range of xx-values. Extrapolation means extending beyond that range.

That difference matters because interpolation stays anchored to nearby data. Extrapolation can fail quickly if the underlying pattern changes outside the observed interval.

Common Interpolation Mistakes

Using interpolation outside the data range

If xx lies outside the known interval, the calculation is no longer interpolation. It becomes extrapolation, which is often less reliable.

Assuming exact fit means exact reality

A polynomial can pass exactly through measured data points and still be a poor model of the real situation between them, especially if the data contain noise.

Forgetting the distinct-xx condition

For the standard interpolation formulas, the known xx-values need to be distinct. If two data points share the same xx but have different yy-values, one function cannot pass through both.

Choosing a high degree too quickly

Using every data point in one large polynomial can create unstable behavior. In practice, piecewise methods such as splines are often preferred when many points are involved.

Where Interpolation Is Used

Interpolation appears in numerical analysis, computer graphics, table lookup, signal processing, and scientific computing. It is useful whenever you know values at selected points but need a reasonable value in between.

In a first math course, it also connects slope, functions, polynomials, and approximation into one idea: using known structure to estimate an unknown in-between value.

Try a similar interpolation problem

Take the points (2,4)(2, 4) and (8,19)(8, 19) and estimate the value at x=5x = 5 with linear interpolation. Then ask whether using a straight line seems reasonable over that interval.

If you want a quick check after you set it up yourself, try your own version in the solver and compare the line equation with your result.

Need help with a problem?

Upload your question and get a verified, step-by-step solution in seconds.

Open GPAI Solver →