Differentiation of Composite Functions

Differentiating composite functions is an essential technique in calculus, and a solid grasp of the chain rule is crucial for solving complicated differentiation problems.

Basic Concepts of Composite Functions

What Is a Composite Function

Composite Function

If the domain of the function y=f(u)y = f(u) contains the range of the function u=g(x)u = g(x), then the function y=f(g(x))y = f(g(x)) is called the composite function of ff and gg.

Notation: y=(f∘g)(x)=f(g(x))y = (f \circ g)(x) = f(g(x))

Examples of Composite Functions

Example 1: y=sin⁡(x2)y = \sin(x^2)

  • Outer function: f(u)=sin⁡uf(u) = \sin u
  • Inner function: g(x)=x2g(x) = x^2
  • Composite function: y=f(g(x))=sin⁡(x2)y = f(g(x)) = \sin(x^2)

Example 2: y=eln⁡xy = e^{\ln x}

  • Outer function: f(u)=euf(u) = e^u
  • Inner function: g(x)=ln⁡xg(x) = \ln x
  • Composite function: y=f(g(x))=eln⁡x=xy = f(g(x)) = e^{\ln x} = x

Chain Rule

The Basic Chain Rule

Chain Rule

If y=f(u)y = f(u) and u=g(x)u = g(x), then

dydx=dydu⋅dudx=f′(u)⋅g′(x)\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx} = f'(u) \cdot g'(x)

Memory aid:

  • Differentiate layer by layer, from the outside in
  • After differentiating each layer, multiply by the derivative of the inner function

Proof outline:

  1. Let y=f(u)y = f(u), u=g(x)u = g(x)
  2. When xx has increment Δx\Delta x, uu has increment Δu=g(x+Δx)−g(x)\Delta u = g(x + \Delta x) - g(x)
  3. Correspondingly, yy has increment Δy=f(u+Δu)−f(u)\Delta y = f(u + \Delta u) - f(u)
  4. As Δx→0\Delta x \to 0, Δu→0\Delta u \to 0, so: dydx=lim⁡Δx→0ΔyΔx=lim⁡Δx→0ΔyΔu⋅ΔuΔx=dydu⋅dudx\frac{dy}{dx} = \lim_{\Delta x \to 0} \frac{\Delta y}{\Delta x} = \lim_{\Delta x \to 0} \frac{\Delta y}{\Delta u} \cdot \frac{\Delta u}{\Delta x} = \frac{dy}{du} \cdot \frac{du}{dx}

Basic examples:

Example 1: Find the derivative of y=sin⁡(x2)y = \sin(x^2)

Solution:

  • Outer layer: f(u)=sin⁡uf(u) = \sin u, f′(u)=cos⁡uf'(u) = \cos u
  • Inner layer: g(x)=x2g(x) = x^2, g′(x)=2xg'(x) = 2x
  • Derivative of the composite function: y′=cos⁡(x2)⋅2x=2xcos⁡(x2)y' = \cos(x^2) \cdot 2x = 2x\cos(x^2)

Example 2: Find the derivative of y=ex3y = e^{x^3}

Solution:

  • Outer layer: f(u)=euf(u) = e^u, f′(u)=euf'(u) = e^u
  • Inner layer: g(x)=x3g(x) = x^3, g′(x)=3x2g'(x) = 3x^2
  • Derivative of the composite function: y′=ex3⋅3x2=3x2ex3y' = e^{x^3} \cdot 3x^2 = 3x^2e^{x^3}

Multi-layer Composite Functions

Three-layer Composite Functions

Differentiating a Three-layer Composite Function
dydx=dydu⋅dudv⋅dvdx=f′(u)⋅g′(v)⋅h′(x)\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dv} \cdot \frac{dv}{dx} = f'(u) \cdot g'(v) \cdot h'(x)

Example 1: Find the derivative of y=sin⁡(ln⁡(x2+1))y = \sin(\ln(x^2 + 1))

