Mathematica Lab #3: Linear Approximations
Michael Pelsmajer, February 21, 2012

There will be no lecture on Linear Approiximations, which is covered in Section 3.9 of the textbook.  Instead, we will cover that material in this lab.
Today, you will alternate reading and doing exercises.
Start reading here:

The Linear Approximation to y=f(x) at x=a.  What is it?

Well, you already know how to find the tangent line to y=f(x) at x=a.

	Step 1: Find m=f’(a), the slope.
	Step 2: Find b=f(a).
	Step 3: The tangent line is:	y-b = m(x-a)
		    or, rewritten, it is:	y = m(x-a)+b
				   or:	y = f’(a)(x-a) + f(a)
				   
The Linear Approximation to y=f(x) at x=a is almost the same thing.

It’s the function: 			L(x) = f’(a)(x-a) + f(a)

In other words, 
	if we write the tangent line to y=f(x) at x=a as “y=L(x)”,
	then L(x) is the Linear Approximation to y=f(x) at x=a.

Example with the function x^2 at x=3.

f[x_] := x^2;
L[x_]:=f'[3](x-3)+f[3];

The Linear approximation to (x^2) at x=3 is:

L[x]

which simplifies to 6x - 9.

That is, the Linear Approximation to (x^2) at x=3 is
the function L(x) = 6x - 9.

The tangent line to (x^2) at x=3 is
(the graph of) y = 6x - 9.

Plot[{f[x],L[x]},{x,0,10}]

Exercise 1

(a) Graph the tangent line to f(x) =  (x^3)-(Sqrt[x]) at x = 4 together with the graph of y=f(x).
(b) What is the Linear Approximation to f(x) =  (x^3)-(Sqrt[x]) at x = 4?
(c) Graph the tangent line to f(x) =  (x^3)-(Sqrt[x]) at x = 16 together with the graph of y=f(x).
(d) Find the Linear Approximation to f(x) =  (x^3)-(Sqrt[x]) at x = 16.
(e) Graph the tangent line to (((x-1))^(1/3)) at x = 2.
(f) Find the Linear Approximation to (((x-1))^(1/3)) at x = 2.

If y=L(x) is “essentially” just the tangent line, then what’s the big deal?

The interesting thing is that
	 L(x) ≈ f(x)	(they are approximately equal)
at x-values close to x=a.

Example with the function x^2 at x=3, showing only x-values close to x=3.

f[x_] := x^2;
L[x_]:=f'[3](x-3)+f[3];
Plot[{f[x],L[x]},{x,2.9,3.1}]

Exercise 2

Repeat the three graphs of Exercise 1, but change the visible domain so that it only shows x-values that are close to x=a.

If I asked you to approximate (Sqrt[99]), you might say  (Sqrt[99])≈ (Sqrt[100])=10.

Similarly, you could say that (Sqrt[102])≈ (Sqrt[100])=10.

However, since clearly (Sqrt[99])≠ (Sqrt[102]), we would prefer a more accurate approximation than simply 10.

Since we want to get a better approximation for (Sqrt[99]), (Sqrt[102]), etc.,
what we really want is to approximate (Sqrt[x])at values of x that are close to 100.  (Right?  Do you see?)

This calls for a Linear Approximation to  (Sqrt[x]) at x=100.

f[x_]:=Sqrt[x];
L[x_]:=f'[100](x-100)+f[100];

Since L(x) ≈ (Sqrt[x]) at x-values near 100,  the approximations L(99) and L(102) should be close to (Sqrt[99]) and (Sqrt[102]):

L[99]

L[102]

And how accurate are these approximations to the true values?

N[L[99]-f[99]]

N[L[102]-f[102]]

Very accurate!

Exercise 3

(a) Approximate (Sqrt[24]), (Sqrt[26]), and (Sqrt[24.9])using a Linear Approximation.
     Also, how accurate are the previous approximations?  
(b) Approximate (Sqrt[80])with a Linear Approximation.  
      How accurate is this approximation?
(c) Approximate (((7.03))^20) and (((6.95))^20) with a Linear Approximation.  
     How accurate are the approximations?

Note: For part (b), you will have to think a little bit.  
          For part (c), you will actually need to understand what is going on... if you are confused, start by rereading the example of (Sqrt[99]) and (Sqrt[102])and try to understand it better.  Then ask for help.
Note: All of your approximations should be quite good.  If any one of them is not accurate, then you are making a mistake.

One situation where Linear Approximations are useful is in astronomy.  Since the objects are so far away, when they move, the change in the angle from the earth is tiny.  In other words, the angle x is very close to x=0. 

This can make the study of complicated function involving trigonometric functions, like this one, much simpler:

MrUgly[x_]:= (2Sin[x]Cos[x] -(Cos[x])^2)/(5Cos[x]-Tan[x]+(Sin[x])^2);
MrUgly[x]

Exercise 4

(a) Find linear approximations for sin(x), cos(x), and tan(x) at x=0. (Name these functions “LSin”, “LCos”, “LTan”.)

LSin[x_]=

LCos[x_]=

LTan[x_]=

(b) We will use your approximations to modify the function MrUgly, to get a new function MrLessUgly:

MrLessUgly[x_] := (2LSin[x]LCos[x] -(LCos[x])^2)/(5LCos[x]-LTan[x]+(LSin[x])^2);
MrLessUgly[x]

(c) Compare a few values of MrUgly and MrLessUgly near x=0, and compare to check the accuracy.  (You choose which values!)