Thursday, April 8, 2010

Sums of sines and cosines

I just watched a couple of videos from the beginning of MIT's ocw course on Calculus. Prof. David Jerison is really excellent, a worthy successor to Gilbert Strang. He derives the formulas for the derivative of sine and cosine, which we touched on here and here.

The derivation depends on the sum rules for sine and cosine:

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

It occurred to me that I haven't seen these derived before (or don't remember), so I went to look it up in Strang's Calculus. I also found a beautiful graphical proof on the web here. And I found yet another pretty method due to Euler. So I thought it would be a nice topic for a post.

First, Strang's approach. The figure shows two angles, s and t (s is implicit), plus the difference between them, s-t. We use Pythagoras (of course) to calculate the distance between the two points on the unit circle (x1,y1) and (x2,y2).



x1 = cos s
x2 = cos t
y1 = sin s
y2 = sin t

The square of the distance between them is:

d2 = (cos s - cos t)2 + (sin s - sin t)2
= cos2 s - 2 cos s cos t + cos2 t
+ sin2 s - 2 sin s sin t + sin2 t

Adding the sin2 + cos2 terms:

   = 2 - 2 cos s cos t - 2 sin s sin t

Now, look at the same figure but consider the triangle on the right-hand side formed by the angle s-t.


Imagine that we rotate this triangle so it rests on the x-axis. The two points are now:

x1 = cos (s-t)
x2 = 1
y1 = sin (s-t)
y2 = 0

The square of the distance between them is:

d2 = (cos (s-t) - 1)2 + (sin (s-t))2
= cos2 (s-t) - 2 cos (s-t) + 1 + sin2 (s-t)
= 2 - 2 cos (s-t)

But the two calculations are for the same distance, so we can equate them, and after canceling the 2 and multiplying by -1/2, we have

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

To get the formula for the sum, just substitute -t for t everywhere:

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

To get the formula for the sin, remember that sin s = cos (90-s)

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



The geometric proof starts with the figure shown below.



We start with a right triangle with angle s, and inscribe the triangle formed by the angle s+t. The figure is scaled so that the hypotenuse of this second triangle is 1. Then, draw another line perpendicular to the hypotenuse of the first triangle, as shown. Label the complement to s+t as u.


Considering the triangle containing s+t, we note that u is the complement for s+t, and considering the large triangle, then u is the complement for the angle immediately adjacent plus s, so that the adjacent angle is equal to t as shown in the figure.
Simple trigonomtetry allows us to calculate the lengths of three sides as shown in the figure below.



Consider the segment labeled x:

sin t / x = tan s
= sin s / cos s

So

x = sin t cos s / sin s


Finally, using the large triangle:

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

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


Very pretty!


The last method uses Euler's formula:


cos x + i sin x = eix

cos(s+t) + i sin(s+t) = ei(s+t)
= eis eit
= (cos s + i sin s)(cos t + i sin t)
= (cos s cos t - sin s sin t)
+ i(sin s cos t + sin t cos s)


Now, for the magic. We have two complex numbers which are equal, therefore both the real and imaginary parts must be equal! Thus:


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

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


It's two-for-one here.