Solution:

  • Outermost layer: f(u)=sin⁡uf(u) = \sin u, f′(u)=cos⁡uf'(u) = \cos u
  • Middle layer: g(v)=ln⁡vg(v) = \ln v, g′(v)=1vg'(v) = \frac{1}{v}
  • Innermost layer: h(x)=x2+1h(x) = x^2 + 1, h′(x)=2xh'(x) = 2x
  • Derivative of the composite function: y′=cos⁡(ln⁡(x2+1))⋅1x2+1⋅2x=2xcos⁡(ln⁡(x2+1))x2+1y' = \cos(\ln(x^2 + 1)) \cdot \frac{1}{x^2 + 1} \cdot 2x = \frac{2x\cos(\ln(x^2 + 1))}{x^2 + 1}

Example 2: Find the derivative of y=esin⁡(x3)y = e^{\sin(x^3)}

Solution:

  • Outermost layer: f(u)=euf(u) = e^u, f′(u)=euf'(u) = e^u
  • Middle layer: g(v)=sin⁡vg(v) = \sin v, g′(v)=cos⁡vg'(v) = \cos v
  • Innermost layer: h(x)=x3h(x) = x^3, h′(x)=3x2h'(x) = 3x^2
  • Derivative of the composite function: y′=esin⁡(x3)⋅cos⁡(x3)⋅3x2=3x2cos⁡(x3)esin⁡(x3)y' = e^{\sin(x^3)} \cdot \cos(x^3) \cdot 3x^2 = 3x^2\cos(x^3)e^{\sin(x^3)}

Common Composite Function Differentiation

1. Composition with a Power Function

Differentiating a Power Function Composition
(f(x)n)′=n⋅f(x)n−1⋅f′(x)(f(x)^n)' = n \cdot f(x)^{n-1} \cdot f'(x)

Examples:

  • ((x2+1)3)′=3(x2+1)2⋅2x=6x(x2+1)2((x^2 + 1)^3)' = 3(x^2 + 1)^2 \cdot 2x = 6x(x^2 + 1)^2
  • (sin⁡2x)′=2sin⁡x⋅cos⁡x=sin⁡(2x)(\sin^2 x)' = 2\sin x \cdot \cos x = \sin(2x)

2. Composition with an Exponential Function

Differentiating an Exponential Function Composition
(ef(x))′=ef(x)⋅f′(x)(e^{f(x)})' = e^{f(x)} \cdot f'(x)

Examples:

  • (ex2)′=ex2⋅2x=2xex2(e^{x^2})' = e^{x^2} \cdot 2x = 2xe^{x^2}
  • (esin⁡x)′=esin⁡x⋅cos⁡x(e^{\sin x})' = e^{\sin x} \cdot \cos x

3. Composition with a Logarithmic Function

Differentiating a Logarithmic Function Composition
(ln⁡f(x))′=f′(x)f(x)(\ln f(x))' = \frac{f'(x)}{f(x)}

Examples:

  • (ln⁡(x2+1))′=2xx2+1(\ln(x^2 + 1))' = \frac{2x}{x^2 + 1}
  • (ln⁡∣sin⁡x∣)′=cos⁡xsin⁡x=cot⁡x(\ln|\sin x|)' = \frac{\cos x}{\sin x} = \cot x

4. Composition with a Trigonometric Function

Differentiating a Trigonometric Function Composition
(sin⁡f(x))′=cos⁡f(x)⋅f′(x)(\sin f(x))' = \cos f(x) \cdot f'(x)(cos⁡f(x))′=−sin⁡f(x)⋅f′(x)(\cos f(x))' = -\sin f(x) \cdot f'(x)(tan⁡f(x))′=sec⁡2f(x)⋅f′(x)(\tan f(x))' = \sec^2 f(x) \cdot f'(x)

Examples:

  • (sin⁡(x3))′=cos⁡(x3)⋅3x2=3x2cos⁡(x3)(\sin(x^3))' = \cos(x^3) \cdot 3x^2 = 3x^2\cos(x^3)
  • (cos⁡(ln⁡x))′=−sin⁡(ln⁡x)⋅1x=−sin⁡(ln⁡x)x(\cos(\ln x))' = -\sin(\ln x) \cdot \frac{1}{x} = -\frac{\sin(\ln x)}{x}

5. Composition with an Inverse Trigonometric Function

Differentiating an Inverse Trigonometric Function Composition

(arcsin⁡f(x))′=f′(x)1−f(x)2(\arcsin f(x))' = \frac{f'(x)}{\sqrt{1 - f(x)^2}}

