L21-approxSineCosine.mws

Calculus II

Lesson 21: Approximating Sine and Cosine with Power Series

Approximating the sine function

Using Maple's ability to compute limits, it is easy to see how sin(x) behaves for small values of x . We know that sin(0) = 0 , and the limit

> Limit(sin(x), x=0) = limit(sin(x), x=0);

Limit(sin(x),x = 0) = 0

shows that the sine function is continuous at 0. (This should be clear to you from the graph of
y = sin(x) .) The interesting question is: how fast does sin(x) go to 0 as proc (x) options operator, arrow; 0 end proc . We can discover this by comparing sin(x) with various powers of x :

> limit(sin(x)/x, x=0);

1

The meaning of this limit is that sin(x)/x is approximately equal to 1, or sin(x) is approximately equal to x , when x is close to 0. We can check this graphically:

> plot( {sin(x),x}, x=-Pi/2..Pi/2 );

[Maple Plot]

The graph certainly seems to confirm that the line y = x is tangent to the graph of sin(x) at the origin, so the difference between x and sin(x) is very small when x is close to 0. Of course, as x gets larger, the sine graph curves away from the tangent line, so the linear approximation is no longer good. Can we find a better approximation?

Since we know
sin(x) and x are close for small x , let's see how their difference behaves as x goes to 0.

> limit(sin(x) - x, x=0);

0

Unfortunately, this limit doesn't tell us anything we didn't already know. Once again, what we need to find out is how fast sin(x)-x goes to 0: how big (or small) is it for small x ? We compare with powers of x in the same way as before: by dividing.

> limit( (sin(x) - x)/x, x=0 );

0

(If you think about it, you can probably see that this limit still isn't telling us anything new.)

> limit( (sin(x) - x)/x^2, x=0 );

0

(This limit is giving new information: x is apparently a very good approximation to sin(x) for small x .)

> limit( (sin(x) - x)/x^3, x=0 );

-1/6

Aha! The non-zero value of this last limit shows that we have found how quickly sin(x)-x goes to 0 as x goes to 0: it goes about as fast as x^3 . In fact, we now know that sin(x)-x is approximately equal to (-1/6)*x^3 for small x , or that sin(x) is approximately equal to x-x^3/6 . We can check this computation again with a graph.

> p3 := x -> x - x^3/6;

p3 := proc (x) options operator, arrow; x-1/6*x^3 e...

> plot( {sin(x),p3(x)}, x=-Pi/2..Pi/2 );

[Maple Plot]

This looks promising: if you compare it to our earlier graph, you can see that the cubic polynomial p3 stays closer to the graph of sine for longer than the tangent line did. Can we repeat the process and get a better approximation still? We will look at the difference sin(x)-p3(x) , and see how fast it goes to 0. Hopefully, it goes at least as fast (or faster) than x^3 , so we'll start by dividing by x^3 and work up to higher powers.

> limit( (sin(x) - (x - x^3/6))/x^3, x=0 );

0

> limit( (sin(x) - (x - x^3/6))/x^4, x=0 );

0

> limit( (sin(x) - (x - x^3/6))/x^5, x=0 );

1/120

We see that sin(x)-p3(x) behaves like x^5/120 as x goes to 0, so sin(x) is approximately equal to p3(x)+x^5/120 = x-x^3/6+x^5/120 .

> p5 := x -> x - x^3/6 + x^5/120;

p5 := proc (x) options operator, arrow; x-1/6*x^3+1...

> plot( {sin(x),p5(x)}, x=-Pi/2..Pi/2 );

[Maple Plot]

The approximation is now almost perfect over the interval [-Pi/2, Pi/2] , so let's look at it over a longer interval.

> plot( {sin(x),p5(x)}, x=-Pi..Pi, thickness=2 );

[Maple Plot]

We can now see that the approximation is reasonably good out to x = 2 (or -2), but if we wanted to approximate as far as x = Pi we would still need more terms.

>

Question 1

By repeating the procedure illustrated above, find the next two terms in the approximation of sin(x) .

>

Approximating the cosine function

This time, we can start by noting that cos(0) = 1 . This already gives us the linear approximation (tangent line) to cos(x) at x = 0 :

> plot( {cos(x),1}, x=-Pi/2..Pi/2 );

[Maple Plot]

Now we follow the same procedure we did for the sine function: find how fast the difference cos(x)-1 goes to 0.

> limit( cos(x) - 1, x=0 );

0

> limit( (cos(x) - 1)/x, x=0 );

0

> limit( (cos(x) - 1)/x^2, x=0 );

-1/2

We have found a non-zero limit, and so the next approximation:

> p2 := x -> 1 - x^2/2;

p2 := proc (x) options operator, arrow; 1-1/2*x^2 e...

> plot( {cos(x),p2(x)}, x=-Pi/2..Pi/2 );

[Maple Plot]

Now find how fast the difference cos(x)-p2(x) goes to 0:

> limit( (cos(x) - (1 - x^2/2))/x^3, x=0 );

0

> limit( (cos(x) - (1 - x^2/2))/x^4, x=0 );

1/24

> p4 := 1 - x^2/2 + x^4/24;

p4 := 1-1/2*x^2+1/24*x^4

> plot( {cos(x),p4(x)}, x=-Pi/2..Pi/2 );

[Maple Plot]

> plot( {cos(x),p4(x)}, x=-Pi..Pi );

[Maple Plot]

You can see that the polynomial p4 is an excellent approximation over the interval [-Pi/2, Pi/2] , but we will need more terms if we want to approximate over the larger interval [-Pi, Pi] .

Question 2

Find the next 2 approximations to cos(x) .

>

Question 3

What is the pattern of the coefficients in the approximating polynomials for sine and cosine?

>

Question 4

Use your approximating polynomials to guess what the derivatives of the sine and cosine function are. Confirm your guess by differentiating these functions with Maple .