Linear Interpolation is the process of finding a value between two known values in a sequence of data. It assumes that the change between the two points is uniform, allowing a straight line to represent the relationship.
The two known points are typically denoted as and , where is the independent variable and is the dependent variable. The goal is to find an unknown for a given that lies within the interval .
This technique is widely used in science and engineering to read values from tables, such as thermodynamic steam tables or trigonometric charts, where only discrete values are provided.
The term Lerp is often used in computer graphics and programming as a shorthand for this process, specifically referring to the weighted average of two values based on a fractional parameter.
The mathematical foundation of linear interpolation is the concept of similar triangles. If you visualize the horizontal and vertical distances between points, the ratio of the vertical rise to the horizontal run (the slope) remains constant along the line.
Because the slope is constant, the relationship can be expressed as . This equality ensures that the rate of change between the first point and the target point is identical to the rate of change between the two known endpoints.
This principle assumes linearity, meaning it ignores any curvature or acceleration that might exist in the true function between the data points. It is a first-order approximation that works best when the interval is small enough that the curve appears flat.
To perform linear interpolation, first identify the two known data points that bracket your target value. Ensure that to maintain the interpolation context.
Calculate the interpolation fraction (or weight), which is . This value represents how far has traveled from toward as a percentage of the total interval.
Apply this fraction to the interval using the formula: This effectively starts at the base value and adds the appropriate portion of the total vertical change.
Alternatively, the formula can be written in its point-slope form: This version is often easier for manual calculation as it combines the slope and the distance from the starting point.
The Boundary Check: Always verify that your calculated value falls between and . If your result is higher than the maximum or lower than the minimum of your two known points, you have likely made an algebraic error.
Slope Consistency: Calculate the slope first. If the slope is positive, your should increase as increases; if negative, should decrease.
Proportionality Logic: Use a quick mental check for the 'halfway' point. If your target is exactly in the middle of and , your must be exactly the average of and .
Units and Scales: Ensure that both and values are in consistent units before calculating. Mixing units (e.g., meters and centimeters) will result in a slope that does not represent the physical reality of the data.