(arccos⁡f(x))′=−f′(x)1−f(x)2(\arccos f(x))' = -\frac{f'(x)}{\sqrt{1 - f(x)^2}}

(arctan⁡f(x))′=f′(x)1+f(x)2(\arctan f(x))' = \frac{f'(x)}{1 + f(x)^2}

Examples:

  • (arcsin⁡(x2))′=2x1−x4(\arcsin(x^2))' = \frac{2x}{\sqrt{1 - x^4}}
  • (arctan⁡(ln⁡x))′=1/x1+(ln⁡x)2=1x(1+(ln⁡x)2)(\arctan(\ln x))' = \frac{1/x}{1 + (\ln x)^2} = \frac{1}{x(1 + (\ln x)^2)}

Exercises

Exercise 1

Find the derivative of f(x)=sin⁡(ex2)f(x) = \sin(e^{x^2}).

derivative calculationdifferentiation rules

Approach: This is a three-layer composite function, so the chain rule has to be applied layer by layer.

Steps:

  1. Outermost layer: f(u)=sin⁡uf(u) = \sin u, f′(u)=cos⁡uf'(u) = \cos u
  2. Middle layer: g(v)=evg(v) = e^v, g′(v)=evg'(v) = e^v
  3. Innermost layer: h(x)=x2h(x) = x^2, h′(x)=2xh'(x) = 2x
  4. Derivative of the composite function: f′(x)=cos⁡(ex2)⋅ex2⋅2x=2xex2cos⁡(ex2)f'(x) = \cos(e^{x^2}) \cdot e^{x^2} \cdot 2x = 2xe^{x^2}\cos(e^{x^2})

Answer: f′(x)=2xex2cos⁡(ex2)f'(x) = 2xe^{x^2}\cos(e^{x^2})

Exercise 2

Find the derivative of f(x)=ln⁡(sin⁡(x3+1))f(x) = \ln(\sin(x^3 + 1)).

derivative calculationdifferentiation rules

Approach: This is a three-layer composite function that composes a logarithmic function with a trigonometric function.

Steps:

  1. Outermost layer: f(u)=ln⁡uf(u) = \ln u, f′(u)=1uf'(u) = \frac{1}{u}
  2. Middle layer: g(v)=sin⁡vg(v) = \sin v, g′(v)=cos⁡vg'(v) = \cos v
  3. Innermost layer: h(x)=x3+1h(x) = x^3 + 1, h′(x)=3x2h'(x) = 3x^2
  4. Derivative of the composite function: f′(x)=1sin⁡(x3+1)⋅cos⁡(x3+1)⋅3x2=3x2cos⁡(x3+1)sin⁡(x3+1)=3x2cot⁡(x3+1)f'(x) = \frac{1}{\sin(x^3 + 1)} \cdot \cos(x^3 + 1) \cdot 3x^2 = \frac{3x^2\cos(x^3 + 1)}{\sin(x^3 + 1)} = 3x^2\cot(x^3 + 1)

Answer: f′(x)=3x2cot⁡(x3+1)f'(x) = 3x^2\cot(x^3 + 1)

Exercise 3

Find the derivative of f(x)=(x2+1)sin⁡xf(x) = (x^2 + 1)^{\sin x}.

derivative calculationdifferentiation rules

Approach: This is a composition with a power function, so the power function derivative formula is needed.

Steps:

  1. Outer layer: f(u)=usin⁡xf(u) = u^{\sin x}, f′(u)=sin⁡x⋅usin⁡x−1f'(u) = \sin x \cdot u^{\sin x - 1}
  2. Inner layer: g(x)=x2+1g(x) = x^2 + 1, g′(x)=2xg'(x) = 2x
  3. Derivative of the composite function: f′(x)=sin⁡x⋅(x2+1)sin⁡x−1⋅2x=2xsin⁡x(x2+1)sin⁡x−1f'(x) = \sin x \cdot (x^2 + 1)^{\sin x - 1} \cdot 2x = 2x\sin x(x^2 + 1)^{\sin x - 1}

Answer: f′(x)=2xsin⁡x(x2+1)sin⁡x−1f'(x) = 2x\sin x(x^2 + 1)^{\sin x - 1}

Exercise 4

