Unit 2 · Topic 2.7

Core trig, exponential and log derivatives

Builds on the definition of the derivative, the standard trigonometric limits and the sum rule. 14 minutes.

  1. Example 1Differentiate sine and cosine
  2. Example 2Differentiate exponential functions
  3. Example 3Differentiate logarithmic functions
  4. Example 4Combine and evaluate these derivatives

The power rule and the rules for sums and constant multiples (topics 2.5 and 2.6) differentiate polynomials and other sums of powers of \(x\). This topic finds the derivatives of sine and cosine, of the exponential functions and of the logarithms. Each one comes from the definition of the derivative:

\[f'(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\]

The fraction, called the difference quotient, is the slope of the secant line through the points of the graph at \(x\) and \(x+h\).

Sine and cosine

Two graphs share one x-axis from 0 to 2 pi. The upper graph is y = sin x, green where it rises and red where it falls, with an orange point at x = 1 and its orange tangent line. The lower graph plots the slope of the tangent against x, and an orange bar at x is as tall as the slope there. The lower graph has the shape of the cosine curve. One button turns the curve into y = cos x, and another measures x in degrees.

Figure 1The upper graph is \(y=\sin x\), green where it rises and red where it falls, with the orange tangent at the orange point. Below, the graph of the slope \(y'\) has an orange bar as tall as the slope.

In Figure 1, \(x\) is in radians, and the lower graph plots the slope \(y'\) of the tangent to \(y=\sin x\) at each \(x\). Move the point. The slope is 1 at \(x=0\), 0 at the top of the curve and \(-1\) at \(x=\pi\). The lower graph has the shape of the cosine curve.

To prove that it is the cosine curve, expand \(\sin(x+h)\) with the addition formula \(\sin(x+h)=\sin x\cos h+\cos x\sin h\) from precalculus. The difference quotient splits into two parts:

\[\begin{aligned}&\frac{\sin(x+h)-\sin x}{h}\\&=\sin x\cdot\frac{\cos h-1}{h}+\cos x\cdot\frac{\sin h}{h}\end{aligned}\]

As \(h\) approaches 0, \(x\) stays fixed, so \(\sin x\) and \(\cos x\) are constants. By topic 1.7, \(\frac{\sin h}{h}\) approaches 1 and \(\frac{1-\cos h}{h}\) approaches 0, so \(\frac{\cos h-1}{h}\) approaches 0 too. Both limits are two-sided, so \(h\) may be negative. By the limit laws (topic 1.5), the quotient approaches \(\sin x\cdot 0+\cos x\cdot 1\), so the derivative of \(\sin x\) is \(\cos x\).

The addition formula \(\cos(x+h)=\cos x\cos h-\sin x\sin h\) splits the difference quotient of the cosine in the same way:

\[\begin{aligned}&\frac{\cos(x+h)-\cos x}{h}\\&=\cos x\cdot\frac{\cos h-1}{h}-\sin x\cdot\frac{\sin h}{h}\end{aligned}\]

The same two limits give \(\cos x\cdot 0-\sin x\cdot 1\), so the derivative of \(\cos x\) is \(-\sin x\). Use the first button under Figure 1 to show the cosine curve. From \(x=0\) to \(x=\pi\), it falls and is red, so its slopes are negative there, where \(\sin x\) is positive. The lower graph is the sine curve turned upside down.

The limit \(\frac{\sin h}{h}\to 1\) holds only for \(h\) in radians, so both derivatives need \(x\) in radians. With the sine curve shown, use the second button to measure \(x\) in degrees, which also moves the point to \(x=0\). The upper graph becomes \(y=\sin x^\circ\), which is almost flat on this window, and the lower graph lies almost on the axis. At \(x=0\), the slope is the limit of \(\frac{\sin h^\circ}{h}\), which is \(\frac{\pi}{180}\approx 0.0175\) by topic 1.7, not \(\cos 0=1\).

Exponential functions

The graph of y = a to the power x from x = −2 to 1.5, for a base a that a slider sets, starting at a = 2. The curve is green where it rises and red where it falls. An orange point at x = 1 has an orange tangent line, and an orange bar from the x-axis up to the point shows its height. Numbers under the figure give the height, the slope of the tangent and the slope divided by the height.

Figure 2The curve is \(y=a^x\) for the base \(a\) on the slider, green where it rises and red where it falls. The orange line is the tangent at the orange point, and the orange bar from the axis to the point shows its height.

An exponential function \(a^x\) has a fixed base \(a>0\) and the variable \(x\) in its exponent, so the power rule does not apply to it. The law of exponents \(a^{x+h}=a^x a^h\) factors its difference quotient:

\[\frac{a^{x+h}-a^x}{h}=a^x\cdot\frac{a^h-1}{h}\]

The second factor does not depend on \(x\). Because \(a^0=1\), it is the difference quotient of \(a^x\) at 0. If the graph of \(a^x\) has a tangent line at \((0,1)\), this quotient approaches its slope, the slope of \(a^x\) at 0. The graph does have one, but the proof needs a careful definition of \(a^x\) for irrational \(x\). At every \(x\), the slope of \(a^x\) is therefore its height \(a^x\) times its slope at 0.

Move the point in Figure 2. The slope divided by the height, under the figure, stays the same, and it equals the slope at 0. Change the base with its slider. The ratio is about 0.69 for \(a=2\) and about 1.10 for \(a=3\).

As the base grows from 2 to 3, the slope at 0 grows past 1. The base at which it is exactly 1 is the number \(e\approx 2.71828\), which some books call Euler's number:

\[\lim_{h\to 0}\frac{e^h-1}{h}=1\]

Many books define \(e\) by this limit, and others prove the limit from another definition of \(e\). For the base \(e\), the slope equals the height at every \(x\), so the derivative of the natural exponential function \(e^x\) is \(e^x\). Use the button under Figure 2 to set the base to \(e\), where the ratio is 1.

The natural logarithm \(\ln x\), defined for \(x>0\), is the power of \(e\) that gives \(x\), so \(y=\ln x\) means \(e^y=x\). Every positive base is therefore a power of \(e\), \(a=e^{\ln a}\), so \(a^h=e^{h\ln a}\). For \(a\neq 1\), let \(k=h\ln a\). Then \(a^h-1=e^k-1\) and \(h=\frac{k}{\ln a}\), so

\[\frac{a^h-1}{h}=\ln a\cdot\frac{e^k-1}{k}\]

As \(h\) approaches 0, \(k\) approaches 0, and \(k\) is not 0 when \(h\) is not 0. By the limit that defines \(e\), with \(k\) in place of \(h\), the last quotient approaches 1. The slope of \(a^x\) at 0 is therefore \(\ln a\), and the derivative of \(a^x\) is \(a^x\ln a\). For \(a=1\), the function \(1^x=1\) is constant and \(\ln 1=0\), so the result holds there too. A base between 0 and 1 has \(\ln a<0\), and its curve falls.

Logarithms

The curve y = e to the power x, the curve y = ln x and the faint dashed line y = x, on equal scales. The two curves are mirror images in the dashed line. An orange point on y = ln x at x = 2 has an orange tangent with slope one half, and its mirror point on y = e to the x, at height 2, has an orange tangent with slope 2. Under each tangent, a small triangle has a dashed run and an orange rise, and the reflection swaps the two.

Figure 3The curves \(y=e^x\) and \(y=\ln x\) are mirror images in the faint dashed line \(y=x\), and so are the two orange points and their orange tangents. Under each tangent, a small triangle has a dashed run and an orange rise.

Because \(y=\ln x\) means \(e^y=x\), the graph of \(\ln x\) is the graph of \(e^x\) reflected in the line \(y=x\), which swaps the coordinates of every point. The reflection swaps each rise with its run, so it turns a line of slope \(m\neq 0\) into a line of slope \(\frac{1}{m}\).

Fix \(x>0\) and a step \(h\neq 0\) with \(x+h>0\). Write \(u=\ln x\) and \(w=\ln(x+h)\), so that \(e^u=x\) and \(e^w=x+h\). The secant of \(\ln\) from \(x\) to \(x+h\) is the reflection of the secant of \(e^t\), the exponential with input \(t\), from \(t=u\) to \(t=w\). Its slope is the reciprocal:

\[\frac{\ln(x+h)-\ln x}{h}=\frac{w-u}{e^w-e^u}\]

As \(h\) approaches 0, \(w\) approaches \(u\), because \(\ln\) is continuous (topic 1.12), and \(w\neq u\), because \(\ln\) never takes one value twice. The step \(w-u\) approaches 0 and is not 0, so the slope \(\frac{e^w-e^u}{w-u}\) approaches the slope of \(e^t\) at \(u\), which is \(e^u=x\). Because \(x\neq 0\), the reciprocal approaches \(\frac{1}{x}\) by the quotient law, so the derivative of \(\ln x\) is \(\frac{1}{x}\) for every \(x>0\).

Figure 3 shows the tangents, the limits of these secants. Change the input \(x\) with the slider. At the point on \(y=e^x\), the slope equals the height \(x\). The small triangles swap rise and run, so the slope on \(y=\ln x\) is its reciprocal.

For a base \(a>0\) with \(a\neq 1\), the change of base formula \(\log_a x=\frac{\ln x}{\ln a}\) makes \(\log_a x\) the constant \(\frac{1}{\ln a}\) times \(\ln x\). By the constant multiple rule, its derivative is \(\frac{1}{x\ln a}\), also for \(x>0\).

The sum and constant multiple rules hold for all differentiable functions. They combine these derivatives with each other and with the power rule. For a rate of change at one input, differentiate first. Then substitute the input, which must lie in the domain of every term.

Example 1

Differentiate sine and cosine

Let \(p(x)=\sin x+\cos x\). Find all values of \(x\) in the interval \(0\le x\le 2\pi\) at which the line tangent to the graph of \(p\) is horizontal.

Solution

Sine and cosine are differentiable for every \(x\), in radians. By the sum rule, the derivative is

\[p'(x)=\cos x-\sin x\]

A horizontal tangent has slope 0, so \(\cos x=\sin x\). Where \(\cos x=0\), \(\sin x\) is 1 or \(-1\), so no solution has \(\cos x=0\). Dividing by \(\cos x\) therefore loses no solution, and it gives

\[\tan x=1,\qquad x=\frac{\pi}{4}\ \text{or}\ x=\frac{5\pi}{4}\]

These are the two solutions in the interval, so the tangent line is horizontal at \(x=\frac{\pi}{4}\) and at \(x=\frac{5\pi}{4}\).

Example 2

Differentiate exponential functions

Find an equation of the line tangent to the graph of \(y=3^x\) at \(x=2\).

Solution

The base 3 is positive, so \(3^x\) is differentiable for every \(x\), and its derivative is \(3^x\ln 3\). At \(x=2\), the height of the graph is \(3^2=9\), and the slope is

\[y'(2)=3^2\ln 3=9\ln 3\]

The tangent line passes through \((2,9)\) with this slope:

\[y=9+(9\ln 3)(x-2)\]

Example 3

Differentiate logarithmic functions

Find the slope of the line tangent to the graph of \(y=\log_2 x\) at the point where \(y=3\).

Solution

At the point, \(\log_2 x=3\), so \(x=2^3=8\). The base 2 is positive and not 1, and 8 lies in the domain \(x>0\), so the derivative exists there:

\[\begin{aligned}y'&=\frac{1}{x\ln 2}\\y'(8)&=\frac{1}{8\ln 2}\end{aligned}\]

The slope of the tangent line at \((8,3)\) is \(\frac{1}{8\ln 2}\).

Example 4

Combine and evaluate these derivatives

Let \(g(x)=4\ln x-3\cos x+5\). Find the instantaneous rate of change of \(g\) at \(x=\frac{\pi}{2}\).

Solution

The function \(g\) is defined for \(x>0\), and each of its terms is differentiable there. By the sum and constant multiple rules, each term takes its own rule, and the constant 5 has derivative 0:

\[\begin{aligned}g'(x)&=\frac{4}{x}-3(-\sin x)\\&=\frac{4}{x}+3\sin x\end{aligned}\]

The instantaneous rate of change at \(\frac{\pi}{2}\), which lies in the domain, is \(g'\big(\frac{\pi}{2}\big)\). Because \(\sin\frac{\pi}{2}=1\),

\[g'\Big(\frac{\pi}{2}\Big)=\frac{4}{\pi/2}+3\cdot 1=\frac{8}{\pi}+3\]

The rate is positive, so \(g\) is increasing at \(x=\frac{\pi}{2}\).

Each example is one of the four skills of topic 2.7 in Which & Why: AP Calculus.