Algebra • Coordinate Geometry & Numerical Estimation

Linear Interpolation Calculator

Compute exact interpolated or extrapolated coordinates, slope, y-intercept, and affine blend ratio between two points with interactive line graphing.

|
Last Updated: November 2026
|
Verified Accurate: Forward, Inverse & 2D Lerp
Presets:

Known Endpoint 1 (P1)

(x1, y1)

Known Endpoint 2 (P2)

(x2, y2)
Interpolation

Values between x1 and x2 perform interpolation; values outside perform linear extrapolation.

Interactive Line & Segment Graph

Solid segment shows interpolation domain [P1, P2]; dashed line extends for extrapolation

Interpolated Value (y)
10
Point: (5, 10)
Slope (m)
2
Delta y / Delta x = 16 / 8
Blend Parameter (t)
0.375
62.5% P1 + 37.5% P2
Line Equation
y = 2x + 0
y-intercept b = 0

Step-by-Step Algebraic Derivation

    Direct Answer & Overview
    Verified Educational Guide

    How Linear Interpolation Works

    Linear interpolation estimates an unknown coordinate on the straight line connecting two known data points P₁(x₁, y₁) and P₂(x₂, y₂). By computing the constant rate of change m = (y₂ − y₁)/(x₂ − x₁) or the normalized blend parameter t = (x − x₁)/(x₂ − x₁), any intermediate or extended point evaluates exactly as y = (1 − t)y₁ + ty₂.

    Primary Mathematical Formula Standard & Affine Lerp Forms
    Standard Equation
    ƒ(x)
    Q.E.D.
    y=y1+(x−x1)(y2−y1)x2−x1=(1−t)y1+ty2y = y_1 + \frac{(x - x_1)(y_2 - y_1)}{x_2 - x_1} = (1 - t)y_1 + t y_2
    Exact affine blend valid for both bounded interpolation (0 ≤ t ≤ 1) and extrapolation
    Exact Formula
    Input Parameters
    Required
    1
    Known Endpoint P₁ — First ordered pair (x₁, y₁) anchoring the segment start
    2
    Known Endpoint P₂ — Second ordered pair (x₂, y₂) anchoring the segment end
    3
    Target Input — Query x (forward), target y (inverse), or scalar blend factor t
    Expected Outputs
    Calculated
    Interpolated Result — Exact simplified fraction and decimal coordinate on the line
    Line Model — Slope m = (y₂ − y₁)/(x₂ − x₁), y-intercept b, and y = mx + b
    Affine Blend t — Normalized fraction t and endpoint weight percentages (1 − t) vs t
    Worked Numerical Example
    Instant Verification
    Interpolate y at x = 5 between P₁(2, 4) and P₂(10, 20).
    → Slope m = (20 − 4) / (10 − 2) = 16 / 8 = 2; blend factor t = (5 − 2) / 8 = 0.375; y = 4 + 2 × (5 − 2) = 10.
    Result: y = 10 at (5, 10) | Blend split: 62.5% P₁ + 37.5% P₂

    Linear Interpolation Definition and Algebraic Formulas

    In numerical analysis, experimental science, and engineering design, measurements are rarely available at every continuous input value. Laboratory instruments sample at discrete timestamps, thermodynamic handbooks publish property tables every five or ten degrees, and financial curves list benchmark yields only at standard maturities such as two, five, and ten years. Linear interpolation bridges the gap between two consecutive known observations P1(x1,y1)P_1(x_1, y_1) and P2(x2,y2)P_2(x_2, y_2) by modeling the relationship between them as a straight line segment.

    Mathematically, replacing an unknown curve with a secant line relies on the fundamental property of similar right triangles. Along any straight line with x1≠x2x_1 \neq x_2, the ratio of vertical rise to horizontal run between P1P_1 and an intermediate point P(x,y)P(x, y) must equal the ratio across the entire span from P1P_1 to P2P_2:

    y−y1x−x1=y2−y1x2−x1\frac{y - y_1}{x - x_1} = \frac{y_2 - y_1}{x_2 - x_1}

    Isolating yy yields the classic point-slope interpolation formula used throughout physics, surveying, and calculus:

    y=y1+(x−x1)⋅y2−y1x2−x1=y1+m(x−x1)y = y_1 + (x - x_1) \cdot \frac{y_2 - y_1}{x_2 - x_1} = y_1 + m(x - x_1)

    Notice that the fraction m=y2−y1x2−x1m = \frac{y_2 - y_1}{x_2 - x_1} is simply the constant slope between two points, and rearranging terms immediately produces the slope-intercept equation of a line y=mx+by = mx + b with intercept b=y1−mx1b = y_1 - mx_1. If you already know the gradient rather than a second point, you can switch directly to a point-slope form calculator.

    Parametric Lerp Weights and Geometric Interpretation

    An equally powerful way to view linear interpolation is through a dimensionless progress parameter tt that tracks how far xx has traveled from x1x_1 toward x2x_2:

    t=x−x1x2−x1,y(t)=(1−t)y1+ty2t = \frac{x - x_1}{x_2 - x_1}, \qquad y(t) = (1 - t)y_1 + t y_2

    In software engineering and computer graphics, this convex-combination identity is known universally as lerp. Because the weights (1−t)(1 - t) and tt always sum identically to 11, the expression generalizes effortlessly from scalar numbers to multidimensional vectors P(t)=(1−t)P1+tP2\mathbf{P}(t) = (1 - t)\mathbf{P}_1 + t\mathbf{P}_2 in two or three dimensions, RGB color triples, and linear camera paths—and remains valid even when x1=x2x_1 = x_2 along a vertical line segment.

    Setting t=0.5t = 0.5 evaluates 12P1+12P2\frac{1}{2}P_1 + \frac{1}{2}P_2, which matches the geometric average computed by a midpoint calculator. When you chain multiple linear interpolations hierarchically across three or more control points, the resulting nested lerp construction becomes De Casteljau’s algorithm inside a Bézier curve calculator. Meanwhile, the total Euclidean span between endpoints can be measured with a distance formula calculator.

    Blend Value t Weight on P₁ Weight on P₂ Geometric Meaning
    t < 0 > 100% < 0% Backward extrapolation past P₁
    t = 0 100% 0% Exact match with first endpoint P₁
    t = 0.5 50% 50% Exact geometric midpoint between P₁ and P₂
    t = 1 0% 100% Exact match with second endpoint P₂
    t > 1 < 0% > 100% Forward extrapolation past P₂

    Interpolation Versus Extrapolation Boundaries

    Although both regimes evaluate the exact same formula, distinguishing between interpolation (0≤t≤10 \le t \le 1) and extrapolation (t<0t < 0 or t>1t > 1) is critical when interpreting results. Within the closed interval [x1,x2][x_1, x_2], any smooth monotone function lies near its chord, and any physical bounds satisfied by both endpoints (such as non-negative concentrations or bounded percentages) automatically hold for every convex combination (1−t)y1+ty2(1 - t)y_1 + t y_2.

    Outside [x1,x2][x_1, x_2], linear extrapolation projects the local slope indefinitely into unmeasured territory. If you extrapolate saturation pressure across a phase-transition boundary, or project population growth decades beyond the last census measurement using a two-point tangent, curvature and structural regime shifts quickly invalidate the estimate. Our interactive plot highlights the bounded interpolation segment in solid blue and extends extrapolated wings as dashed indigo lines while flagging the exact status badge above your input field.

    Inverse Interpolation and Higher-Dimensional Extensions

    Scientists often need to solve the converse problem: given a measured response yy, determine which input value xx produces it along the segment between (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2). Switching the calculator to Inverse: Find x from y mode computes the vertical ratio whenever y1≠y2y_1 \neq y_2:

    x=x1+(y−y1)(x2−x1)y2−y1x = x_1 + \frac{(y - y_1)(x_2 - x_1)}{y_2 - y_1}

    When datasets depend on two independent variables—for example, enthalpy tabulated by both temperature and pressure, or pixel color sampled at sub-pixel grid coordinates (x,y)(x, y)—engineers apply bilinear interpolation. Conceptually, bilinear interpolation performs three sequential 1D linear interpolations: first interpolating horizontally along the top and bottom grid edges, and then interpolating vertically between those two intermediate results. Extending once more across a third axis yields trilinear interpolation used in volumetric medical imaging and 3D lookup tables.

    Truncation Error Bounds and Numerical Stability

    Suppose the true underlying phenomenon follows a smooth, twice-continuously differentiable function f(x)f(x) sampled at x1x_1 and x2=x1+hx_2 = x_1 + h. By Rolle’s Theorem applied to the Newton remainder term, the difference between the true function f(x)f(x) and the linear interpolant L(x)L(x) is governed by the second derivative f′′(ξ)f''(\xi) at some interior point ξ∈(x1,x2)\xi \in (x_1, x_2):

    f(x)−L(x)=f′′(ξ)2(x−x1)(x−x2),∣f(x)−L(x)∣≤h28max⁡ξ∈[x1,x2]∣f′′(ξ)∣f(x) - L(x) = \frac{f''(\xi)}{2}(x - x_1)(x - x_2), \qquad |f(x) - L(x)| \le \frac{h^2}{8} \max_{\xi \in [x_1, x_2]} |f''(\xi)|

    Two practical insights follow immediately from this quadratic bound. First, maximum truncation error always peaks at the midpoint t=0.5t = 0.5, where ∣(x−x1)(x−x2)∣=h2/4|(x - x_1)(x - x_2)| = h^2 / 4. Second, doubling the density of reference points (cutting step width hh in half) shrinks interpolation error by a factor of four. On the floating-point side, writing y=y1+t(y2−y1)y = y_1 + t(y_2 - y_1) is numerically preferable to (y1(x2−x)+y2(x−x1))/(x2−x1)(y_1(x_2 - x) + y_2(x - x_1)) / (x_2 - x_1) when endpoints have large baseline offsets, though (1−t)y1+ty2(1 - t)y_1 + t y_2 guarantees monotonicity if y1=y2y_1 = y_2.

    Engineering Tables, Finance, and Computer Graphics Applications

    Thermodynamics & Fluid Mechanics

    Mechanical and chemical engineers constantly interpolate saturated and superheated steam tables to read enthalpy, entropy, specific volume, and vapor pressure between standardized 5 °C or 10 °C intervals.

    Finance & Yield Curves

    Fixed-income analysts estimate par swap rates, zero-coupon discount factors, and implied volatility at odd dates such as 4.25 years by interpolating between neighboring 3-year and 5-year market quotes.

    Digital Audio & Image Resampling

    Sample-rate converters, hardware GPU texture samplers, and keyframe animation engines rely on single-cycle multiply-add lerp instructions to reconstruct smooth intermediate samples in real time.

    Machine Learning & Sensor Fusion

    Time-series pipelines use linear interpolation to impute isolated missing sensor ticks or align asynchronous IMU and GPS timestamps prior to training forecasting models.

    Step-by-Step Worked Numerical Examples

    Example 1: Interpolating Saturated Steam Pressure at 112 °C

    Suppose a steam table lists vapor pressure y1=101.325 kPay_1 = 101.325\text{ kPa} at x1=100∘Cx_1 = 100^\circ\text{C} and y2=198.53 kPay_2 = 198.53\text{ kPa} at x2=120∘Cx_2 = 120^\circ\text{C}. Estimate the saturation pressure at x=112∘Cx = 112^\circ\text{C}.

    1. Find the normalized progress factor: t=112−100120−100=1220=0.6t = \frac{112 - 100}{120 - 100} = \frac{12}{20} = 0.6. Since 0≤0.6≤10 \le 0.6 \le 1, this is strictly interpolation.
    2. Compute the local slope: m=198.53−101.32520=97.20520=4.86025 kPa/∘Cm = \frac{198.53 - 101.325}{20} = \frac{97.205}{20} = 4.86025\text{ kPa/}^\circ\text{C}.
    3. Evaluate the interpolated pressure: y=101.325+0.6(97.205)=101.325+58.323=159.648 kPay = 101.325 + 0.6(97.205) = 101.325 + 58.323 = 159.648\text{ kPa}.

    Example 2: Inverse Interpolation for Concentration Threshold

    A linear calibration curve measures absorbance y1=0.18y_1 = 0.18 at x1=2 mg/Lx_1 = 2\text{ mg/L} and y2=0.78y_2 = 0.78 at x2=10 mg/Lx_2 = 10\text{ mg/L}. Find the unknown concentration xx yielding absorbance y=0.48y = 0.48.

    1. Compute the vertical blend fraction: t=0.48−0.180.78−0.18=0.300.60=0.5t = \frac{0.48 - 0.18}{0.78 - 0.18} = \frac{0.30}{0.60} = 0.5.
    2. Recover xx: x=2+0.5(10−2)=2+4=6 mg/Lx = 2 + 0.5(10 - 2) = 2 + 4 = 6\text{ mg/L}.

    Common Mistakes and Edge-Case Pitfalls

    • Swapping x₁ and x₂ inconsistently: Mixing up (x2−x1)(x_2 - x_1) in the denominator while subtracting (x−x2)(x - x_2) in the numerator flips the sign of the slope and produces values outside the segment bounds.
    • Extrapolating non-linear curves too far: Because exponential, logarithmic, and trigonometric laws accelerate away from a chord, linear extrapolation beyond roughly 10% of the step width hh can introduce systematic bias.
    • Forgetting vertical-line singularities: Whenever x1=x2x_1 = x_2, yy is no longer a function of xx; switch to 2D parametric P(t)P(t) mode instead of dividing by zero.
    • Confusing interpolation with least-squares regression: Linear interpolation passes exactly through two endpoints and treats them as noise-free, whereas regression fits one best-fit line across three or more noisy observations (such as an overdetermined least-squares system).

    Computational Methodology and Precision Standards

    All calculations in this tool run locally inside your browser using IEEE-754 double-precision floating-point arithmetic without server round-trips. In addition to displaying 6-digit decimal outputs, the engine searches reduced denominators up to 10,000 via continued-fraction rational approximation to display clean exact fractions whenever inputs terminate cleanly. High-DPI canvas plotting automatically adapts its coordinate frame so both interpolation points, extrapolated rays, and axis ticks remain legible across mobile phones, tablets, and desktop displays.

    Fact-Checked & Verified • Computational Accuracy Standards
    Updated November 2026 • Editorial Policy
    Authored By
    Sanjay Samanta

    Lead Developer & Founder of Basic Math Tools. Specializes in browser-native computational algorithms and applied mathematics.

    Reviewed & Verified By
    Academic Review Board

    Mathematics & curriculum specialists. Audited against standard algebraic and arithmetic principles.

    Found an error or have an improvement suggestion? Report a calculation issue

    Frequently Asked Questions

    What is linear interpolation and when should you use it?
    Linear interpolation is a numerical method for estimating an unknown dependent value y (or coordinate vector P) between two known tabulated data points (x₁, y₁) and (x₂, y₂) by fitting the straight line segment connecting them. It is the standard first-order approximation when underlying behavior varies smoothly across a short interval, such as reading thermodynamic steam tables, timing keyframes in computer animation, resampling sensor telemetry, or estimating bond yield curves between published maturities.
    What is the standard linear interpolation formula?
    Given two distinct points (x₁, y₁) and (x₂, y₂) with x₁ != x₂, the interpolated value at target x is y = y₁ + (x − x₁) · (y₂ − y₁) / (x₂ − x₁). Equivalently, defining the dimensionless blend parameter t = (x − x₁) / (x₂ − x₁), the expression simplifies to the symmetric lerp form y = (1 − t)y₁ + ty₂.
    What is the difference between linear interpolation and linear extrapolation?
    Both interpolation and extrapolation evaluate the exact same straight-line equation through (x₁, y₁) and (x₂, y₂). When the target x lies strictly inside the interval [x₁, x₂] (equivalently 0 <= t <= 1), the estimate is interpolation and generally stays well bounded by surrounding measurements. When target x lies outside [x₁, x₂] (t < 0 or t > 1), the calculation is extrapolation, where errors grow rapidly if the physical trend curves away from the local tangent line.
    How do you perform inverse linear interpolation to find x from a known y?
    Inverse linear interpolation reverses the dependent and independent variables along the segment between (x₁, y₁) and (x₂, y₂), provided y₁ != y₂. You compute the vertical fraction t = (y − y₁) / (y₂ − y₁) and recover x = x₁ + t(x₂ − x₁). This is frequently used to find the temperature corresponding to a target saturation pressure or the timestamp when a linear ramp crosses a threshold.
    What happens if x₁ equals x₂ in linear interpolation?
    If x₁ = x₂, the denominator (x₂ − x₁) becomes zero, making the functional slope m = (y₂ − y₁) / (x₂ − x₁) undefined because the two points either coincide or form a vertical line. In that situation, y cannot be uniquely determined from x alone; instead, use parametric 2D point interpolation P(t) = (1 − t)P₁ + tP₂ with a blend ratio t in [0, 1].
    How accurate is linear interpolation compared to quadratic or spline interpolation?
    By Taylor remainder theory, linear interpolation of a twice-differentiable function f(x) over an interval of width h has worst-case error bounded by (h² / 8) · max |f″(x)|. Halving the table spacing h shrinks the interpolation error by a factor of four. While cubic splines or Lagrange polynomials reduce error on strongly curved smooth data, linear interpolation never introduces Runge oscillation overshoot and guarantees monotonicity between adjacent samples.
    What is the lerp formula in computer graphics and game development?
    In shader programming, animation, and robotics, linear interpolation is commonly called lerp and written as lerp(a, b, t) = a + t(b − a) or its affine form (1 − t)a + tb. When t = 0, it returns a; when t = 1, it returns b; and when t = 0.5, it returns the exact geometric midpoint. Repeated nested lerps also power De Casteljau’s algorithm for evaluating polynomial Bézier curves.
    Can linear interpolation handle negative slopes or decreasing values?
    Yes. The interpolation formula automatically handles positive, negative, and zero slopes without requiring manual sign flips, and even works when you enter P₁ to the right of P₂ (x₁ > x₂), because reversing the order flips the signs of both (x − x₁) and (x₂ − x₁) simultaneously so their ratio t remains unchanged.