Find the derivative of f(x)=arcsin⁡(ln⁡(x2+1))f(x) = \arcsin(\ln(x^2 + 1)).

derivative calculationdifferentiation rules

Approach: This is a three-layer composite function that involves an inverse trigonometric function and a logarithmic function.

Steps:

  1. Outermost layer: f(u)=arcsin⁡uf(u) = \arcsin u, f′(u)=11−u2f'(u) = \frac{1}{\sqrt{1 - u^2}}
  2. Middle layer: g(v)=ln⁡vg(v) = \ln v, g′(v)=1vg'(v) = \frac{1}{v}
  3. Innermost layer: h(x)=x2+1h(x) = x^2 + 1, h′(x)=2xh'(x) = 2x
  4. Derivative of the composite function: f′(x)=11−(ln⁡(x2+1))2⋅1x2+1⋅2x=2x(x2+1)1−(ln⁡(x2+1))2f'(x) = \frac{1}{\sqrt{1 - (\ln(x^2 + 1))^2}} \cdot \frac{1}{x^2 + 1} \cdot 2x = \frac{2x}{(x^2 + 1)\sqrt{1 - (\ln(x^2 + 1))^2}}

Answer: f′(x)=2x(x2+1)1−(ln⁡(x2+1))2f'(x) = \frac{2x}{(x^2 + 1)\sqrt{1 - (\ln(x^2 + 1))^2}}

Exercise 5

Find the derivative of f(x)=esin⁡(ln⁡(x2+1))f(x) = e^{\sin(\ln(x^2 + 1))}.

derivative calculationdifferentiation rules

Approach: This is a four-layer composite function, so the chain rule has to be applied layer by layer.

Steps:

  1. Outermost layer: f(u)=euf(u) = e^u, f′(u)=euf'(u) = e^u
  2. Second layer: g(v)=sin⁡vg(v) = \sin v, g′(v)=cos⁡vg'(v) = \cos v
  3. Third layer: h(w)=ln⁡wh(w) = \ln w, h′(w)=1wh'(w) = \frac{1}{w}
  4. Innermost layer: k(x)=x2+1k(x) = x^2 + 1, k′(x)=2xk'(x) = 2x
  5. Derivative of the composite function: f′(x)=esin⁡(ln⁡(x2+1))⋅cos⁡(ln⁡(x2+1))⋅1x2+1⋅2x=2xcos⁡(ln⁡(x2+1))esin⁡(ln⁡(x2+1))x2+1f'(x) = e^{\sin(\ln(x^2 + 1))} \cdot \cos(\ln(x^2 + 1)) \cdot \frac{1}{x^2 + 1} \cdot 2x = \frac{2x\cos(\ln(x^2 + 1))e^{\sin(\ln(x^2 + 1))}}{x^2 + 1}

Answer: f′(x)=2xcos⁡(ln⁡(x2+1))esin⁡(ln⁡(x2+1))x2+1f'(x) = \frac{2x\cos(\ln(x^2 + 1))e^{\sin(\ln(x^2 + 1))}}{x^2 + 1}

Exercise 6

Suppose f(u)f(u) is differentiable and z=xyf(yx)z=xyf\left(\frac{y}{x}\right). Find ∂z∂x\frac{\partial z}{\partial x}.

derivative calculationdifferentiation rules

Approach: Use the chain rule for composite functions together with the product rule.

Steps:

  1. Let u=yxu=\frac{y}{x}, then z=xyf(u)z=xyf(u)

  2. Differentiate with respect to xx, using the product rule: ∂z∂x=yf(u)+xyf′(u)⋅∂u∂x\frac{\partial z}{\partial x}=yf(u)+xyf'(u)\cdot\frac{\partial u}{\partial x}

  3. Compute ∂u∂x\frac{\partial u}{\partial x}: u=yxu=\frac{y}{x}, so ∂u∂x=−yx2\frac{\partial u}{\partial x}=-\frac{y}{x^2}

  4. Substituting gives: ∂z∂x=yf(yx)+xyf′(yx)⋅(−yx2)\frac{\partial z}{\partial x}=yf\left(\frac{y}{x}\right)+xyf'\left(\frac{y}{x}\right)\cdot\left(-\frac{y}{x^2}\right) =yf(yx)−y2f′(yx)1x=yf\left(\frac{y}{x}\right)-y^2f'\left(\frac{y}{x}\right)\frac{1}{x}

