Linear and Non-Linear Interpolation

 

The In-Betweens

Interpolation can loosely be defined as a process in which you estimate unknown function values that are in between function values that you do know. This is commonly required in situations with non-linear relationships, and a particularly convenient approach when you don't even know the actual function definition.As an example: you own a car that is 5 years old. You know it was worth $10,000 when you bought it, and it is worth $6,500 today. If you need to know what its worth was 1 year ago, and have no other information, you can interpolate the year 4 value between $10,000 at year 0 and $6,500 at year 5.There are several examples of interpolation being practical and necessary in real-world mathematics. Here is an example from Actuarial Science:You are a life insurance actuary working on a problem involving partial-year life expectancies. Your life tables give probabilities of survival at each age, but not in between. For example, you can easily calculate the probability that a random 40 year old is still alive at age 50 or 51 using the table, but you need to interpolate if you are calculating a partial-year probability such as the probability that a 40 year old is still alive at age 50.5.

Linear Interpolation

Linear interpolation is by far the most commonly used method, as it is both easier to interpret and easier to use. Visually, linear interpolation means drawing a secant line between the points that you know, and finding the point on the line that corresponds with the value you want to know about.However, it is unpractical to rely on our artistry skills for an answer that you can calculate algebraically. While a visual representation helps us understand what we are conceptually trykng to accomplish, it is the algebra and arithmetic that you would be expected to know about.Here's how I prefer to write down and use the equation.Let $f(x)$ be the function you are measuring, and let $x=a$ and $x=b$ be the two values you know about. If you need to interpolate to find $f(c)$ where $c$ is between $a$ and $b$, then the approximation for $c$ is given by$$f(c) \approx f(a) + \frac{c-a}{b-a} \cdot \big( f(b) - f(a) \big)$$This formula has a really nice translation to words: to get $f(c)$, start with $f(a)$. Then add the difference between $f(b)$ and $f(a)$, but only a fraction of that difference - the same fraction of how far $c$ is away from $a$, relative to $b$.If $c$ was really close to $b$ then that add-on value would be almost 100% of $f(b)-f(a)$, and we would have$$f(c) \approx f(a) + (f(b)-f(a)) \approx f(b)$$If $c$ was instead really close to $a$ then the add-on value would be almost 0% of $f(b)-f(a)$.$$f(c) \approx f(a) + (0) \approx f(a)$$Finally, if the word interpretation doesn't seem to help you remember, some students prefer memorizing the slope form of this relationship.$$\frac{f(c) - f(a)}{c-a} = \frac{f(b)-f(a)}{b-a)$$This equation is true because if we approximate $c$ via linear interpolation, then we are making a straight line that goes through all three points, and the slope between any two points on the same line is the same. Each side of this equation is a slope calculation (change in $y$ over change in $x$). One downside to this form is that $f(c)$, the thing you are trying to estimate, is not already isolated, so you have to do that yourself after plugging things in,In the earlier example of the depreciating car value, we had$$f(0) = 10000$$$$f(5) = 6500$$and we were curious about f(4). Let's use linear interpolation to get an estimate.$$f(c) \approx f(a) + \frac{c-a}{b-a} \cdot \big( f(b) - f(a) \big)$$$$f(4) \approx f(0) + \frac{4-0}{5-0} \cdot \big( f(5) - f(0) \big)$$$$f(c) \approx 10000 + \frac{4}{5} \cdot \big( 6500 - 10000 \big)$$$$\approx 7200$$We can see once again that the formula is intuitive. Year 4 is $4/5$ between year 0 and year 5, so we should apply $4/5$ of the difference in price to the initial value of $10,000.

Non-Linear Interpolation

ExponentialThe second most popular interpolation method is exponential interpolation. Unlike linear interpolation, which assumes a straight line interpolation pattern between known points, the exponential interpolation pattern assumes a smooth, concave curve between points.Algebraically, the difference between the two can be loosely described as the difference between the arithmetic mean (linear interpolation) and the geometric mean (exponential interpolation). Here is how you find the midpoint between $a$ and $b$ in each case:Arithmetic Mean$$\mathrm{Avg}=\frac{a+b}{2}$$Geometric Mean$$\mathrm{Avg}=a^{1/2} \cdot b^{1/2}$$Along those lines, here is how exponential interpolation works.Once again, let's say we are looking to approximate $f(c)$ where $c$ is between $a$ and $b$, and we know the values of $f(a)$ and $f(b)$.$$f(c) \approx [f(a)]^{(b-c)/(b-a)} \times [f(b)]^{(c-a)/(b-a)}$$The word interpretation is that we will give partial weight to each value we know, in an exponential sense.Re-examine our car example. At year 4, we should give $4/5$ weight to the year 5 value of $6,500, and $1/5$ weight to the initial value of $10,000.$$f(4) \approx [f(0)]^{1/5} \cdot [f(5)]^{4/5}$$$$f(4) \approx 10000^{1/5} \cdot 6500^{4/5}$$$$\approx 7504$$

Other Methods

Choosing one method versus another is a matter of both practicality and appropriateness. As we saw, linear interpolation uses only standard arithmetic operations, and therefore may be easier to use in certain cases. However, if we have reason to believe that the smoothed curve concavity pattern between points that we get from exponential interpolation is true to our expectation of reality, we may want to use that.There are several other uncommon methods of interpolation: trigonometric, polynomial based, or even logarithmic. For example, if you are interpolating sunrise or sunset times based on annual seasonality patterns, you would probably want to use sine functions (the amount of daylight per day graphed over a year has approximately a sinusoidal pattern!).No matter which method you choose or are asked to use, we should always remember two things aboht interpolation.1. It is an estimate only.2. The smaller the interval, the more credible the guess.

It is Not Extrapolation

Finally, be warned - it is not alright to apply interpolation methods to estate unknown values that are outside of the values that you know. That is called extrapolation, and it is almost never appropriate as an estimation technique. We simply do not have a reason to believe that patterns will continue outside of an interval that we have known values for, particularly in cases where we do not know exactly what the function is formulaically (which, as we said, tends to be the type of function that we want to interpolate for).In short, interpolation is looking at estimates in between known values, while extrapolation is taking a function or model and projecting its validity outside of the range of known data. Keep them straight by the prefixes (inter vs extra). Extrapolation is almost never studied in rudimentary high school and college courses, even in statstics, because of how futile it tends to be in practicality.