What Is Linear Interpolation?
Linear interpolation is a mathematical method for estimating an unknown value that falls between two known data points. Given two points (x₁, y₁) and (x₂, y₂), linear interpolation assumes a straight-line relationship between them and calculates the y-value corresponding to any x-value within that range. The technique is one of the simplest and most widely used forms of interpolation, appearing in fields ranging from engineering and physics to computer graphics and financial modeling.
The word "interpolation" comes from the Latin "interpolare," meaning to alter or refurbish. In mathematics, it refers to constructing new data points within the range of known data points. Linear interpolation specifically assumes the function between the two known points is a straight line, which makes it fast and easy to compute but may introduce error when the underlying relationship is actually curved.
The Linear Interpolation Formula
The standard linear interpolation formula is: y = y₁ + t × (y₂ − y₁), where t = (x − x₁) / (x₂ − x₁). The parameter t represents how far along the interval from x₁ to x₂ the target x value falls. When t = 0, the result is y₁; when t = 1, the result is y₂; and when t is between 0 and 1, the result is proportionally between y₁ and y₂.
An equivalent formulation is: y = y₁ × (x₂ − x) / (x₂ − x₁) + y₂ × (x − x₁) / (x₂ − x₁). This form makes it clearer that the result is a weighted average of y₁ and y₂, where the weights depend on how close x is to each endpoint. The closer x is to x₁, the more weight y₁ receives, and vice versa.
How to Use This Calculator
Enter the coordinates of two known data points (x₁, y₁) and (x₂, y₂), then enter the target x value at which you want to estimate y. The calculator instantly computes the interpolated value, shows the step-by-step solution, and displays the slope of the line and the interpolation fraction t.
The fraction t indicates the relative position of your target x between x₁ and x₂. A value of t = 0.5 means x is exactly at the midpoint. Values of t less than 0 or greater than 1 indicate extrapolation (estimating outside the known range), which is generally less reliable than interpolation.
Applications of Linear Interpolation
Engineering tables: Engineers frequently look up values in reference tables (steam tables, material properties, etc.) and need values between listed entries. Linear interpolation provides quick estimates without needing to recalculate from first principles.
Computer graphics: Linear interpolation (often called "lerp" in programming) is fundamental to animation, color blending, texture mapping, and smooth transitions. When a game needs to move an object from point A to point B, lerp calculates all intermediate positions.
Financial analysis: Interpolation is used to estimate bond yields, interest rates, and financial values between known data points on yield curves and pricing tables. The technique helps fill gaps in market data.
Sensor data: When sensors sample data at fixed intervals, interpolation estimates values between sampling points. This is common in weather monitoring, industrial process control, and scientific instrumentation.
Limitations and Alternatives
Linear interpolation assumes a straight-line relationship between data points, which can introduce significant error when the underlying function is highly curved. For more accurate results with curved data, consider polynomial interpolation (using multiple points to fit a polynomial), spline interpolation (using piecewise polynomials that connect smoothly), or cubic interpolation (fitting a cubic polynomial through nearby points).
Extrapolation — using the formula with t values outside [0, 1] — is inherently risky because it assumes the linear trend continues beyond the known data. In reality, the underlying function may change behavior outside the observed range. Always extrapolate with caution and verify results against additional data when possible.
Worked Examples
Example 1: A temperature reading at 2:00 PM was 68°F and at 4:00 PM was 74°F. Estimate the temperature at 3:00 PM. Here x₁=2, y₁=68, x₂=4, y₂=74, x=3. t = (3-2)/(4-2) = 0.5. y = 68 + 0.5 × (74-68) = 68 + 3 = 71°F.
Example 2: A material has tensile strength of 500 MPa at 200°C and 420 MPa at 300°C. Estimate strength at 250°C. t = (250-200)/(300-200) = 0.5. y = 500 + 0.5 × (420-500) = 500 - 40 = 460 MPa.