Inverse interpolation answers the reverse question: given a target y, which x produces it? For linear inverse interpolation between two known points (x1, y1) and (x2, y2), the formula is:
x = x1 + (y − y1) × (x2 − x1) / (y2 − y1)
It is ordinary linear interpolation with the roles of x and y swapped. You can do it in our interpolation calculator without rearranging anything: fill in Y3 and leave X3 empty.
Below are three worked examples: a steam table lookup, a target value in an engineering table, and root finding. After them comes the situation where inverse interpolation gives wrong answers.
Why it works
Linear interpolation assumes the points (x1, y1) and (x2, y2) are joined by a straight line. A straight line can be read in either direction. If y = y1 + (x − x1) × (y2 − y1) / (x2 − x1), then solving for x gives the formula above. There is no new mathematics, only the same line used backward.
That symmetry holds for straight lines only. For higher-order methods such as polynomials or splines, “interpolating x as a function of y” and “solving y(x) = target” give slightly different answers. For linear interpolation they are identical.
Example 1: saturation temperature for a given pressure
Problem: Your steam table is organized by temperature, and you need the saturation temperature at exactly 300 kPa.
The nearest rows, from IAPWS-IF97 data, are:
| T (°C) | Psat (kPa) |
|---|---|
| 130 | 270.26 |
| 135 | 313.20 |
The pressure is known, so pressure plays the role of y:
T = 130 + (300 − 270.26) × (135 − 130) / (313.20 − 270.26) T = 130 + 29.74 × 5 / 42.94 T = 130 + 3.463 = 133.46 °C
The exact saturation temperature at 0.3 MPa is 133.53 °C, so the error is about 0.06 °C. Saturation pressure grows roughly exponentially with temperature, so interpolating on the logarithm of pressure does better:
T = 130 + (ln 300 − ln 270.26) × 5 / (ln 313.20 − ln 270.26) = 133.54 °C
That is within 0.02 °C of the exact value. Our steam table interpolation guide covers the forward direction and more of these accuracy tricks.
Check it with the calculator: leave X3 empty
Open the linear interpolation calculator and enter:
- X1 = 130, Y1 = 270.26
- X2 = 135, Y2 = 313.2
- Leave X3 empty
- Y3 = 300
Press Calculate. X3 fills in as 133.46. The calculator solves for whichever one of the five fields you leave blank, so inverse interpolation needs no extra steps.
Example 2: reading a table “backward”
Problem: At what saturation temperature does the vapor enthalpy hg reach 2,750 kJ/kg?
| T (°C) | hg (kJ/kg) |
|---|---|
| 150 | 2745.9 |
| 155 | 2751.8 |
T = 150 + (2750 − 2745.9) × 5 / (2751.8 − 2745.9) = 150 + 4.1 × 5 / 5.9 = 153.47 °C
Solving the IF97 equations exactly gives 153.45 °C. This kind of reverse lookup is common in thermodynamics problems where an energy balance gives you h, and you need the temperature or quality. Engineers also use it to find the flow rate for a target pressure drop, or the setting for a target output in any calibration table. For tables with two inputs, combine it with double interpolation.
Example 3: finding a root by inverse interpolation
Inverse interpolation is also a root-finding method. To solve f(x) = 0, evaluate f at two points, then inversely interpolate to the x where f would be zero.
Problem: Solve x³ − 2x − 5 = 0, the classic test equation.
f(2) = 8 − 4 − 5 = −1 and f(3) = 27 − 6 − 5 = 16. The sign change means a root lies between 2 and 3.
Step 1: Inversely interpolate to y = 0:
x = 2 + (0 − (−1)) × (3 − 2) / (16 − (−1)) = 2 + 1/17 = 2.0588235
This is not exact, because f is curved: f(2.0588235) = −0.3908. Repeating the step with the two most recent points is the secant method:
| Iteration | x | f(x) |
|---|---|---|
| 1 | 2.0588235 | −0.3907999 |
| 2 | 2.0812637 | −0.1472041 |
| 3 | 2.0948241 | 0.0030438 |
| 4 | 2.0945494 | −0.0000229 |
| 5 | 2.0945515 | 0.0000000 |
After five steps the root is x = 2.0945515, correct to seven decimal places. Spreadsheet Goal Seek and many solver routines work on this same idea.
If you always keep the two points that bracket the sign change, instead of the two most recent, the method is called regula falsi (false position). It is slower but guaranteed never to leave the bracket.
When inverse interpolation fails: non-monotonic data
Inverse interpolation assumes that each y appears only once in the range you search. That holds only if the data is monotonic, meaning it always increases or always decreases. When it does not, one y can have two or more x values, and a naive lookup returns just one of them, or the wrong one.
Example: A ball is thrown upward at 40 m/s. Its height follows h = 40t − 4.9t²:
| t (s) | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|---|
| h (m) | 0.0 | 35.1 | 60.4 | 75.9 | 81.6 | 77.5 | 63.6 | 39.9 | 6.4 |
Question: When is the ball at 70 m?
The table crosses 70 m twice:
- Going up, between 2 and 3 s: t = 2 + (70 − 60.4) / (75.9 − 60.4) = 2.62 s
- Coming down, between 5 and 6 s: t = 5 + (70 − 77.5) / (63.6 − 77.5) = 5.54 s
The exact answers from the quadratic formula are 2.54 s and 5.62 s. Both interpolated values are off by about 0.08 s. The curve bends a lot within a 1-second step, so a straight chord cuts the corner.
The two failure modes to watch for:
- Missing a solution. Code that searches for the first bracket will stop at 2.62 s and never report 5.54 s. If your question is “when does it come back down?”, you get the wrong answer with no warning.
- Bad results near a turning point. Asking when the ball reaches 81 m gives two solutions squeezed close to the peak (t = 4.08 s, h = 81.63 m). There, a small change in y moves x a lot, so interpolation errors grow sharply. Above the peak there is no solution at all.
How to handle it:
- Check monotonicity first. Confirm that the y column only goes up, or only goes down, across the range you search.
- Split the data at turning points, and search each monotonic piece separately.
- Report every bracket where y crosses the target, not just the first.
- Use closer spacing or a curved method near turning points, or solve the underlying equation directly if you have it.
The same rule applies to lookup tables in code: numpy.interp and binary search both need monotonic x values. Our lookup table interpolation guide shows how to set this up in Excel, Python and C.
Inverse interpolation vs extrapolation
If your target y lies outside the range of the table (for example, a pressure higher than the last row), the same formula still produces a number. That number is an extrapolation, and its error can be large. Make sure your y is between y1 and y2 before trusting the result. For when extrapolating is reasonable, see linear extrapolation.
Frequently asked questions
What is the formula for inverse linear interpolation?
x = x1 + (y − y1) × (x2 − x1) / (y2 − y1). It is the normal linear interpolation formula with x and y swapped.
Is inverse interpolation the same as interpolating x as a function of y?
For linear interpolation, yes: both give exactly the same number. For quadratic, Lagrange or spline interpolation, the two approaches give slightly different answers, because the curve through the points is no longer the same when you swap the axes.
How do I do inverse interpolation in Excel?
Use the same formula with cell references, =X1+(Y-Y1)*(X2-X1)/(Y2-Y1), or use FORECAST with the x and y ranges swapped. Our Excel interpolation article has the details.
Can I use inverse interpolation to find an interest rate or IRR?
Yes. Finding the discount rate that makes net present value zero is a root-finding problem, and the textbook IRR method is exactly the inverse interpolation shown in Example 3. See IRR by interpolation.