GEOMETRYCoordinate GeometryMathematics Calculator
โ†—

Linear Interpolation

Given (xโ‚€,yโ‚€) and (xโ‚,yโ‚), interpolate at x: y = yโ‚€ + (xโˆ’xโ‚€)ยท(yโ‚โˆ’yโ‚€)/(xโ‚โˆ’xโ‚€). Same as lerp. Linear between two points. Exact at endpoints.

Concept Fundamentals
y = yโ‚€ + (xโˆ’xโ‚€)ยท(yโ‚โˆ’yโ‚€)/(xโ‚โˆ’xโ‚€)
Formula
t=(xโˆ’xโ‚€)/(xโ‚โˆ’xโ‚€), y=(1โˆ’t)yโ‚€+tyโ‚
Lerp
At (xโ‚€,yโ‚€) and (xโ‚,yโ‚)
Exact
x outside [xโ‚€,xโ‚]
Extrapolation

Did our AI summary help? Let us know.

Lerp: y = (1โˆ’t)yโ‚€ + tยทyโ‚ where t โˆˆ [0,1]. At x=xโ‚€: y=yโ‚€; at x=xโ‚: y=yโ‚. Bilinear extends to 2D with four corners.

Key quantities
y = yโ‚€ + (xโˆ’xโ‚€)ยท(yโ‚โˆ’yโ‚€)/(xโ‚โˆ’xโ‚€)
Formula
Key relation
t=(xโˆ’xโ‚€)/(xโ‚โˆ’xโ‚€), y=(1โˆ’t)yโ‚€+tyโ‚
Lerp
Key relation
At (xโ‚€,yโ‚€) and (xโ‚,yโ‚)
Exact
Key relation
x outside [xโ‚€,xโ‚]
Extrapolation
Key relation

Ready to run the numbers?

Why: Linear interpolation estimates values between known data points. Used in animation (lerp), numerical methods, and signal processing. Foundation for bilinear and spline interpolation.

How: y = yโ‚€ + (xโˆ’xโ‚€)ยท(yโ‚โˆ’yโ‚€)/(xโ‚โˆ’xโ‚€). Requires xโ‚€โ‰ xโ‚. Or: t=(xโˆ’xโ‚€)/(xโ‚โˆ’xโ‚€), y=(1โˆ’t)yโ‚€+tyโ‚. For x outside [xโ‚€,xโ‚], it's extrapolation.

Lerp: y = (1โˆ’t)yโ‚€ + tยทyโ‚ where t โˆˆ [0,1].At x=xโ‚€: y=yโ‚€; at x=xโ‚: y=yโ‚.

Run the calculator when you are ready.

InterpolateEnter two points and target x

Enter Known Points and Target x

First Known Point

Second Known Point

For educational and informational purposes only. Verify with a qualified professional.

๐Ÿงฎ Fascinating Math Facts

โ†—

y = yโ‚€ + (xโˆ’xโ‚€)ยท(yโ‚โˆ’yโ‚€)/(xโ‚โˆ’xโ‚€).

โ€” Numerical Methods

t

Lerp: (1โˆ’t)yโ‚€ + tยทyโ‚, t=(xโˆ’xโ‚€)/(xโ‚โˆ’xโ‚€).

โ€” Formula

Key Takeaways

  • โ€ข Linear interpolation assumes a straight line between two known points.
  • โ€ข The formula y=y0+(xโˆ’x0)y1โˆ’y0x1โˆ’x0y = y_0 + (x - x_0) \frac{y_1 - y_0}{x_1 - x_0} is exact at the endpoints.
  • โ€ข When xx is between x0x_0 and x1x_1, it is interpolation; outside is extrapolation.
  • โ€ข The method is also called lerp (linear interpolation) in computer graphics.
  • โ€ข For higher accuracy, use spline or polynomial interpolation.

Did You Know?

Computer Graphics

Lerp is used for color gradients, animations, and smooth transitions between keyframes.

Data Analysis

Fills missing data points or creates evenly spaced samples from irregularly spaced data.

Engineering

Engineers use it to approximate values in steam tables and material property tables.

Finance

Yield curves and pricing models often use linear interpolation between known values.

Game Development

Game engines use lerp for smooth movement, camera transitions, and UI animations.

Scientific Computing

Bilinear and trilinear interpolation extend this concept to 2D and 3D.

Understanding Linear Interpolation

Linear interpolation estimates the value of a function at a point by using the values at surrounding known points. It assumes a straight-line relationship between adjacent points.

y=y0+(xโˆ’x0)โ‹…y1โˆ’y0x1โˆ’x0y = y_0 + (x - x_0) \cdot \frac{y_1 - y_0}{x_1 - x_0}

Expert Tips

Interpolation vs Extrapolation

Interpolation (x between xโ‚€ and xโ‚) is more reliable than extrapolation (x outside the range).

Avoid Division by Zero

Ensure xโ‚€ โ‰  xโ‚. If they are equal, the line is vertical and the formula is undefined.

Weighted Average

The result is a weighted average of yโ‚€ and yโ‚, where weights depend on distance from x.

Higher-Order Methods

For curved functions, consider cubic spline or polynomial interpolation.

Frequently Asked Questions

What is linear interpolation?

Linear interpolation estimates the y-value at a point x by assuming a straight line between two known points (xโ‚€, yโ‚€) and (xโ‚, yโ‚).

When is it interpolation vs extrapolation?

Interpolation: x is between xโ‚€ and xโ‚. Extrapolation: x is outside this range. Extrapolation is less reliable.

When is linear interpolation exact?

It is exact at the endpoints: if x = xโ‚€, then y = yโ‚€; if x = xโ‚, then y = yโ‚.

What if xโ‚€ equals xโ‚?

The formula is undefined. The two points must have different x-coordinates.

When is linear interpolation inaccurate?

When the underlying function is highly curved between the known points.

What is bilinear interpolation?

An extension to 2D: interpolate in both x and y directions using four corner values.

Where is lerp used in programming?

In game engines, graphics, and animation for smooth transitions between values.

How to Use This Calculator

  1. Enter two known points (xโ‚€, yโ‚€) and (xโ‚, yโ‚).
  2. Enter the target x-value where you want the interpolated y.
  3. Click "Calculate" to get the result.
  4. Use sample examples to load preset inputs.

Disclaimer: Linear interpolation assumes a straight-line relationship. For curved data, use higher-order methods. Results are for educational and general use.

๐Ÿ‘ˆ START HERE
โฌ…๏ธJump in and explore the concept!
AI

Related Calculators