Estimate unknown values between two known data points. Choose interpolation direction (X→Y or Y→X), get the linear equation, slope, and a clear interactive visualization.
Linear interpolation is the simplest method for estimating unknown values between two known data points. Given two points (x₀, y₀) and (x₁, y₁), the interpolated value at a target x is found by assuming a straight line between them.
$$ y = y₀ + (x - x₀) · \frac{y₁ - y₀}{x₁ - x₀} $$
where m = (y₁ - y₀)/(x₁ - x₀) is the slope and x₀ ≠ x₁.
The technique is widely used in data preprocessing, computer graphics (texture mapping, tweening), financial forecasting (yield curves), engineering table lookups, and scientific computing. When the target value lies outside the interval, the method is called linear extrapolation, which is riskier due to higher uncertainty.
Linear interpolation is exact for data that truly follows a linear relationship. However, for nonlinear functions, the error is proportional to the second derivative and the square of the interval width. The truncation error bound is given by: |error| ≤ (1/8) · M₂ · h², where M₂ = max|f''(ξ)| and h = x₁−x₀. This makes linear interpolation reliable when data points are closely spaced or the underlying function is nearly linear. For higher precision, consider polynomial or spline interpolation.
A temperature sensor outputs voltage (mV) that is approximately linear with temperature (°C). Calibration points: at 0°C output = 10 mV, at 100°C output = 190 mV. Using linear interpolation, at 45°C we compute output = 10 + (45-0)*(180/100) = 91 mV. This estimation agrees with manufacturer precision within ±1% error, proving linear interpolation is both efficient and accurate for many physical systems.
Let points be A(2, 5) and B(8, 17). The slope m = (17-5)/(8-2) = 12/6 = 2. Equation: y - 5 = 2(x - 2) → y = 2x + 1. For target x = 5, interpolated y = 2·5 + 1 = 11. Our calculator instantly provides these results with an interactive graph.
| Method | Complexity | Smoothness | Best for |
|---|---|---|---|
| Linear Interpolation | O(1) | C⁰ continuous | Uniform tables, real-time estimation |
| Polynomial Interpolation | O(n²) | Smooth (C∞) | Low-degree, smooth functions |
| Cubic Spline | O(n) | C² continuous | Curve fitting, animation easing |
| Nearest Neighbor | O(1) | Discontinuous | Categorical or discrete data |
For given y-value, the corresponding x is derived by rearranging the formula: x = x₀ + (y - y₀) · (x₁ - x₀)/(y₁ - y₀), provided y₀ ≠ y₁. This is essential for applications such as finding the root of a function, converting between color spaces, or solving for time given a measurement in trending data. Our calculator seamlessly switches between modes.
In feature engineering, linear interpolation is used for imputing missing values in time series (e.g., filling gaps in stock prices). Many libraries like pandas (interpolate(method='linear')) rely on this technique. Additionally, in computer vision, bilinear interpolation (a 2D extension) is the backbone of image resizing. Understanding linear interpolation builds a foundation for advanced numerical methods.