Linear interpolation, which is usually simply referred to as interpolation or "lerping", is the ability to estimate the value that lies between two other values expressed in a table or line graph. While many people can calculate interpolation intuitively, this article will show you the mathematical approach that underlies this intuition.
Step
Step 1. Identify the values you want to use in calculating values using interpolation
Interpolation can be used for several things, for example finding the value of a logarithmic or trigonometric function, or it can also be used to calculate the pressure or volume of a gas at a certain temperature in chemistry. Since scientific calculators have replaced logarithmic and trigonometric tables, we will use an example to find interpolated gas pressure values at temperatures that are not listed in reference tables or points on the graph.
- For the equation to be derived, we designate the value to be used in the search as ''x'', while the interpolated value we want to find will be designated as ''y''. (We'll use those labels because on the graph, the known values will be sorted on the horizontal axis, or X axis, while the values you want to find will be sorted on the vertical axis, or Y axis).
- The “x” value used is the gas temperature, which in the following example is 37 °C.
Step 2. Find the value closest to x in the table or graph
The reference table in the figure does not show the gas pressure at 37 °C, but the pressures for 30 °C and 40 °C are included. The gas pressure at 30 °C is 3 kilopascals (kPa), while the gas pressure at 40 °C is 5 kPa.
-
Since we denote the temperature of 37 °C with ''x'', we will designate the temperature of 30 °C as ''x1' ' while the value of 40 °C is designated as ''x2’’.
-
Since we designate the pressure we want to find as ''y'', we will designate 3 kPa (pressure at 30 °C) as ''y'1'', and denotes 5 kPa (pressure at 40 °C) as ''y2’’.
Step 3. Find the interpolation value mathematically
The equation to find the interpolation value can be written as follows: y = y1 + ((x – x1)/(x2 - x1) * (y2 - y1))
-
Enter the value of x, x1, and x/2 in their respective places, so that it becomes (37 – 30)/(40 -30), and the result is 7/10 or 0, 7.
-
Enter a value for y1 and y2 at the end of the equation, so you get (5 – 3), or 2.
-
By multiplying 0, 7 by 2, the result is 1, 4. Add 1, 4 to the value of y1, or 3, will yield 4.4 kPa. When compared to initial values, 4.4 is between 3 kPa (pressure at 30 °C) and 5 kPa (pressure at 40 °C), and because 37 °C is closer to 40 °C than 30 °C. C, the result should be closer to 5 kPa than 3 kPa.
Tips
- If you can estimate the distance on the graph well, you can roughly calculate the interpolation value by looking at the position of the point on the X-axis to find the y-value. If in the example above the X-axis is marked at 10 °C, and the Y-axis shows 1 kPa, you can estimate the position of 37 °C, then look to the Y-axis of that point to estimate that the value is almost halfway between 4 and 5. above shows a mathematical way of estimating values, and also produces more accurate values.
- Another thing related to interpolation is extrapolation, which is an estimate of a value outside the range of values contained in the table or illustrated concretely in a graph.