It is often convenient to approximate a complicated function using a simpler function. The "simpler" function is often a polynomial. The simplest polynomial is a straight line (degree 1). Approximating a function with a linear function is called linearization (or linear approximation). Approximating a function with a degree 2 polynomial (a parabola) is called quadratic approximation. We will discuss these two approximation methods today, and we'll save approximation with higher degree polynomials for Calculus 2.
Of course, it's kind of silly to do linear or quadratic approximation with the computer, since the computer can do much more accurate approximations of these functions. The point of this lab is to see just how accurate these simple approximations can be.
As we have seen several times this semester, differentiable functions are "close to" their tangent lines near the point of tangency. This means that we can approximate any differentiable function with a tangent line (at least over a small interval).
Let's start with a relatively simple example.
Suppose we want to approximate without a computer or calculator. The cube root function is complicated (at least by hand), so we'll approximate the cube root with a simple linear function, a tangent line.
What point of tangency do we choose? There are two requirements:
The x-coordinate needs to be close to 28, since our approximation only works close to the point of tangency.
It needs to be simple to compute the function value at this x-coordinate (this is the y-coordinate of the point of tangency, and we don't want to approximate this).
For this example, we will choose the tangent line at . This value is fairly close to 28, and it is easy to compute (27 is a perfect cube).
Now let's compute the tangent line and use this line to approximate .
First, define the function we're trying to approximate:
Find the derivative:
Now we need to find to get the slope of the tangent line. If is simple to compute, then is probably simple to compute as well.
In this case, , so .
Find an equation for the tangent line:
Just to check our work, let's graph and near . [Of course, if we were actually doing approximation by hand, we wouldn't do this step.]
As we expected, the tangent line is close to the graph of near .
Now let's use the tangent line to approximate .
The tangent line has equation . Since (near ), we have .
Compare this to Sage's approximation of :
Our approximation is off by about , for a percent error of around .
Note: percent error
Suppose we would like to find as well?
Since 29 is still fairly close to 27, we can use the same tangent line to get a linear approximation:
Sage gives us .
This gives a percent error of about
This linear approximation is only good when is close to 27.
Here is a graph of the percent error versus . You can see that the error increases as you move away from 27.
Even 7 units away from 27 (in either direction), the error is less than 1%. Not bad for an approximation that you could easily do on a napkin over lunch!
Now let's use linear approximation to estimate . This is not one of the exact values we learned in precalc, but is not too far from , and we recall from precalc that . So we'll use as our point of tangency.
For this example, we'll let Sage do all the work, but it could be done by hand without too much trouble.
Our approximation is off by about .
To check our work, here's a graph of and near .
Here's a graph of the percent error. You can see that it's much worse than our cube root example above.
Just out of curiosity, would would happen if we chose the tangent line at ? This is close to and we know the exact value of as well.
I'll just cut and paste the input from above. The only thing I need to change is x_tangent.
Now I'm off by about . This is not surprising, since is further away from than .
Suppose we have a function and its tangent line at the point .
Recall, an equation of the tangent line is . The derivative of is the constant (the derivative of a linear function is a constant, equal to its slope). In other words, at the point , the functions and have the same derivative (or slope). [The point of the tangent line in the first place was to find the slope of at the point of tangency.] A linear function is completely determined by two pieces of information, in this case (1) the point of tangency, and (2) the slope.
To do quadratic approximation, we want to find a "tangent parabola" for our function at the point . A quadratic function is determined by three pieces of information. Once again we will use the point of tangency and the slope, but we need one more. The key idea is to use the second derivative. Just like and have the same first derivative at , we will choose our tangent parabola so that it has the same first and second derivatives as at .
Let's call our quadratic function , for some constants , , and . Our goal is to find , , and so that is "close to" near the point .
[Using instead of just will make our calculations easier. Note the presence of in the tangent line formula as well.]
Note the following facts:
, so .
So, if and are to have the same (1) function value, (2) first derivative, and (3) second derivative at , we need , , and .
Therefore, an equation for the "tangent parabola" is
[Notice the equation for the tangent line within this formula. The tangent parabola extends the tangent line with a degree-2 term.]
Use quadratic approximation to estimate .
Solution: The function we are trying to approximate is the cube root function, so . Just like in Example 1 above, we will use as our point of tangency (because is easy to compute).
We want to find the "tangent parabola" .
We need , , and .
Now we can approximate
Compare this to the tangent line approximation from Example 1:
and the approximation from Sage:
This quadratic approximation gives us a percent error of about (compared with from linear approximation).
Let's look at a graph. The cube root function is in blue, the tangent parabola is in red, and the tangent line is in green.
Notice how much farther we can get from 27 before the approximation breaks down (compared with the tangent line).
Below is the graph of the percent error for quadratic approximation. Remember that the tangent line had percent errors less than for the same range of x-values - now we have percent errors less than .
Use quadratic approximation to estimate . Use as the point of tangency, as in Example 2 above.
Compare this percent error with the we got from linear approximation.
Here's a graph.
Here's the percent error graph. Recall, we had errors over 30% with the tangent line.
The next step would be cubic approximation. To get a cubic, we need one more piece of information. We'll make the third derivative of our "tangent cubic" equal to the third derivative of at . You can continue this process as many times as you like to get a polynomial of any degree. We'll come back to this in Calculus 2.