Sunday, August 30, 2009

Slope of the sine curve

In another post about representing the sine and cosine as infinite series, I tried to show how the series form easily demonstrates the correctness of the derivatives of these functions, that if

y = sin(x)
dy/dx = cos(x)

y = cos(x)
dy/dx = -sin(x)

But unfortunately this argument is circular (I think), since the series comes from a Taylor series, which is generated using the first derivative (and the second, third and more derivatives as well).

In this post, I want to do two things. Strang has a nice picture which makes clear the relationship between position on the unit circle and speed. This is it:

The triangles for velocity and position are similar, just rotated by π / 2.

It is clear from the diagram that at any point, the y-component of the velocity is cos(t), while the y-position is sin(t). Thus, the rate of change of sin(t) is cos(t). This is the result we've been seeking. Similarly, the rate of change of the x-position, cos(t), is -sin(t).

Strang also derives this result more rigorously starting on p. 64. That derivation is a bit complicated, although not too bad, and I won't follow the whole thing here. It uses his standard approach as follows:

dy / dx = lim(h -> 0) [sin(x + h) - sin(x)] / h

Applying a result found using just the Pythagorean theorem earlier (p. 31) for sin (s + t):

sin(s + t) = sin(s) cos(t) + cos(s) sin(t)
cos(s + t) = cos(s) cos(t) - sin(s) sin(t)

He comes up with this expression for:

Δy / Δx = sin x [cos(h) - 1 / h] + cos x (sin h / h)

The problem is then to determine what happens to these two expressions in the limit as h -> 0. The first one is more interesting. As h gets small, | cos(h)-1 | gets smaller like h2, so the ratio goes to 0.

R can help us see better.

h = 1
for (i in 1:6) {
h = h/10
print (h)
print (cos(h)-1) }

[1] 0.1
[1] -0.004995835
[1] 0.01
[1] -4.999958e-05
[1] 0.001
[1] -5e-07
[1] 1e-04
[1] -5e-09
[1] 1e-05
[1] -5e-11
[1] 1e-06
[1] -5.000445e-13

Here is the plot for the second one, which converges to 1, leaving us with simply cos(x):

f<-function(x) { x }