Sign in

Libre University uses your GitHub account. Signing in is only needed to sit a final test, so the score is kept on your profile.

Sines, exponentials and their derivatives

The rules of the previous lesson differentiate anything built from powers by algebra, and neither the sine nor an exponential is built that way, so each has to be taken back to the difference quotient.

What comes out is more interesting than a pair of formulas. The sine calculation only works in radians, and shows why. The exponential calculation produces a constant that depends on the base, and asking which base makes that constant equal to 1 is where the number e comes from, definitionally rather than as a decimal to memorise. This lesson assumes the unit circle definitions of sine and cosine and the exponential and logarithm laws from the earlier course.

Where the difference quotient leads

Apply the definition to f(x)=sinx. The numerator is sin(x+h)-sinx, and the addition formula sin(x+h)=sinxcosh+cosxsinh turns it into sinx(cosh-1)+cosxsinh. Dividing by h and grouping:

sin(x+h)-sinxh=sinxcosh-1h+cosxsinhh

Both bracketed quotients are 0/0 at h=0, and neither factors or rationalises. Neither depends on x, though, which is the important structural fact: two numbers settle the derivative of the sine at every point at once.

Numerically the two limits are not hard to guess. For h=0.001, (sinh)/h=0.99999983 and (1-cosh)/h=0.0005. So the candidates are 1 and 0, giving cosx as the derivative of sinx. Guessing is not proving, and the first of the two needs a genuine argument.

The squeeze that settles sinh/h

Take h between 0 and π/2 and draw the unit circle. Mark the angle h at the centre, and compare three regions: the triangle with vertices at the centre, at the point (1,0) and at the point on the circle; the circular sector between the same two radii; and the triangle formed by extending the radius to meet the tangent line at (1,0).

Each region contains the previous one, so their areas are ordered. The first triangle has base 1 and height sinh, so its area is 12sinh. The sector is the fraction h/2π of the whole disc of area π, so its area is 12h: this is the step that requires h to be measured in radians, since it is the radian measure that makes the arc length and the angle the same number. The outer triangle has base 1 and height tanh, so its area is 12tanh. Therefore

sinh<h<tanh

Divide throughout by sinh, which is positive, to get 1<h/sinh<1/cosh, and invert to get cosh<(sinh)/h<1. As h0 the left bound tends to 1 because cosine is continuous, and the right bound is 1. The squeeze theorem from the limits lesson does the rest:

limh0sinhh=1

The same holds from the negative side, since both sinh and h change sign together and the quotient is unchanged.

The second limit now follows by the conjugate trick. Multiply (1-cosh)/h above and below by 1+cosh: the numerator becomes 1-cos2h=sin2h, so the quotient is sinhhsinh1+cosh. The first factor tends to 1 and the second to 0/2=0, so the limit is 0, confirming the numerical guess.

The radian requirement is not a formality. Measure angles in degrees and the sector area argument gives hπ/360 instead of h/2, so the limit becomes π/180=0.0174533 and the derivative of the sine becomes 0.0174533cosx. That constant would then infest every formula in physics and engineering that involves an oscillation. Radians are used in calculus because they are the units in which this constant is 1.

The derivatives of the trigonometric functions

Substituting the two limits into the grouped difference quotient gives, immediately,

ddxsinx=cosxddxcosx=-sinx

with the second obtained the same way from the addition formula for cosine, and the minus sign coming from cos(x+h)=cosxcosh-sinxsinh.

Differentiating repeatedly cycles with period four: sine goes to cosine, to minus sine, to minus cosine, and back. The consequence is that y=sinx satisfies

y′′=-y

and so does cosx, and so does any combination Asinx+Bcosx. That equation is the mathematical content of simple harmonic motion: a mass on a spring obeys F=-kx, so by Newton's second law its acceleration is proportional to minus its displacement, which is this equation with a constant attached. The reason pendulums, tuning forks, LC circuits and molecular vibrations all produce sinusoids is that they all satisfy it.

The other trigonometric functions follow from the quotient rule. For tanx=sinx/cosx,

ddxtanx=cosxcosx-sinx(-sinx)cos2x=1cos2x=sec2x

which at x=π/4 equals 2, since the cosine there is 1/2. The derivative is never less than 1, matching the graph of the tangent, which rises everywhere and steepens without bound at the asymptotes.

Example. Differentiate f(x)=x2sinx and evaluate at x=π/2.

The product rule gives f(x)=2xsinx+x2cosx. At x=π/2 the sine is 1 and the cosine is 0, so the second term vanishes and the derivative is 2×π/2=π=3.14159.

Now you. Differentiate f(x)=sin(3x2) and evaluate at x=1.

Answer

The chain rule gives f(x)=cos(3x2)6x, which at x=1 is 6cos3=6×(-0.98999)=-5.93995. The value is negative because 3 radians is past the first quarter turn, where the sine is falling.

Where e comes from

Now the exponential. For f(x)=ax with a>0, the difference quotient is

