Tutorials › AP Calculus › Repeated Derivatives of Trigonometric and Exponential Functions

Higher Derivatives and Motion · Tutorial 223 of 999

Repeated Derivatives of Trigonometric and Exponential Functions

Recognize and use the repeating derivative patterns of trigonometric and exponential functions, and find higher logarithmic derivatives while respecting where each function is defined.

Intermediate 9 min read

What You'll Learn

  • Find successive derivatives of sine and cosine using their four-step cycles.
  • Use the general nth-derivative formulas for sine, cosine, and the natural exponential.
  • Find repeated derivatives of natural and other logarithms.
  • Derive the nth derivative formula for the natural logarithm.
  • Track the domain of logarithmic functions throughout differentiation.
  • Identify and correct common sign, factorial, and domain errors.

Why Repeated Derivatives Have Patterns

A second derivative is the derivative of a derivative; a third derivative is the derivative of the second derivative, and the process can continue. For some familiar functions, this process produces a pattern that repeats or follows a simple formula. Recognizing that pattern is more efficient—and more reliable—than starting every calculation from scratch.

This tutorial focuses on sine, cosine, the natural exponential, and logarithms. The notation \(f^{(n)}(x)\) means the \(n\)th derivative of \(f\), with \(f^{(0)}(x)=f(x)\). In particular, \(f^{(2)}=f''\) and \(f^{(3)}=f'''\). The superscript in \(f^{(n)}\) counts differentiations; it does not mean that the function is raised to a power.

Definition: The \(n\)th derivative of a function is obtained by differentiating \(n\) times, provided each successive derivative exists on the domain under consideration. The zeroth derivative is the original function.

The Four-Step Cycle for Sine and Cosine

Differentiate sine and cosine repeatedly, using the usual derivatives \(\frac{d}{dx}\sin x=\cos x\) and \(\frac{d}{dx}\cos x=-\sin x\). The resulting sequences are:

$$ \begin{aligned} \sin x &\longrightarrow \cos x \longrightarrow -\sin x \longrightarrow -\cos x \longrightarrow \sin x,\\ \cos x &\longrightarrow -\sin x \longrightarrow -\cos x \longrightarrow \sin x \longrightarrow \cos x. \end{aligned} $$

Each sequence returns to its starting function after four differentiations. Thus the derivative depends only on the remainder when \(n\) is divided by \(4\). Equivalently, the pattern can be written as a phase shift:

Theorem: For every nonnegative integer \(n\), $$ \frac{d^n}{dx^n}\sin x=\sin\left(x+\frac{n\pi}{2}\right), \qquad \frac{d^n}{dx^n}\cos x=\cos\left(x+\frac{n\pi}{2}\right). $$

Here \(\frac{d^n}{dx^n}\) denotes taking \(n\) derivatives. The phase-shift formulas agree with the four-step sequences: increasing \(n\) by one shifts the angle by \(\frac{\pi}{2}\), while increasing it by four shifts the angle by \(2\pi\), which leaves sine and cosine unchanged.

Why the Trigonometric Formulas Work

A short induction verifies the sine formula. For \(n=0\), its right-hand side is \(\sin x\), the original function. Suppose the \(n\)th derivative is \(\sin(x+n\pi/2)\). Differentiating that expression gives \(\cos(x+n\pi/2)\). Since \(\cos u=\sin(u+\pi/2)\), the result is \(\sin(x+(n+1)\pi/2)\), which is the claimed formula for the next derivative.

For cosine, the base case \(n=0\) gives \(\cos x\). If its \(n\)th derivative is \(\cos(x+n\pi/2)\), differentiating gives \(-\sin(x+n\pi/2)\). The identity \(-\sin u=\cos(u+\pi/2)\) makes this \(\cos(x+(n+1)\pi/2)\). Thus both formulas hold for every nonnegative integer \(n\). This argument explains why the same four-step pattern continues, rather than merely listing the first few derivatives.

Worked Example: Find the Seventh Derivative of Sine

Find \(\frac{d^7}{dx^7}\sin x\) by following the cycle, then check the result by differentiating it once.

Start with the function and differentiate in order:

$$ \begin{aligned} f(x)&=\sin x,\\ f'(x)&=\cos x,\\ f''(x)&=-\sin x,\\ f'''(x)&=-\cos x,\\ f^{(4)}(x)&=\sin x,\\ f^{(5)}(x)&=\cos x,\\ f^{(6)}(x)&=-\sin x,\\ f^{(7)}(x)&=-\cos x. \end{aligned} $$

The phase-shift formula gives the same result:

$$ \sin\left(x+\frac{7\pi}{2}\right) =\sin\left(x+\frac{3\pi}{2}\right) =-\cos x. $$

For the check, differentiate the proposed seventh derivative: \(\frac{d}{dx}(-\cos x)=\sin x\). This is \(f^{(8)}(x)\), and the cycle also gives \(f^{(8)}(x)=\sin x\), as required.

The Natural Exponential

The natural exponential function is \(e^x\), where \(e\) is the base of the natural logarithm. Its defining derivative property is especially simple: \(\frac{d}{dx}e^x=e^x\). Because each differentiation gives back the same function, no cycle is needed.

Theorem: For every nonnegative integer \(n\), $$ \frac{d^n}{dx^n}e^x=e^x. $$

The result follows by induction as well. For \(n=0\), the expression is \(e^x\). If the \(n\)th derivative is \(e^x\), its derivative is again \(e^x\), proving the formula for \(n+1\).

Worked Example: Find the Sixth Derivative of \(e^x\)

Let \(f(x)=e^x\). Repeatedly applying \(\frac{d}{dx}e^x=e^x\) gives:

$$ \begin{aligned} f'(x)&=e^x,\\ f''(x)&=e^x,\\ f'''(x)&=e^x,\\ f^{(4)}(x)&=e^x,\\ f^{(5)}(x)&=e^x,\\ f^{(6)}(x)&=e^x. \end{aligned} $$

Therefore \(f^{(6)}(x)=e^x\). To check, differentiate the answer: \(\frac{d}{dx}e^x=e^x\), which is \(f^{(7)}(x)\), consistent with the same rule. At \(x=0\), \(f^{(6)}(0)=e^0=1\).

Repeated Derivatives of Logarithms

The natural logarithm \(\ln x\) is defined only for \(x>0\). Its first derivative is \(\frac{d}{dx}\ln x=\frac{1}{x}\), so subsequent derivatives differentiate reciprocal powers. The first few are:

$$ \begin{aligned} \frac{d}{dx}\ln x&=\frac{1}{x},\\ \frac{d^2}{dx^2}\ln x&=-\frac{1}{x^2},\\ \frac{d^3}{dx^3}\ln x&=\frac{2}{x^3},\\ \frac{d^4}{dx^4}\ln x&=-\frac{6}{x^4}. \end{aligned} $$

The signs alternate, the power of \(x\) increases, and the numerator is a factorial. For every integer \(n\geq 1\):

Theorem: For \(x>0\) and every integer \(n\geq 1\), $$ \frac{d^n}{dx^n}\ln x =(-1)^{n-1}\frac{(n-1)!}{x^n}. $$

The domain condition matters: \(\ln x\) and all its derivatives in this formula are being considered for positive \(x\). The factorial is \((n-1)!\), not \(n!\). For example, \(0!=1\), so the formula for \(n=1\) gives \(1/x\), as it should.

Deriving the Logarithm Formula

The formula follows by induction. For \(n=1\), its right-hand side is \((-1)^0(0!)/x=1/x\), which is the derivative of \(\ln x\). Now suppose it holds for some \(n\geq1\). Differentiating the assumed expression gives:

$$ \begin{aligned} \frac{d}{dx}\left((-1)^{n-1}(n-1)!x^{-n}\right) &=(-1)^{n-1}(n-1)!(-n)x^{-n-1}\\ &=(-1)^n n!x^{-(n+1)}\\ &=(-1)^{(n+1)-1}\frac{((n+1)-1)!}{x^{n+1}}. \end{aligned} $$

This is the claimed formula with \(n+1\) in place of \(n\). Since the base case is true and each case implies the next, the formula holds for every integer \(n\geq1\). Throughout, \(x>0\), so \(\ln x\) is defined.

Worked Example: Find the Fourth Derivative of \(\ln(x-2)\)

First determine the domain. The logarithm requires \(x-2>0\), so the function is defined only when \(x>2\). Set \(u=x-2\); then \(du/dx=1\), and successive differentiation gives:

$$ \begin{aligned} f(x)&=\ln(x-2), &&x>2,\\ f'(x)&=\frac{1}{x-2},\\ f''(x)&=-\frac{1}{(x-2)^2},\\ f'''(x)&=\frac{2}{(x-2)^3},\\ f^{(4)}(x)&=-\frac{6}{(x-2)^4}. \end{aligned} $$

The general formula also gives this result: the fourth derivative of \(\ln u\) is \(-6/u^4\), and \(du/dx=1\), so substituting \(u=x-2\) yields \(-6/(x-2)^4\). The domain remains \(x>2\). As a check, differentiating the proposed fourth derivative gives \(24/(x-2)^5\), the fifth derivative obtained by continuing the pattern.

Logarithms with Other Bases and Domains

For a base \(b>0\), \(b\ne1\), the logarithm \(\log_b x\) is defined for \(x>0\) and can be written as \(\ln x/\ln b\). Since \(\ln b\) is a constant, it stays as a factor through every differentiation. Thus, for \(n\geq1\):

$$ \frac{d^n}{dx^n}\log_b x =\frac{1}{\ln b}\frac{d^n}{dx^n}\ln x =\frac{(-1)^{n-1}(n-1)!}{x^n\ln b}, \qquad x>0. $$

Worked Example: Find the Third Derivative of \(\log_2 x\)

The domain is \(x>0\). Rewrite using the natural logarithm, keeping the constant factor:

$$ \log_2 x=\frac{\ln x}{\ln 2}. $$

Differentiate three times:

$$ \begin{aligned} \frac{d}{dx}\log_2 x&=\frac{1}{x\ln 2},\\ \frac{d^2}{dx^2}\log_2 x&=-\frac{1}{x^2\ln 2},\\ \frac{d^3}{dx^3}\log_2 x&=\frac{2}{x^3\ln 2}. \end{aligned} $$

The general formula confirms the result: with \(n=3\), the numerator is \((-1)^2 2!=2\), giving \(2/(x^3\ln2)\). Differentiating that answer yields \(-6/(x^4\ln2)\), the fourth derivative, so the signs and factorial pattern continue correctly. The domain is still \(x>0\).

A Common Mistake: Losing the Sign or the Domain

A common error is to remember that the numerator involves a factorial but to use the wrong one or omit the alternating sign. For example, applying the incorrect rule \(\frac{d^n}{dx^n}\ln x=n!/x^n\) at \(n=2\) would give \(2/x^2\). But differentiating \(\ln x\) twice gives:

$$ \frac{d}{dx}\left(\frac{1}{x}\right) =\frac{d}{dx}(x^{-1}) =-x^{-2} =-\frac{1}{x^2}. $$

The corrected general formula uses \((-1)^{n-1}(n-1)!\), which gives \(-1/x^2\) when \(n=2\). A separate error is to ignore the logarithm's domain. For \(\ln(x-2)\), writing a derivative formula for all real \(x\) is not valid: the original function exists only for \(x>2\). Keep the original domain in view as you differentiate.

Why These Patterns Are Useful

Higher derivatives describe how a function's rates of change themselves vary. The recurring forms here make many derivative calculations predictable: sine and cosine repeat every four differentiations, the natural exponential remains unchanged, and logarithmic derivatives have a systematic sign, power, and factorial pattern. These results are useful both for exact symbolic work and for checking calculations.

A good routine is to identify the function and its domain first, write successive derivatives until the pattern is clear, and then use the general formula if the derivative order is large. For sine and cosine, reducing \(n\) modulo \(4\) quickly identifies the correct cycle entry. For logarithms, checking the first two derivatives is an effective way to catch a missing negative sign or an incorrect factorial.

Check Your Understanding

Use the derivative patterns and state any domain restriction that applies.

  1. Find the fifth derivative of \(\cos x\).
  2. Find the ninth derivative of \(e^x\).
  3. Find the third derivative of \(\ln x\), and state its domain.
  4. Find the second derivative of \(\ln(x+4)\), and state the domain of the original function.
  5. Explain why the numerator in the \(n\)th derivative of \(\ln x\) is \((n-1)!\), rather than \(n!\).

Test yourself: AP Calculus practice exams

Ready to check what you know? Work an AP-style practice exam, then open the full solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers all of AP Calculus AB & BC: full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon