Example 1
- (0, 0) and (10, 10)
- x = 5
5
What is y at (0,0), (10,10) and x = 5? 5.
Enter two nodes (x₀, y₀), (x₁, y₁) and the query x. The calculator computes y on the line: y = y₀ + (x − x₀)/(x₁ − x₀)·(y₁ − y₀). With (0, 0), (10, 10) and x = 5 the result is y = 5. When x leaves the segment, the result is extrapolation along the same line. This is not a spline, not a regression, and not an inverse solve for x from y.
Enter x₀, y₀, x₁, y₁ and x.
Requires x₁ ≠ x₀. When the nodes share the same x, the calculator reports an error.
Linear interpolation (lerp) estimates a value y on the straight line between two known nodes (x₀, y₀) and (x₁, y₁). The classical numerical-analysis formula is y = y₀ + (x − x₀)/(x₁ − x₀) · (y₁ − y₀), with domain condition x₁ ≠ x₀. That is a textbook standard (e.g. Burden & Faires, Numerical Analysis; Wikipedia — Linear interpolation), not an invented index.
The calculator uses the numbers you enter: x₀, y₀, x₁, y₁ and the query x (field IDs a–e unchanged). With (0, 0), (10, 10) and x = 5 you get t = 0.5 and y = 5. With (1, 2), (3, 6) and x = 2 the result is 4. With (0, 0), (2, 10) and x = 1 the result is 5.
Parameter t and the weighted form. Let t = (x − x₀)/(x₁ − x₀). Then y = y₀ + t·(y₁ − y₀) and equivalently y = (1 − t)y₀ + t y₁. For x in the closed interval between x₀ and x₁, usually t ∈ [0, 1] and the point lies on the segment. When x leaves [x₀, x₁], |t| leaves [0, 1] — the algebra of the same line still runs, and the panel labels the result as extrapolation.
Derivation from similar triangles. On segment P₀P₁ the rises are Δx = x₁ − x₀ and Δy = y₁ − y₀. Similar triangles give (x − x₀)/Δx = (y − y₀)/Δy, so y − y₀ = t·Δy. The parametric form P(t) = (1 − t)P₀ + t P₁ yields the same point. Geometrically the result sits on the chord of a function — the line joining two nodes, not on an unknown curve f between them.
Error versus a true f. If the data come from a nonlinear curve, the chord is only an approximation. This calculator does not invent error bounds: without an assumption on f″ there is no trustworthy “error” number. Textbooks (Burden/Faires) discuss the interpolation remainder under extra hypotheses — here the result is only the value on the line through two points.
Domain. When x₀ = x₁ the denominator vanishes. The calculator reports an error instead of inventing a y (the old path that returned y₀ is gone). The neighbouring linear-function-value calculator computes y = ax + b from slope and intercept, not from two nodes.
The live diagram draws segment P₀P₁ and point P(x, y). That is the same geometry the formula computes — with no separate “visual” scale.
y = y₀ + (x − x₀)/(x₁ − x₀) · (y₁ − y₀), with x₁ ≠ x₀.
Parameter: t = (x − x₀)/(x₁ − x₀), so y = y₀ + t·(y₁ − y₀) = (1 − t)y₀ + t y₁. Slope: m = (y₁ − y₀)/(x₁ − x₀).
Mathematical model: linear interpolation / lerp. The calculator divides (x − x₀) by (x₁ − x₀) and scales the y rise in the browser.
Linear interpolation (lerp) evaluates y on the line through two nodes (x₀, y₀) and (x₁, y₁) at a given x. The formula is y = y₀ + ((x − x₀)/(x₁ − x₀)) · (y₁ − y₀), provided x₁ ≠ x₀. The parameter t = (x − x₀)/(x₁ − x₀) is the barycentric coordinate on the x-axis: y = (1 − t)·y₀ + t·y₁. When t ∈ [0, 1] the point lies on the segment; outside that interval one speaks of linear extrapolation.
It is a numerical standard in graphics (GLSL mix), in metrology for two-point calibration, and in numerical analysis (degree-1 Lagrange polynomial). NIST-oriented notes and approximation textbooks (Burden/Faires; Press et al., Numerical Recipes) treat linear interpolation as the simplest polynomial case.
In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.
Joining points by a straight line is ancient (Euclidean geometry); modern tabular interpolation (Newton, Lagrange) generalizes it to higher degrees. Lerp remains the default tool when data are sparse and local linearity is an acceptable model.
Conceptually the calculator does not smooth curves or compute splines. It also does not run least-squares regression through many points — only exactly two nodes and one query x. When x₀ = x₁ the chord is vertical and no finite slope exists in this model.
In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.
Input: five reals x₀, y₀, x₁, y₁, x with x₁ ≠ x₀. Output: y ∈ ℝ. The map x ↦ y is affine: y = y₀ + m(x − x₀) with m = (y₁ − y₀)/(x₁ − x₀).
Identities: at x = x₀ one has y = y₀; at x = x₁, y = y₁; y = (1 − t)y₀ + t y₁. The error relative to an unknown g ∈ C² on the interval is O((x₁ − x₀)²) in the classical Lagrange remainder estimate of degree 1.
Extrapolation (|t| > 1 or t < 0) uses the same formula; uncertainty grows outside the nodes.
In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.
Step 1. Seek a line y − y₀ = m(x − x₀). Passing through (x₁, y₁) forces m = (y₁ − y₀)/(x₁ − x₀).
Step 2. Substitution yields y = y₀ + ((x − x₀)/(x₁ − x₀))(y₁ − y₀).
Step 3 (weighted form). t = (x − x₀)/(x₁ − x₀) ⇒ y = (1 − t)y₀ + t y₁ — a convex combination when t ∈ [0, 1].
Step 4 (Lagrange). The polynomial l(x) = y₀·(x − x₁)/(x₀ − x₁) + y₁·(x − x₀)/(x₁ − x₀) is identically the same formula.
In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.
Example: (0, 0), (10, 5), x = 4 → t = 0.4 → y = 2. Midpoint: x = (x₀ + x₁)/2 ⇒ y = (y₀ + y₁)/2. When y₀ = y₁ the result is the constant y₀ for every x.
When x₁ = x₀ the calculator reports an error (division by zero). When x lies outside [min(x₀,x₁), max(x₀,x₁)], the panel marks extrapolation.
In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.
In floating-point arithmetic, subtractions x − x₀ with nearly equal nodes lose digits; for typical inputs the formula is stable. Comma and period are equivalent. The calculator reports t, m, dx, dy and the weighted check (1 − t)y₀ + t y₁.
The calculator does not sort nodes — the order (x₀,y₀), (x₁,y₁) is as entered.
In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.
Related: percentage change (a different growth model), min–max range, square of a sum (algebraic geometry, not interpolation). Higher-degree polynomials need other tools.
Authorities: Numerical Recipes (Press et al.); Burden & Faires; MathWorld — Linear Interpolation; NIST interpolation notes. Educational tool.
In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.
y is the value on the line through two nodes. With (0,0), (10,10) and x = 5 you get y = 5. Parameter t and slope m appear in the result panel.
5
What is y at (0,0), (10,10) and x = 5? 5.
4
What is y at (1,2), (3,6) and x = 2? 4.
5
What is y at (0,0), (2,10) and x = 1? 5.
15
What is y at (0,0), (10,10) and x = 15? 15 (extrapolation).
2.5
What is y at (0,0), (10,10) and x = 2.5? 2.5.
error
What if x₀ = x₁? Error — zero denominator.
It is estimating y on the straight chord between two known nodes (x₀, y₀) and (x₁, y₁). The classical formula is y = y₀ + (x − x₀)/(x₁ − x₀)·(y₁ − y₀), provided x₁ ≠ x₀.
The parameter is t = (x − x₀)/(x₁ − x₀). Then y = y₀ + t·(y₁ − y₀), or equivalently y = (1 − t)y₀ + t y₁. For x in [x₀, x₁] usually t ∈ [0, 1]; outside that interval |t| leaves [0, 1] and the result is extrapolation.
The result is 5, because t = 5/10 = 0.5 and y = 0 + 0.5·10 = 5. That is the first example on this page and the same result after “Fill this example”.
The result is 4, because t = (2 − 1)/(3 − 1) = 0.5 and y = 2 + 0.5·4 = 4.
The result is 5, because t = 1/2 = 0.5 and y = 0 + 0.5·10 = 5.
The denominator (x₁ − x₀) is zero and the formula has no finite slope. The calculator reports an error and does not invent a y. Example: 5, 7, 5, 9 and x = 3 does not pass.
Yes. The algebra of the same line does not stop the computation. With (0,0), (10,10) and x = 15 you get y = 15 and t = 1.5. The panel labels that as extrapolation — without a fake error bound versus an unknown curve f.
Here you build the line from two nodes. The neighbouring linear-function-value calculator takes slope a and intercept b. Both models describe a line, but the input fields differ.
On segment P₀P₁ the rises are Δx = x₁ − x₀ and Δy = y₁ − y₀. Similar triangles give (x − x₀)/Δx = (y − y₀)/Δy, so y − y₀ = t·Δy. The parametric form P(t) = (1 − t)P₀ + t P₁ yields the same y.
No. Swapping (0,0) with (10,10) at x = 5 still gives y = 5, because t and the slope flip sign together.
Yes. Enter 2.5 (US). With (0,0), (10,10) and x = 2.5 the result is 2.5. A comma decimal is also accepted by the parser.
No. The result depends only on the five coordinates. The currency and unit settings in the page header do not affect this result.
Enter two nodes and the query x. Compute t = (x − x₀)/(x₁ − x₀), then y = y₀ + t·(y₁ − y₀). With (0,0), (10,10) and x = 5: t = 0.5 and y = 5.
Interpolation means x lies between x₀ and x₁ (usually t ∈ [0, 1]). Extrapolation means x is outside the segment — same formula, but the panel flags the result as extrapolation because the line continues past the known nodes.
No. Only two nodes and one straight line (lerp). Multi-point fits, cubic splines, and regression are not on this page.
Not as a built-in mode. This page solves for y from x. You can swap roles by hand (put the known axis in the x fields), but there is no inverse mode.
2.5. t = 2.5/10 = 0.25 and y = 0 + 0.25·10 = 2.5. That is example 5 on this page.
The formula, domain, and derivation below come from recognized numerical-analysis sources.
Page Updated November 2, 2026.