Cross-Linear Interpolation Consider a two-dimensional function y(x,z), and suppose that for any fixed value of z there is a linear relationship between x and y. In other words, the function can be written in the form for some one-dimensional functions a(z) and b(z), representing at any given value of z the "slope" and "intercept" of y as a function of x. In practice the function may be specified (approximately) by giving the values of a(z) and b(z) for n discrete value of z denoted by z1, z2,... zn. Now suppose we're given specific values of x and z, with z in between z1 and z2, and we are asked to "linearly interpolate" the value of the function y(x,z) with these arguments. This seemingly simple request is actually ambiguous, because there are really two different senses in which linear interpolation can be applied - and in some circumstances the difference in results can be very significant. The most common approach to linearly interpolating this function over the z variable would be by the formula where y(x,zi) = a(zi)x + b(zi). If z is half way between z1 and z2, this would give an interpolated line that is half way between the two lines in the vertical sense, i.e., the interpolated y value will be half way between the y values at z1 and z2 at the same x value. This is illustrated by the green line in the figure below. However, there is another way to "linearly interpolate" between the same two lines. We could interpolate horizontally, i.e., we could use the line that is half-way between the lines for z1 and z2 in the horizontal direction. This is indicated by the red line in the figure above. It sometimes surprises people to learn that these two lines are, in general, distinct. These two forms of linear interpolation yield the same answer only if the lines for z1 and z2 are parallel. Depending on the actual form of the relationship between x, y, and z, either one or the other of these two forms of linear interpolation may be correct. (Despite this, the first form is almost always used in practice.) To determine the algebraic expression for cross-linear interpolation (i.e., the red line in the figure above), we must first solve (1) for x in terms of y and z, which gives Linear interpolation over z now gives where x(y,zi) is given by (3) with z = zi . Making this substitution and solving for y as a function of x, we arrive at the locus of cross-linear interpolation where Q = (z - z1)/(z2 - z1) and we've set ai = a(zi) and bi = b(zi). In terms of these same symbols the original interpolation formula (3) is The slopes of these two loci are equal if and only if so in general this requires that the slopes a1, a2 of the two given constant-z lines be equal. The intercepts of the two loci are equal if and only if which confirms that a necessary and sufficient condition for linear and cross-linear interpolation to yield equal results (for intermediate values of z) is that a2 = a1. Return to MathPages Main Menu