Sunday, February 13, 2011

Know your limits

To find the derivative of the sine function, we need to determine two limits. The first is:


lim (h -> 0) sin(h)/h


In the figure, h is the measure of the angle and also the length of the arc of the circle between A and D (in radians). (I'm using h instead of x because ultimately this will be a small change to x, as in x + h).



Kline sets up this inequality:


area OAB < area OAD < area OED

area OAB = (1/2) OB AB
= (1/2) cos(h) sin(h)

area OAD = h/(2π) π 12
= (1/2) h

area OED = (1/2) OD ED
= (1/2) sin(h)/cos(h)


The last result follows since OAB and OED are similar triangles so that ED/OD = AB/OB, and OD = 1. Thus, the inequality becomes:


(1/2) cos(h) sin(h) < (1/2) h < (1/2) sin(h)/cos(h)


As long as we do not actually reach h = 0, we are allowed to divide by sin(h):


cos(h) < h/sin(h) < 1/cos(h)


As h approaches 0, cos(h) and its inverse 1/cos(h) both approach 1 so the ratios h/sin(h) and sin(h)/h both approach 1 as well.

Strang does the first part by extending the segment AB (dotted line) and noting that


2 AB < 2 h
2 sin(h) < 2h
sin(h)/h < 1


The other thing we need is:


lim (h -> 0) (1 - cos(h))/h


Following Strang:


sin2(h) + cos2(h) = 1
sin2(h) = 1 - cos2(h)
= (1 + cos(h)) (1 - cos(h))


Since sin(h) < h (see the figure again):


(1 + cos(h)) (1 - cos(h)) = sin2(h) < h2


Divide by h and also by 1 + cos(h):


(1 - cos(h))/h < h/(1 + cos(h))


Strang says, note that all terms are positive, so that:


0 < (1 - cos(h))/h < h/(1 + cos(h))


Now, as as h -> 0 the right side must go to 0/2 (that is, 0) and our ratio is "caught in the middle."

Here is a simple Python script to calculate the same values. Notice that although 1-cos(h) and h are both approaching 0, h is approaching more slowly, so the ratio tends to the 0 in the limit. First the output:


h 1.0000000000, sin(h) 0.8414709848, h/sin(h) 0.8414709848
h 0.5000000000, sin(h) 0.4794255386, h/sin(h) 0.9588510772
h 0.1666666667, sin(h) 0.1658961327, h/sin(h) 0.9953767962
h 0.0416666667, sin(h) 0.0416546114, h/sin(h) 0.9997106733
h 0.0083333333, sin(h) 0.0083332369, h/sin(h) 0.9999884260
h 0.0013888889, sin(h) 0.0013888884, h/sin(h) 0.9999996785
h 0.0001984127, sin(h) 0.0001984127, h/sin(h) 0.9999999934
h 0.0000248016, sin(h) 0.0000248016, h/sin(h) 0.9999999999
h 0.0000027557, sin(h) 0.0000027557, h/sin(h) 1.0000000000

h 1.0000000000, cos(h) 0.5403023059, (1-cos(h))/h 0.4596976941
h 0.5000000000, cos(h) 0.8775825619, (1-cos(h))/h 0.2448348762
h 0.1666666667, cos(h) 0.9861432316, (1-cos(h))/h 0.0831406106
h 0.0416666667, cos(h) 0.9991320700, (1-cos(h))/h 0.0208303194
h 0.0083333333, cos(h) 0.9999652780, (1-cos(h))/h 0.0041666426
h 0.0013888889, cos(h) 0.9999990355, (1-cos(h))/h 0.0006944443
h 0.0001984127, cos(h) 0.9999999803, (1-cos(h))/h 0.0000992063
h 0.0000248016, cos(h) 0.9999999997, (1-cos(h))/h 0.0000124008
h 0.0000027557, cos(h) 1.0000000000, (1-cos(h))/h 0.0000013779
h 0.0000002756, cos(h) 1.0000000000, (1-cos(h))/h 0.0000001378
h 0.0000000251, cos(h) 1.0000000000, (1-cos(h))/h 0.0000000133
h 0.0000000021, cos(h) 1.0000000000, (1-cos(h))/h 0.0000000000
h 0.0000000002, cos(h) 1.0000000000, (1-cos(h))/h 0.0000000000
h 0.0000000000, cos(h) 1.0000000000, (1-cos(h))/h 0.0000000000


and the listing:


from __future__ import division
from math import sin, cos

h = 1
for i in range(1,10):
h /= i
y = sin(h)
print 'h %3.10f, sin(h) %3.10f, h/sin(h) %3.10f' % (h, y, y/h)

print
h = 1
for i in range(1,15):
h /= i
y = cos(h)
print 'h %3.10f, cos(h) %3.10f, (1-cos(h))/h %3.10f' % (h, y, (1-y)/h)