Polynomial Curve Fitting and Lagrange Interpolation Background Just as two points determine a line, three (non-collinear) points determine a quadratic function and, in general, n + 1 points determine a polynomial of degree n, presuming that they do not fall onto a polynomial of lower degree. The process of finding such a polynomial is called interpolation and one of the most important approaches used is the Lagrange interpolating formula. In this article, we show how the Lagrange interpolating polynomial can be introduced and developed at the precalculus level. This brings one of the most powerful and useful tools of numerical analysis to the attention of lower division students while simultaneously building on and reinforcing some of the fundamental ideas in precalculus mathematics. Interpolation and Precalculus Mathematics In precalculus, we emphasize the connection between the real zeros of a polynomial and the linear factors of the polynomial [1]. For example, if f ( x) x 2 5 x 6 ( x 2)( x 3) , then f ( x) has two real zeros, x 2 and x 3 , each corresponding to the linear factor x 2 and x 3 , respectively. Also, we connect a real zero with an x-intercept. If a parabola is given with two known x-intercepts x1 and x2 , then its quadratic function must be of the form f ( x) c( x x1 )( x x2 ) , where c is a constant that can be determined based on additional information about the parabola. For example, suppose that a parabola has two x-intercepts x 6 and x 2 , and passes through the point (3, 20) , as shown in Figure 1. Then we know f ( x) c( x 6)( x 2) . To determine c, we use the given point (3, 20) to get f (3) c(3 6)(3 2) 20 and find that c 20 4 . (3 6)(3 2) 3 To see how the information of the parabola is used in the formula of the quadratic function, we will express the quadratic function as f ( x) c( x 6)( x 2) 20 ( x 6)( x 2) . (3 6)(3 2) 1 (3, 20) 20 10 -3 -2 0 -1 0 -10 1 2 3 4 5 6 7 -20 Figure 1: A parabola passes x-intercepts at x 2 , x 6 and a point (3, 20) However, what if both x-intercepts are not given or if the parabola sits entirely above (or below) the x-axis? How do we find the quadratic polynomial if three points on the parabola are given? If we are fortunate enough to have two of the three points on a parabola that share the same y-coordinate, then we may overcome the difficulty by doing the following. To illustrate the idea, suppose that we have the three points (2, 30) , (6, 30) and (3, 10) , as shown in Figure 2. We first shift the points up by 30, equivalently, we let v y 30 ; then in the xv-plane, we obtain the three corresponding new points (2,0) , (6,0) and (3, 20) . Therefore, we turn this case into y 20 the first example where we v 20 have ( x 6)( x 2) . (3 6)(3 2) Hence, ( x 6)( x 2) 30 . (3 6)(3 2) -3 -2 -1 -5 0 -15 (-2, -30) 1 2 3 4 5 6 7 (3, -10) -25 (6, -30) -35 -45 Figure 2: A parabola passes through the three points (2, 30), (6, 30) and (3, 10) 2 But the general case is where we have three points such as (1, 2) , (3,8) and (6, 4) with different heights on a parabola. Then neither of the above approaches will work and we have to look for a different way to find the quadratic polynomial. One way to proceed is to associate each of the given points with an equation, that is, f (1) 2 , f (3) 8 and f (6) 4 . These three equations are sufficient for solving the three unknown coefficients of a quadratic function f ( x) ax 2 bx c . The evaluation of the function at x 1 , x 3 , and x 6 yields a system of three linear equations in three variables: abc 2 9a 3b c 8 36a 6b c 4 Using either the substitution or elimination method, we find that a and so the quadratic function is f ( x) 13 97 18 , b and c ; 15 15 5 13 2 97 18 x x . The graph of the function is shown 15 15 5 in Figure 3 along with the three interpolating points. 10 (3, 8) 5 (6, 4) (1, 2) 0 0 1 2 3 4 5 6 7 8 -5 -10 Figure 3: A parabola passes three points (1, 2), (3, 8) and (6, 4) The above approach sounds like a very good strategy; it is simple and straightforward. But this method has its own limitation if we want to extend it to more than three interpolating points. When we try to fit a polynomial to n 1 points, we would have to solve a system of n + 1 linear equations in n 1 variables. Is there another way we can find such an interpolating polynomial without involving heavy computations? Let’s re-visit the case where we found the 3 quadratic polynomial, given the two x-intercepts x1 and x2 and a point (a, b) on the parabola. If we repeat the derivation used previously with these parameters instead of the specific coordinates in the example, we obtain the quadratic function f ( x) b ( x x1 )( x x2 ) . It may (a x1 )(a x2 ) be obvious, but it is important to note that f ( x1 ) 0 , f ( x2 ) 0 and f (a ) b . This observation holds the key to a new way of determining the quadratic function that passes through all three given points. It also provides the specific insight needed to extend the process to more than three points. Suppose that we have the three points ( x0 , y0 ) , ( x1 , y1 ) , and ( x2 , y2 ) , where all of the xi are different, though not necessarily uniformly spaced. The observation in the previous paragraph suggests that we may break up the quadratic function f ( x) into three quadratic functions f 0 ( x) , f1 ( x) and f 2 ( x) by looking at the values of the function at x j , j = 1, 2, 3, in the following way: f ( x0 ) f ( x1 ) f ( x2 ) y0 0 0 f 0 ( x) f ( x) 0 y1 0 f1 ( x) 0 y0 0 y1 y2 y2 f 2 ( x) Now we look at the above expression vertically. We pair each of the three numbers in the first column with x j , respectively. We obtain three points ( x0 , y0 ) , ( x1 , 0) , and ( x2 , 0) that define the quadratic function f 0 ( x) y0 ( x x1 )( x x2 ) . Similarly, we can construct f1 ( x) and ( x0 x1 )( x0 x2 ) f 2 ( x) . The function f1 ( x) is defined by three points ( x0 , 0) , ( x1 , y1 ) , and ( x2 , 0) , while f 2 ( x) is defined by ( x0 , 0) , ( x1 , 0) , ( x2 , y2 ) . The expressions for these two functions are f1 ( x) y1 ( x x0 )( x x2 ) and ( x1 x0 )( x1 x2 ) f 2 ( x ) y2 ( x x0 )( x x1 ) . ( x2 x0 )( x2 x1 ) The sum of f 0 ( x) , f1 ( x) and f 2 ( x) is the desired the function that passes through the three points ( x0 , y0 ) , ( x1 , y1 ) , and ( x2 , y2 ) . 4 The equation of the parabola that passes through the three points (1, 2) , (3,8) and (6, 4) in our example is therefore f ( x) 2 ( x 3)( x 6) ( x 1)( x 6) ( x 1)( x 3) 8 4 (1 3)(1 6) (3 1)(3 6) (6 1)(6 3) or 1 4 4 13 97 18 f ( x) ( x 3)( x 6) ( x 1)( x 6) ( x 1)( x 3) x 2 x . 5 3 15 15 15 5 Figure 4 shows f ( x) along with its three component functions f 0 ( x) , f1 ( x) and f 2 ( x) . Let’s focus on the three solid dots that represent the given points in the problem. We see that at the point (1, 2) , only the two graphs of f ( x) and f 0 ( x) pass through it while the other two curves go through the x-intercept at x 1 . Only the graphs of f ( x) and f1 ( x) meet at the point (3,8) , and at the same time, the other two curves have the x-intercept at x 3 . Finally, we have the graphs of f ( x) and f 2 ( x) that intersects at the point (6, 4) , and the other two share the xintercepts at x 6 . 10 (3, 8) (6, 4) 5 (1, 2) 0 0 1 2 3 4 5 6 7 8 -5 -10 Figure 4: f0 ( x ) 1 ( x 3)( x 6) 5 f1 ( x ) f2 ( x) 4 3 4 ( x 1)( x 6) ( x 1)( x 3) 15 f ( x) f0 ( x) f1 ( x) f2 ( x) 5 This formula f ( x) 2 ( x 3)( x 6) ( x 1)( x 6) ( x 1)( x 3) 8 4 (1 3)(1 6) (3 1)(3 6) (6 1)(6 3) is called the Lagrange formula for the interpolating polynomial and is named after Joseph Louis Lagrange, a famous Italian-born French mathematician. [2]. The idea discussed here can be extended beyond interpolating three points on a curve. When more points are presented in a problem, a polynomial of higher degree is required to fit all the points. The Lagrange formula gives a simple way to construct the polynomial function of higher degree. For instance, the four points ( x0 , y0 ) , ( x1 , y1 ) , ( x2 , y2 ) , and ( x3 , y3 ) will determine a cubic polynomial (assuming that the points do not lie on a line or a parabola). The fourth degree Lagrange interpolating polynomial, f(x) will then be composed of four cubic components f0(x), f1(x), f2(x), and f3(x), each constructed in the comparable way. The result is ( x x )( x x )( x x ) ( x x )( x x )( x x ) f ( x) y0 ( x x 1)( x x2 )( x 3x ) y1 ( x x0)( x x2 )( x x3 ) 0 1 0 2 0 3 1 0 1 2 1 3 ( x x0 )( x x1 )( x x3 ) 2 x0 )( x2 x1 )( x2 x3 ) y2 ( x ( x x )( x x )( x x ) y3 ( x x 0)( x x1 )( x 2x ) . 3 0 3 1 3 2 Notice that, at each of the interpolating points, only one of the four cubic components is not automatically zero and so contributes precisely the associated value of y at each of those points. The other three cubic components must contribute zero at these points. The simplicity of the Lagrange interpolating formula makes it a widely used result. It provides a foundation for the development of methods in numerical integration and differentiation, approximating theory, and numerical solution of differential equations. Consequently, it becomes a very important formula in the interpolation theory of numerical analysis. The idea of the Lagrange’s interpolating formula is often hidden in the derivation of the formula. Many students learn the Lagrange formula in an upper level math course where the formula is usually given and just shown that it satisfies all the given points. But the question that the students often ask (and more often don’t ask, even though it is something they don’t see) is where did the formula come about in the first place. At least, precalculus is a place where the Lagrange formula can be investigated by posting a sequence of what-if questions when we discuss a simple case of curve fitting. It is also a place to foster deep learning of mathematics by 6 using a number of topics together during the investigation. Through our discussion, we touch upon many important concepts at the introductory level of mathematics, for instance, the connection between the real zeros of a polynomial and both its linear factors and the x-intercepts of the graph of the polynomial, the transformations of functions, combining functions, and systems of linear equations. It is a wonderful opportunity for students to see how seemingly unrelated mathematics topics are used collectively to solve a simple question such as fitting a quadratic function to three points. References: [1] S.P. Gordon, F.S. Gordon, A.C. Tucker, and M.J. Siegel, Functioning in the Real World – A Precalculus Experience, 2nd Ed., Pearson, 2004. [2] K.E. Atkinson, An Introduction to Numerical Analysis, 2nd Ed., John Wiley & Sons, New York, NY, 1988. 7