Math Core

Lesson 2.6 · Differentiation: Definition and Basic Rules

Derivatives of sine, cosine, eˣ and ln x

Polynomials aren't the only functions that model the world. Tides, sound waves and seasonal temperatures are periodic; populations and investments grow exponentially; the pH scale and decibels are logarithmic. This lesson gives the derivatives of the four most important non-polynomial functions: sin⁡x\sin x, cos⁡x\cos x, exe^x and ln⁡x\ln x.

Sine and cosine

Look at the graph of y=sin⁡xy = \sin x and think about its slope at each point. At x=0x = 0 it rises steeply, with slope 1. At x=π2x = \dfrac{\pi}{2} it levels off at the top, with slope 0. At x=πx = \pi it falls, with slope −1-1. Plot those slopes and you trace out the cosine curve.

y = sin x and y = cos x. Wherever sin x is steepest, cos x is at its highest or lowest point; wherever sin x levels off, cos x is 0.Open in grapher →

The definition confirms it. Using the identity sin⁡(x+h)=sin⁡xcos⁡h+cos⁡xsin⁡h\sin(x + h) = \sin x \cos h + \cos x \sin h,

sin⁡(x+h)−sin⁡xh=sin⁡x⋅cos⁡h−1h+cos⁡x⋅sin⁡hh\frac{\sin(x + h) - \sin x}{h} = \sin x \cdot \frac{\cos h - 1}{h} + \cos x \cdot \frac{\sin h}{h}

You met the two special limits in Unit 1: lim⁡h→0sin⁡hh=1\displaystyle \lim_{h \to 0} \frac{\sin h}{h} = 1 and lim⁡h→0cos⁡h−1h=0\displaystyle \lim_{h \to 0} \frac{\cos h - 1}{h} = 0. So the whole expression approaches sin⁡x⋅0+cos⁡x⋅1=cos⁡x\sin x \cdot 0 + \cos x \cdot 1 = \cos x. A similar calculation works for cosine.

Derivatives of sine and cosine

ddx[sin⁡x]=cos⁡x,ddx[cos⁡x]=−sin⁡x\frac{d}{dx}[\sin x] = \cos x, \qquad \frac{d}{dx}[\cos x] = -\sin x

Here xx is measured in radians. The formulas are false in degrees.

The minus sign on the derivative of cosine makes sense from the graph: just after x=0x = 0, cos⁡x\cos x is decreasing while sin⁡x\sin x is positive.

The exponential function exe^x

Every exponential function bxb^x has a derivative proportional to itself. The number e≈2.71828e \approx 2.71828 is the one base where the constant of proportionality is exactly 1: it is defined so that

lim⁡h→0eh−1h=1\lim_{h \to 0} \frac{e^h - 1}{h} = 1

With that, the definition of the derivative gives

ddx[ex]=lim⁡h→0ex+h−exh=ex⋅lim⁡h→0eh−1h=ex\frac{d}{dx}\left[e^x\right] = \lim_{h \to 0} \frac{e^{x + h} - e^x}{h} = e^x \cdot \lim_{h \to 0} \frac{e^h - 1}{h} = e^x

So exe^x is its own derivative: at every point, the slope of y=exy = e^x equals its height.

The natural logarithm ln⁡x\ln x

The graph of y=ln⁡xy = \ln x is the reflection of y=exy = e^x across the line y=xy = x. Reflecting swaps rise and run, so a slope of mm on exe^x becomes a slope of 1m\dfrac{1}{m} on ln⁡x\ln x. At the point (x,ln⁡x)(x, \ln x), the matching point on exe^x has height xx and therefore slope xx, so the slope of ln⁡x\ln x is 1x\dfrac{1}{x}. (Unit 3 proves this carefully.)

Derivatives of eˣ and ln x

ddx[ex]=ex,ddx[ln⁡x]=1x(x>0)\frac{d}{dx}\left[e^x\right] = e^x, \qquad \frac{d}{dx}[\ln x] = \frac{1}{x} \quad (x > 0)

All four new rules combine with the sum, difference and constant multiple rules exactly like powers of xx do.

Worked example: Mixing the rules

Differentiate (a) f(x)=3sin⁡x−2cos⁡xf(x) = 3\sin x - 2\cos x and (b) g(x)=4ex−ln⁡x+x2g(x) = 4e^x - \ln x + x^2.

(a) f′(x)=3cos⁡x−2(−sin⁡x)=3cos⁡x+2sin⁡xf'(x) = 3\cos x - 2(-\sin x) = 3\cos x + 2\sin x.

(b) g′(x)=4ex−1x+2xg'(x) = 4e^x - \dfrac{1}{x} + 2x.

Worked example: A tangent line to eˣ

Find the tangent line to y=exy = e^x at x=0x = 0.

The point is (0,e0)=(0,1)(0, e^0) = (0, 1) and the slope is e0=1e^0 = 1. The tangent line is y−1=1(x−0)y - 1 = 1(x - 0), or y=x+1y = x + 1.

y = x + 1 is tangent to y = eˣ at (0, 1).Open in grapher →

Worked example: Recognizing a derivative

Evaluate lim⁡h→0cos⁡(π2+h)−cos⁡π2h\displaystyle \lim_{h \to 0} \frac{\cos\left(\frac{\pi}{2} + h\right) - \cos\frac{\pi}{2}}{h}.

This is the definition of f′(π2)f'\left(\frac{\pi}{2}\right) for f(x)=cos⁡xf(x) = \cos x. Since f′(x)=−sin⁡xf'(x) = -\sin x, the limit equals

−sin⁡π2=−1-\sin\frac{\pi}{2} = -1

Common mistake

Signs on the trig derivatives are the most common slip. Only the cosine derivative gets a minus sign: ddx[cos⁡x]=−sin⁡x\dfrac{d}{dx}[\cos x] = -\sin x, but ddx[sin⁡x]=+cos⁡x\dfrac{d}{dx}[\sin x] = +\cos x. Also, exe^x is not a power function: ddx[ex]≠xex−1\dfrac{d}{dx}\left[e^x\right] \ne x e^{x - 1}.

Tip

Differentiating sine four times brings you back where you started: sin⁡x→cos⁡x→−sin⁡x→−cos⁡x→sin⁡x\sin x \to \cos x \to -\sin x \to -\cos x \to \sin x. If you forget a sign, picture the graphs and check the slope at x=0x = 0.

Practice

Practice 1

Find f′(x)f'(x) for f(x)=5cos⁡x+sin⁡xf(x) = 5\cos x + \sin x.

Enter an expression, e.g. 3x^2 - 2x + 1

Practice 2

Find f′(x)f'(x) for f(x)=2ex−3ln⁡xf(x) = 2e^x - 3\ln x.

Enter an expression, e.g. 3x^2 - 2x + 1

Practice 3

Let f(x)=x3−4sin⁡xf(x) = x^3 - 4\sin x. Find f′(0)f'(0).

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 4

Find the slope of the tangent line to y=ln⁡xy = \ln x at x=5x = 5.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 5

Find an equation of the tangent line to y=sin⁡xy = \sin x at x=πx = \pi.

Enter an expression, e.g. 3x^2 - 2x + 1

Practice 6

lim⁡h→0cos⁡(π3+h)−12h\displaystyle \lim_{h \to 0} \frac{\cos\left(\frac{\pi}{3} + h\right) - \frac{1}{2}}{h} is

Practice 7

Find the value of xx where f(x)=ex−2xf(x) = e^x - 2x has a horizontal tangent line.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 8

How many values of xx in the interval 0≤x≤2π0 \le x \le 2\pi give a horizontal tangent line to f(x)=sin⁡x+cos⁡xf(x) = \sin x + \cos x?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.