MAT1193 – 9a Approximating functions with polynomials Most of the applications of the derivative we have been considering use that fact that ‘locally’ around a base point, a very simple function -‐ he tangent line -‐ provides a good approximation to the potentially very complex original function. For example, using the tangent line approximation allowed us to predict the behavior of a discrete time dynamical system near and equilibrium state. While the tangent line can be a good approximation very near a base point, the function will eventually curve away, and the tangent line won’t be such a good approximation. Is there any way to construct an approximation that remains pretty good even further away from the base point? The answer is yes, but there is a cost. The better you want your approximation to be, the more complicated the approximating function becomes. The common way to manage this tradeoff between the accuracy of approximation and the complication of the function is to consider polynomial functions. These are functions consist of sums of increasing powers of x where each power is multiplied by a constant. These constants are known as the c coefficients of the polynomial and the maximal power included is known as the order of the polynomial. For example, the polynomial f(x) = 7-‐3x+14x2-‐πx3 is a third order polynomial (x3 is the highest power of x) with coefficients 7, -‐3, 14, and π. First order poliynomial are linear polynomials and have graphs that are lines. For example, g(a) = 3a-‐13. Second order polynomials are known as quadratic polynomials, and third order polynomials are cubic polynomials. An example of a cubic polynomial is r(z) = -‐z3+23z+1000. (The term ‘quadratic’ traces back to the Latin word for a square, which has four sides.) Lower order polynomials are simpler and can be specified with fewer coefficients. However, they can only approximate functions over a narrow range of values. Higher order polynomials are more complicated functions, but can do a better job of approximating the curvature of complex functions. Here is one example showing successively higher order approximations (dashed) to the main function (solid black). A zoomed in version is shown at the right 1 1st order 2nd order 3rd order 4th order 0.8 0.6 0.3 0.4 0.25 f(x) 0.2 f(x) 1st order 2nd order 3rd order 4th order 0.35 0 0.2 ï0.2 0.15 ï0.4 0.1 ï0.6 0.05 ï0.8 0 ï1 0 0.5 1 1.5 x 2 2.5 3 1 1.1 1.2 1.3 1.4 x 1.5 1.6 1.7 Now suppose we are given a function and we want to approximate that function near some base point that we are interested in (e.g. it is an equilibrium value for a DTDS or for some other reason). To be specific, suppose we want to approximate the function f(x) = ln(x) near the point x0=2. (Note that in the textbook they let a be the value of the base point.) Suppose also that we have chosen the complexity of the polynomial that we are going to use for our approximation, say a cubic approximation. In this section we’ll write the function that approximates f, by putting a ‘hat’ on f: fˆ . (We read that by just saying ‘f hat.’) fˆ (x) = c 0 + c1 x + c 2 x 2 + c 3 x 3 How do w€ e determine the coefficients c0, c1, c2, and c3 that give us the best approximation to the function near that base point? Our overall strategy is pretty simple: € Find a polynomial of the appropriate form that matches the first, second, third, etc. derivatives evaluated at that base point, for as many derivatives as you can. Before jumping in to an example, I’ll introduce one trick that will make our lives much easier. Instead of writing fˆ (x) as a normal polynomial in powers of x, fˆ (x) = c 0 + c1 x + c 2 x 2 + c 3 x 3 we will write fˆ (x) in p€owers of Δx, where Δx is the distance from our base point: Δx = x − x 0 fˆ (x) = c 0 + c1Δx + c 2 Δx 2 + c 3 Δx 3 = c 0 + c1 (x − x 0 ) + c 2 (x − x 0 ) 2 + c 3 (x − x 0 ) 3 € € In doing this, we will get different values of the coefficients, c0, c1, c2, and c3. But if you had to, you could do the algebra to multiply out all the terms like (x-‐x0)3 and derive the coefficients for the polynomial in x from the new coefficients in the polynomial in Δx. But that whole process would get pretty ugly, so we’ll just worry about what happens when we write € fˆ (x) = c 0 + c1 (x − x 0 ) + c 2 (x − x 0 ) 2 + c 3 (x − x 0 ) 3 For our specific example, we would write fˆ (x) = c 0 + c1 (x −1) + c 2 (x −1) 2 + c 3 (x −1) 3 € So we want to match this approximating function to our original function f(x) = ln(x) near the base point x0=1. The most basic thing we can do is to make sure that the approximating function is exactly equal to the original function exactly at the base point: fˆ (x 0 ) = f (x 0 ) . But if x = x0, then Δx=0 and € fˆ (x 0 ) = c 0 + c1 (x 0 − x 0 ) + c 2 (x 0 − x 0 ) 2 + c 3 (x 0 − x 0 ) 3 = c 0 →c 0 = fˆ (x 0 ) € € so now we can write fˆ (x) = f (x 0 ) + c1 (x −1) + c 2 (x −1) 2 + c 3 (x −1) 3 For our specific example € fˆ (1) = c 0 + c1 (1 −1) + c 2 (1 −1) 2 + c 3 (1 −1) 3 = c 0 = ln(1) = 0 so fˆ (x) = 0 + c1 (x −1) + c 2 (x −1) 2 + c 3 (x −1) 3 = c1 (x −1) + c 2 (x −1) 2 + c 3 (x −1) 3 € € Now lets make sure that the first derivative, evaluated at our base point, is the same for our original function and our approximating function. For our original function, f(x) = ln(x) -‐>f’(x) = 1/x and so f’(x0) = f’(1)_=1/1=1. Now let’s take the derivative of our approximating function. Using the sum rule, the power rule, the constant product rule, and the chain rule we find fˆ (x) = f (x 0 ) + c1 (x − x 0 ) + c 2 (x − x 0 ) 2 + c 3 (x − x 0 ) 3 fˆ ʹ′(x) = c + 2c (x − x ) + 3c (x − x ) 2 1 2 0 3 0 fˆ ʹ′(x 0 ) = c1 + 2c 2 (x 0 − x 0 ) + 3c 3 (x 0 − x 0 ) 2 = c1 For our specific example f(x) = ln(x), this works out to be € fˆ (x) = f (x 0 ) + c1 (x −1) + c 2 (x −1) 2 + c 3 (x −1) 3 fˆ ʹ′(x) = c + 2c (x −1) + 3c (x −1) 2 1 2 3 fˆ ʹ′(1) = c1 + 2c 2 (1 −1) + 3c 3 (1 −1) 2 = c1 € € € € Since we want the first derivative to match the original function we have fˆ ʹ′(x 0 ) = c1 = f '(x 0 ) , and for f(x)=ln(x) we have fˆ ʹ′(1) = c1 = f '(1) = 1. We’re making progress and can write our approximation as fˆ (x) = f (x 0 ) + f ʹ′(x 0 )(x − x 0 ) + c 2 (x − x 0 ) 2 + c 3 (x − x 0 ) 3 (in general) € ˆf (x) = (x −1) + c (x −1) 2 + c (x −1) 3 (specific example) 2 3 It is very tempting to just see the pattern here and think that c0=f(x0), c1=f’(x0), c2=f’’(x0), c3=f3(x0), etc. But the would be WRONG! To see this we need to keep taking derivatives. The second derivative is just the derivative of the derivative, so fˆ ʹ′(x) = 2c 2 (x − x 0 ) + 3* c 3 (x − x 0 ) 2 fˆ ʹ′ (x) = 2c + 3* 2 * c (x − x ) (general) 2 fˆ ʹ′ (x 0 ) = 2c 2 € 3 0 To make the second derivative match between our approximation and the original function, we need 2c2=f’’(x0) or c2=f’’(x0) /2. In our specific example f(x) = ln(x) we had f’(x) = 1/x = x-‐1. Applying the power rule, f’’(x) = -‐1*x-‐2= -‐1/x2. Plugging in x0=1, we have f’’(x0) = f’’(1) = -‐1/1 = -‐1. So the approximation is now f ʹ′ (x 0 ) fˆ (x) = f (x 0 ) + f ʹ′(x 0 )(x − x 0 ) + (x − x 0 ) 2 + c 3 (x − x 0 ) 3 (in general) 2 fˆ (x) = (x −1) − (x −1) 2 + c 3 (x −1) 3 (specific example) € € We just have to find c3. So taking another derivative (the third), we have ⎛ f ʹ′ (x 0 ) ⎞ fˆ ʹ′ (x) = 2⎜ ⎟ + 3* 2 * c 3 (x − x 0 ) ⎝ 2 ⎠ ˆf ʹ′ʹ′(x) = 3* 2 * c 3 € To make the third derivative match between our approximation and the original function, we need 3*2*c3=f’’’(x0) or c3=f’’(x0) /(3*2). In terms of our specific example, we had f’’(x) = -‐1/x2=-‐x-‐2, so f’’’(x) = -‐(-‐2)*x-‐3 = 2/x3. Plugging in x0=1, we have f’’’(x0) = f’’’(1) = 2/1 = 2. So the final approximation is f ʹ′ (x 0 ) f ʹ′ʹ′(x 0 ) fˆ (x) = f (x 0 ) + f ʹ′(x 0 )(x − x 0 ) + (x − x 0 ) 2 + (x − x 0 ) 3 (in general) 2 3* 2 € € 2 1 fˆ (x) = (x −1) − (x −1) 2 + (x −1) 3 = (x −1) − (x −1) 2 + (x −1) 3 (specific example) 3* 2 3 Notice that I didn’t multiply out 3*2=6. That was to emphasize what the true pattern is in terms of finding the coefficients for our polynomial approximation. First, notice that when you plug in x = x0 all the other terms dropped out, leaving c1 to be determined by the first derivative, c2 to be determined by the second derivative, etc. Second, each time you take a derivative, the power rule brings down the power out front and then reduces the power by 1. So when you get to the third derivative, you’ve multiplied by 3*2. If we wanted to do a fourth order polynomial approximation, for c4 we need the fourth derivative of the term (x-‐x0)4 and we’d have pulled down the power of 4, the power of 3 and the power of 2, so that c4= f4(x0)/(4*3*2). Therefore, our final formula for approximating a function near a base point x0 with a polynomial function of order n is f ʹ′ (x 0 ) f n (x 0 ) fˆ (x) = f (x 0 ) + f ʹ′(x 0 )(x − x 0 ) + (x − x 0 ) 2 + ...+ (x − x 0 ) n 2 n * (n −1) * ...* 2 *1 € The approximating polynomial of power n is called the nth order Taylor polynomial, named after 18th century mathematician Brook Taylor. One thing to point out is that the 1st order approximation is fˆ (x) = f (x 0 ) + f ʹ′(x 0 )(x − x 0 ) € This is just the point slope form of the tangent line at x0, a line with slope f’(x0) passing through the point (x0,f(x0)). Lets check out how good our approximations are for f(x) = ln(x) near x=1. In particular lets check out the value of the approximation evaluated at x = 1.1.01, 1.1, and 1.5 and 2. We’ll do this for 1st (tangent line), 2nd, 3rd, and 4th order approximations. x 1 1.01 1.1 1.5 2 ln(x) 0 .0100 0.0953 0.4055 0.6931 1st order fˆ (x) 0 .0100 0.1000 0.5000 1.0000 2nd order fˆ (x) 0 .0100 0.0950 0.3750 0.5000 3rd € order fˆ (x) 0 .0100 0.0953 0.4167 0.8333 4th €order fˆ (x) 0 .0100 0.0953 0.4010 0.5833 € €
© Copyright 2026 Paperzz