ax+h-axh=axah-1h

using only the index law ax+h=axah. The factor ax is the original function, and the remaining quotient does not involve x at all. So if that limit exists, it is some constant k(a) depending on the base alone, and

ddxax=k(a)ax

This is already a remarkable statement: an exponential is proportional to its own derivative, whatever the base. It is the reason exponentials describe every process whose rate of change is proportional to the amount present, from radioactive decay to compound interest to a population with unlimited food.

The constant is easy to estimate. For a=2, the quotient at h=10-6 is 0.693147; for a=3, it is 1.098612. Neither is 1, and they straddle it, so somewhere between 2 and 3 there is a base for which the constant is exactly 1. Define e to be that base. Then

ddxex=ex

and ex is, up to a constant multiple, the only function that is its own derivative. Its value is e=2.718282, and the earlier course reached the same number from compound interest as the limit of (1+1/n)n, which gives 2.716924 at n=1000 and 2.718280 at n=106. The two descriptions agree, and this one explains why the number keeps appearing: it is selected by a derivative condition, not chosen for convenience.

The constants for other bases are then identified by writing a=elna, so ax=exlna, and the chain rule gives

ddxax=axlna

Compare the numbers: ln2=0.693147 and ln3=1.098612, exactly the two quotients measured above. The mystery constant was the natural logarithm of the base all along.

The derivative of the logarithm

The logarithm can be done directly from the definition, using the limit that defines e. For f(x)=lnx with x>0,

ln(x+h)-lnxh=1hln(1+hx)=1xxhln(1+hx)

Write n=x/h, which grows without bound as h0. The last two factors are nln(1+1/n)=ln[(1+1/n)n], and the bracket tends to e, whose logarithm is 1. So

ddxlnx=1x

This fills a hole left by the power rule. Differentiating xn gives nxn-1, so the derivatives of powers produce every power except x-1: to get it you would need n=0, and that term differentiates to zero instead. The function whose derivative is 1/x is not a power at all, it is the logarithm, and that gap will reappear as the one exception in the integration rules later.

For other bases, logax=lnx/lna, so the derivative is 1/(xlna). Once again the natural base is the one with no stray constant.

Example. Differentiate f(x)=e-2x and evaluate at x=0.5.

The chain rule with inside u=-2x gives f(x)=-2e-2x. At x=0.5 that is -2e-1=-0.735759. The derivative is negative everywhere, as it must be for a decaying quantity, and its magnitude is proportional to the value, which is the defining property of decay.

Now you. Differentiate f(x)=xex and evaluate at x=1.

Answer

The product rule gives f(x)=ex+xex=ex(1+x), which at x=1 is 2e=5.43656.

Decay, and reading a rate off a curve

The formula ddte-λt=-λe-λt is the whole of radioactive dating, and the numbers are worth doing once.

Carbon-14 has a half-life of 5730 years, meaning e-λ×5730=12, so λ=ln2/5730=1.20968×10-4 per year. A sample containing 1012 atoms of carbon-14 therefore decays at an initial rate of λN=1.20968×108 atoms per year, which is about 3.83 decays per second. That rate is directly measurable in a counter, and since the rate is proportional to the amount remaining, counting decays measures the amount, which dates the sample. The derivative is not a theoretical adornment here: it is the quantity the instrument reads.

Example. Caffeine leaves the bloodstream with a half-life of about 5 hours. For a 100 mg dose, find the rate of elimination at t=0 and at t=5 hours.

The decay constant is λ=ln2/5=0.138629 per hour, and the amount is N(t)=100e-λt mg. The rate is N(t)=-λN(t). At t=0 that is -0.138629×100=-13.86 mg per hour. At t=5 hours the amount has halved to 50 mg, so the rate is -6.93 mg per hour, exactly half. The elimination slows in proportion to what is left, which is why the tail of such a curve is so long.

Now you. A drug has a half-life of 8 hours and an initial dose of 250 mg. What is the elimination rate at t=0, and how much remains after 24 hours?

Answer

Here λ=ln2/8=0.0866434 per hour, so the initial rate is -0.0866434×250=-21.66 mg per hour. After 24 hours, three half-lives have passed, so 250/8=31.25 mg remains.

The library, and what it still cannot do

Between the algebraic rules and this lesson, the standard functions are all differentiable by inspection: powers, roots, rational functions, sines and cosines and tangents, exponentials to any base, and logarithms to any base, in any combination assembled by sums, products, quotients and composition.

Two things are still out of reach, and they turn out to be the same thing. Inverse functions have no derivative formula yet: nothing above differentiates arcsinx or arctanx, and the derivative of lnx had to be extracted by a special argument rather than obtained from the exponential it inverts. And curves that are not graphs of functions, such as the circle x2+y2=25, cannot be handled at all, because every technique so far assumes an explicit y=f(x).

One idea fixes both, and it amounts to differentiating an equation rather than a function. That is the next lesson.