Sin, Cos and All Tat James K. Peterson Department of Biological Sciences and Department of Matematical Sciences Clemson University Marc 9, 2017 Outline Sin, Cos and all tat! A New Power Rule Derivatives of Complicated Tings
Tis lecture will go over some basic material about sin and cos functions. We want to take teir derivatives and so fort. You sould ave been exposed to some trigonometry in ig scool, but even if your past experience wit it was yucky and brief, you ll know enoug to get started. So we will assume you know about sin and cos and teir usual properties. After all, you ave seen tis before! Wat we want to do it someting new wit tem find teir derivatives. So if you are rusty about tese two functions, crack open one of your old texts and refres your mind. We need to find te derivatives of te sin and cos functions. We will do tis indirectly. Look at tis figure. Heigt is sinx) A O Inner Sector x Widt is cosx) B Te circle ere as radius 1 and te angle x determines tree areas: te area of te inner sector, 1 2 cos2 x) x, te area of triangle OAB, 1 2 sinx) and te area of te outer sector, 1 2 x. We see te areas are related by 1 2 cos2 x) x < 1 2 sinx) < 1 2 x.
From it, we can figure out tree important relationsips. from ig scool times, you sould know a number of cool tings about circles. Te one we need is te area of wat is called a sector. Draw a circle of radius r in te plane. Measure an angle x counterclockwise from te orizontal axis. Ten look at te pie saped wedge formed in te circle tat is bounded above by te radial line, below by te orizontal axis and to te side by a piece of te circle. It is easy to see tis in te figure. Looking at te picture, note tere is a first sector or radius cosx) and a larger sector of radius 1. It turns out te area of a sector is 1/2r 2 θ were θ is te angle tat forms te sector. From te picture, te area of te first sector is clearly less tan te area of te second one. So we ave 1/2) cos 2 x) x < 1/2) x Now if you look at te picture again, you ll see a triangle caugt between tese two sectors. Tis is te triangle you get wit two sides aving te radial lengt of 1. Te tird side is te straigt line rigt below te arc of te circle cut out by te angle x. Te area of tis triangle is 1/2) sinx) because te eigt of te triangle is sinx). Tis area is smack dab in te middle of te two sector areas. So we ave 1/2) cos 2 x) x < 1/2) sinx) < 1/2) x. Tese relationsips work for all x and canceling all te 1/2) s, we get cos 2 x) x < sinx) < x. Now as long as x is positive, we can divide to get cos 2 x) < sinx)/x < 1.
Almost done. From our ig scool knowledge about cos, we know it is a very smoot function and as no jumps. So it is continuous everywere and so limx 0 cosx) = 1 since cos0) = 1. If tat is true, ten te limit of te square is 1 2 or still 1. So limx 0 sinx)/x is trapped between te limit of te cos 2 term and te limit of te constant term 1. So we ave to conclude lim sinx)/x = 1. x 0 + We can do te same ting for x 0, so we know limx 0 sinx)/x = 1 Ha you say. Big deal you say. But wat you don t know is te you ave just found te derivative of sin at 0! Note sinx)) 0) = lim 0 sin) sin0) sin) = lim 0 because we know sin0) = 0. Now if limx 0 sinx)/x = 1, it doesn t matter if we switc letters! We also know lim 0 sin)/ = 1. Using tis, we see sinx)) 0) = lim 0 as cos0) = 1! Review, Review...). sin) = 1 = cos0)
Tis result is te key. Consider te more general result sinx)) = lim 0 sinx + ) sinx). Now dredge up anoter bad ig scool memory: te dreaded sin identities. We know and so sinu + v) = sinu) cosv) + cosu) sinv) sinx + ) = sinx) cos) + cosx) sin). Using tis we ave sinx)) = lim 0 Now regroup a bit to get sinx + ) sinx) sinx) cos) + cosx) sin) sinx) = lim 0 sinx) 1 + cos)) + cosx) sin) = lim. 0 1 + cos)) sinx)) = lim sinx) 0 + cosx) sin).
We are about done. Let s rewrite 1 cos))/ by multiplying top and bottom by 1 + cos). Tis gives sinx) 1 + cos)) = sinx) 1 + cos)) = sinx) 1 cos2 )) 1 + cos)) 1 + cos)) 1 1 + cos)). Now 1 cos 2 ) = sin 2 ), so we ave sinx) 1 + cos)) = sinx) sin2 ) = sinx) sin) 1 1 + cos)) sin) 1 + cos). Now sin)/ goes to 1 and sin)/1 + cos)) goes to 0/2 = 0 as goes to zero. So te first term goes to sinx) 1 0 = 0. Since cos0) = 1 and cos is continuous, te first limit is sinx) 0). We also know te second limit is cosx) 1). So we conclude sinx)) = cosx). And all of tis because of a little diagram drawn in Quadrant I for a circle of radius 1 plus some ig scool trigonometry. Wat about cos s derivative? Te easy way to remember tat sin and cos are sifted versions of eac oter. We know cosx) = sinx + π/2). So by te cain rule cosx)) = sinx + π/2)) = cosx + π/2) 1).
Now remember anoter ig scool trigonometry ting. cosu + v) = cosu) cosv) sinu) sinv) and so cosx + π/2) = cosx) cosπ/2) sinx) sinπ/2). We also know sinπ/2) = 1 and cosπ/2) = 0. So we find cosx)) = sinx). Let s summarize: sinx)) = cosx) cosx)) = sinx) And, of course, we can use te cain rule too!! As you can see, in tis class, te fun never stops tat s a reference by te way to an old Styx song...) Example Simple cain rule! Find Solution Tis is easy: sin4t)). sin4t)) = cos4t) 4 = 4 cos4t).
Example Cain rule! Differentiate sin 3 t) Solution Te derivative is sin 3 t) ) = 3 sin 2 t) sin) t) ) = 3 sin 2 t) cost) Example Find sin 3 x 2 + 4)). Solution sin 3 x 2 + 4)) = 3 sin 2 x 2 + 4) cosx 2 + 4) 2x).
Example Cain and product rule Find sin2x) cos3x)). Solution sin2x) cos3x)) = 2 cos2x) cos3x) 3 sin2x) sin3x). Example Quotient rule! Find tanx)). Solution We usually don t simplify our answers, but we will tis time as we are getting a new formula! ) sinx) tanx)) = cosx) = cosx) cosx) sinx) sinx)) cos 2 x) = cos2 x) + sin 2 x) cos 2. x)
Solution Continued): Next, recall cos 2 x) + sin 2 x) = 1 always and so 1 tanx)) = cos 2 x). Now if you remember, 1/cos 2 x) is called sec 2 x). So we ave a new formula: tanx)) = sec 2 x) Now tat we ave more functions to work wit, let s use te cain rule in te special case of a power of a function. We ave used tis already, but now we state it as a teorem. Teorem Power Rule For Functions If f is differentiable at te real number x, ten for any integer p, f p x)) = p f p 1 x) ) f x) Example Differentiate 1 + sin 3 2t)) 4 Solution d dt 1 + sin3 2t)) 4 ) = 4 1 + sin 3 2t)) 3 3 sin 2 2t) cos2t) 2
Let f x) = x 3/7. Ten f x)) 7 = x 3. Let xn x be any sequence converging to x. Ten limn f xn)) 7 = limn x 3 n = x 3. Tus, since te function u 7 is continuous, we ave limn f xn)) 7 = x 3. So, limn f xn)) = f limn xn) = x 3/7. Tis sows f x) = x 3/7 is continuous. A little tougt sows tis argument works for f x) = x p/q for any rational number p/q. Now wat about differentiability? We ave for x 0, f x + ) f x) is not zero and so we can write 3x 2 = d dx f x))7 = lim 0 f x + )) 7 f x)) 7 f x + ) f x) f x + ) f x) Since we know lim 0 f x+))7 f x)) 7 f x+) f x) = 7f x)) 6, te limit we seek is te ratio of two known limits and so f x + ) f x) lim 0 = 3x 2 7f x)) 6 = 3 7 x 4/7. Note tis argument fails for tis next example. We let f x) = { 1, x Q 1, x IR Ten f x)) 2 = 1 wic is differentiable. But we can t write 0 = d dx f x))2 = lim 0 f x + )) 2 f x)) 2 f x + ) f x) because f x + ) f x) is never locally not zero. f x + ) f x)
We will often need to find te derivatives of more interesting tings tan simple polynomials. Finding rate of cange is our mantra now! Let s look at a small example of ow an excitable neuron transforms signals tat come into it into output signals called action potentials. For now, tink of an excitable neuron as a processing node wic accepts inputs x and transforms tem using a processing function we will call σx) into an output y. As we know, neural circuits are built out of tousands of tese processing nodes and we can draw tem as a grap wic sows ow te nodes interact. Look at te simple example in next figure. Figure: A simple neural circuit: 1-2-1
In te picture you ll note tere are four edges connecting te neurons. We ll label tem like tis: E1 2, E1 3, E2 4 and E3 4. Wen an excitable neuron generates an action potential, te action potential is like a signal. Te rest voltage of te cell is about 70 millivolts and if te action potential is generated, te voltage of te cell rises rapidly to about 80 millivolts or so and ten falls back to rest. Te sape of te action potential is like a scripted response to te conditions te neuron sees as te input signal. In many ways, te neuron response is like a digital on and off signal, so many people ave modeled te response as a curve tat rises smootly from 0 te off ) to 1 te on ). Suc a curve looks like te one sown in te figure below. Figure: A Simple Neural Processing Function
Te standard neural processing function as a ig derivative value at 0 and small values on eiter side. You can see tis beavior in te figure below. We can model tis kind of function using many approaces: for example, σx) = 0.51 + tanx)) works and we can also build σ using exponential functions wic we will get to later. Now te action potential from a neuron is fed into te input side of oter neurons and te strengt of tat interaction is modeled by te edge numbers Ei j for our various i and j s. To find te input into a neuron, we take te edges going in and multiply tem by te output of te node te edge is coming from. If we let Y1, Y2, Y3 and Y4 be te outputs of our four neurons, ten if x is te input fed into neuron one, tis is wat appens in our small neural model Y1 = σx) Y2 = σe1 2 Y1) Y3 = σe1 3 Y1) Y4 = σe2 4 Y2 + E3 4 Y3).
Note tat Y4 depends on te initial input x in a complicated way. Here is te recursive cain of calculations. First, plug in for Y2 and Y3 to get Y4 in terms of Y1. ) Y4 = σ E2 4 σe1 2 Y1) + E3 4 σe1 3 Y1). Now plug in for Y1 to see finally ow Y4 depends on x. ) Y4x) = σ E2 4 σ E1 2 σx) + E3 4 σ E1 3 σx)) ). For te randomly cosen edge values E1 2 = 0.11622, E1 3 = 1.42157, E2 4 = 1.17856 and E3 4 = 0.68387, we can calculate te Y4 output for tis model for all x values from 3 to 3 and plot tem. Now negative values correspond to inibition and positive values are excitation. our simple model generates outputs between 0.95 for strong inibition and 0.65 for strong excitation. Probably not realistic! But remember te edge weigts were just cosen randomly and we didn t try to pick tem using realistic biologically based values. We can indeed do better. But you sould see a bit of ow interesting biology can be illuminated by matematics tat comes from tis class! See te next figure.
Figure: Y4 output for our neural model Note tat tis is essentially a σσσ))) series of function compositions! So te idea of a composition of functions is not just some orrible complication matematics courses trow at you. It is really used in biological systems. Note, wile we know very well ow to calculate te derivative of tis monster, Y 4 x) using te cain rule, it requires serious effort and te answer we get is quite messy. Fortunately, over te years, we ave found ways to get te information we need from models like tis witout finding te derivatives by and! Also, just tink, real neural subsystems ave undreds or tousands or more neurons interacting wit a vast number of edge connections. Lots of sigmoid compositions going on! Let s do a bit more ere. We know we can approximate te derivative using a slope term. Here tat is Y4x) = Y4p) + Y 4p)x p) + Ex, p).
since E)/) is small near x too, we can say near x. Y4p + ) Y4p) Y 4p) We can use tis idea to calculate te approximate value of te derivative of Y4 and plot it. As you can see from te figure below, te derivative is not tat large, but it is always negative. Remember, derivatives are rates of cange and looking at te grap of Y4 we see it is always going down, so te derivative sould always be negative. Figure: Y4 s Approximate Derivative Using =.01
Homework 24 24.1 Let f x) = { x, x Q x, x IR Explain wy f x)) 2 is differentiable but f x) is not ever. 24.2 Calculate Y 4 explicitly for our small neural circuit example. ) Y4x) = σ E2 4 σ E1 2 σx) + E3 4 σ E1 3 σx)) ). were σx) = 0.51 + tanx)). Tis is just messy really. It is a bunc of cain rules! Homework 24 f x+) f x ) 24.3 If f is differentiable at x, prove lim 0 2 = f x). f x+) f x ) Hence, 2 is an approximation to f. Hint: We know tere is δ1 and δ2 so tat 0 < < minδ1, δ2) implies f x + ) f x) f x) < ɛ/2, f x ) f x) f x) < ɛ/2 Now use te above wit te add and substract trick below to finis: f x + ) f x ) f x) 2 = f x + ) f x) + f x) f x ) f x) 2 Use your favorite computational tool and generate plots of te true f vs tis approximation for = 0.6, = 0.3 and = 0.1 for f x) = 5x 4 + 3x 2 4x + 7 for te interval [ 2, 2].