Answer: ∂z∂x=yf(yx)−y2f′(yx)1x\frac{\partial z}{\partial x}=yf\left(\frac{y}{x}\right)-y^2f'\left(\frac{y}{x}\right)\frac{1}{x}

Exercise 7

Suppose the function y=f(x)y=f(x) is determined by the parametric equations {x=2t+∣t∣y=∣t∣sin⁡t\begin{cases}x=2t+|t|\\y=|t|\sin t\end{cases}. Find f′(0)f'(0).

derivative calculationdifferentiation rules

Approach: Use the parametric differentiation formula together with the differentiation of composite functions.

Steps:

  1. When t≥0t\geq0, x=3t,y=tsin⁡tx=3t, y=t\sin t, so y=x3sin⁡x3y=\frac{x}{3}\sin\frac{x}{3}

  2. When t<0t<0, x=t,y=−tsin⁡tx=t, y=-t\sin t, so y=−xsin⁡xy=-x\sin x

  3. Hence f(x)={x3sin⁡x3,x≥0−xsin⁡x,x<0f(x)=\begin{cases}\frac{x}{3}\sin\frac{x}{3}, & x\geq0\\-x\sin x, & x<0\end{cases}

  4. Compute the left derivative: f−′(0)=lim⁡x→0−−xsin⁡x−0x=−lim⁡x→0−sin⁡x=0f'_-(0)=\lim\limits_{x\to0^-}\frac{-x\sin x-0}{x}=-\lim\limits_{x\to0^-}\sin x=0

  5. Compute the right derivative: f+′(0)=lim⁡x→0+x3sin⁡x3−0x=lim⁡x→0+sin⁡x33=0f'_+(0)=\lim\limits_{x\to0^+}\frac{\frac{x}{3}\sin\frac{x}{3}-0}{x}=\lim\limits_{x\to0^+}\frac{\sin\frac{x}{3}}{3}=0

  6. Since the left and right derivatives are equal, f′(0)=0f'(0)=0

Answer: f′(0)=0f'(0)=0

Exercise 8

Given f(x)=∫0xecos⁡tdtf(x)=\int_0^x e^{\cos t}dt, find f′(x)f'(x) and f′′(x)f''(x).

derivative calculationdifferentiation rules

Approach: Use the derivative formula for a function with a variable upper limit together with the differentiation of composite functions.

Steps:

  1. By the derivative formula for a function with a variable upper limit: f′(x)=ecos⁡xf'(x)=e^{\cos x}

  2. Differentiate f′(x)f'(x) once more, using the differentiation of composite functions: let u=cos⁡xu=\cos x, then f′(x)=euf'(x)=e^u

    ddx(eu)=eu⋅dudx=ecos⁡x⋅(−sin⁡x)=−ecos⁡xsin⁡x\frac{d}{dx}(e^u)=e^u\cdot\frac{du}{dx}=e^{\cos x}\cdot(-\sin x)=-e^{\cos x}\sin x

Answer: f′(x)=ecos⁡xf'(x)=e^{\cos x} f′′(x)=−ecos⁡xsin⁡xf''(x)=-e^{\cos x}\sin x

Exercise 9

Given f(x)=∫0xet2sin⁡t dtf(x) = \int_0^x e^{t^2} \sin t\,dt, find f′(x)f'(x) and f′′(x)f''(x).

derivative calculationdifferentiation rules

Approach: Use the derivative formula for a function with a variable upper limit together with the differentiation of composite functions.

Steps:

  1. By the derivative formula for a function with a variable upper limit: f′(x)=ex2sin⁡xf'(x) = e^{x^2} \sin x

  2. Differentiate f′(x)f'(x) once more, using the product rule and the differentiation of composite functions: let u=ex2u = e^{x^2}, v=sin⁡xv = \sin x

    u′=ex2⋅2x=2xex2u' = e^{x^2} \cdot 2x = 2x e^{x^2} (differentiation of a composite function) v′=cos⁡xv' = \cos x

  3. Apply the product rule: f′′(x)=u′v+uv′=2xex2⋅sin⁡x+ex2⋅cos⁡xf''(x) = u'v + uv' = 2x e^{x^2} \cdot \sin x + e^{x^2} \cdot \cos x =2xex2sin⁡x+ex2cos⁡x= 2x e^{x^2} \sin x + e^{x^2} \cos x

Answer: f′(x)=ex2sin⁡xf'(x) = e^{x^2} \sin x f′′(x)=2xex2sin⁡x+ex2cos⁡xf''(x) = 2x e^{x^2} \sin x + e^{x^2} \cos x

Exercise 10

Suppose y=y(x)y=y(x) satisfies y′+12xy=2+xy'+\frac{1}{2\sqrt{x}}y=2+\sqrt{x} with y(1)=3y(1)=3. Find an expression for y(x)y(x).

derivative calculationdifferentiation rules

Approach: Use the method for solving a first-order linear differential equation.

Steps:

  1. This is a first-order linear differential equation: y′+12xy=2+xy'+\frac{1}{2\sqrt{x}}y=2+\sqrt{x}

  2. Integrating factor: μ(x)=e∫12xdx=ex\mu(x)=e^{\int\frac{1}{2\sqrt{x}}dx}=e^{\sqrt{x}}

  3. Multiply both sides of the equation by the integrating factor: exy′+ex12xy=(2+x)exe^{\sqrt{x}}y'+e^{\sqrt{x}}\frac{1}{2\sqrt{x}}y=(2+\sqrt{x})e^{\sqrt{x}}

  4. The left-hand side can be written as: (exy)′=(2+x)ex(e^{\sqrt{x}}y)'=(2+\sqrt{x})e^{\sqrt{x}}

  5. Integrating gives: exy=∫(2+x)exdxe^{\sqrt{x}}y=\int(2+\sqrt{x})e^{\sqrt{x}}dx

  6. Evaluate the integral: ∫(2+x)exdx=2∫exdx+∫xexdx\int(2+\sqrt{x})e^{\sqrt{x}}dx=2\int e^{\sqrt{x}}dx+\int\sqrt{x}e^{\sqrt{x}}dx

  7. Let u=xu=\sqrt{x}, so dx=2ududx=2udu and the integral becomes: 2∫eu⋅2udu+∫ueu⋅2udu=4∫ueudu+2∫u2eudu2\int e^u\cdot2udu+\int ue^u\cdot2udu=4\int ue^udu+2\int u^2e^udu

  8. Solve with integration by parts; in the end we get: y(x)=e−x(2xex+C)y(x)=e^{-\sqrt{x}}\left(2x e^{\sqrt{x}}+C\right)

  9. From y(1)=3y(1)=3 we get C=eC=e, so: y(x)=e−x(2xex+e)y(x)=e^{-\sqrt{x}}\left(2x e^{\sqrt{x}}+e\right)

Answer: y(x)=e−x(2xex+e)y(x)=e^{-\sqrt{x}}\left(2x e^{\sqrt{x}}+e\right)


Summary

Symbols Used in This Article

SymbolTypePronunciation/ExplanationMeaning in This Article
f(g(x))f(g(x))Mathematical symbolf of g of xThe composite function built from the outer function ff and the inner function gg
(f∘g)(x)(f \circ g)(x)Mathematical symbolf circle g of xThe composition notation given for the composite function
uuMathematical symboluThe intermediate variable standing between the outer and the inner function
vvMathematical symbolvThe middle-layer variable of the three-layer decomposition
Δx\Delta xMathematical symboldelta xThe increment of the independent variable in the proof outline of the chain rule
Δu\Delta uMathematical symboldelta uThe increment of the intermediate variable, with Δu→0\Delta u \to 0 as Δx→0\Delta x \to 0
Δy\Delta yMathematical symboldelta yThe increment of the outer function, the numerator of the difference quotient
f′(u)f'(u)Mathematical symbolf prime of uThe derivative of the outer function, evaluated at the intermediate variable
g′(x)g'(x)Mathematical symbolg prime of xThe derivative of the inner function with respect to the independent variable
dydu⋅dudx\frac{dy}{du} \cdot \frac{du}{dx}Mathematical symbold y over d u times d u over d xThe chain rule in differential form, one layer factor at a time

Found an issue with this content?

Tell us what could be improved.