MATH-100 · Lesson 3 of 5 · 59 min

Differentiation rules

Computing every derivative from the limit definition would be slow and error-prone. Fortunately, a small set of rules lets you differentiate almost any function an engineer will meet: polynomials, products and quotients, compositions, exponentials, logarithms and trigonometric functions. Each rule can be proved from the definition in Lesson 2, and seeing why a rule works makes it much easier to apply correctly.

By the end of this lesson you should be able to differentiate complicated expressions quickly and reliably, choose the right rule for each part of an expression, and handle equations where \(y\) is not given explicitly as a function of \(x\).

The basic rules

Constants and the power rule

A constant never changes, so its derivative is zero: \(\dfrac{d}{dx} c = 0\). For powers of \(x\), the power rule is

\[\frac{d}{dx} x^n = n x^{n-1}\]

It holds for every real exponent \(n\): positive, negative and fractional. You saw three cases in Lesson 2: \(x^2 \to 2x\), \(x^{-1} \to -x^{-2}\) and \(x^{1/2} \to \tfrac12 x^{-1/2}\).

To use the power rule on roots and fractions, first rewrite them as powers. \(\sqrt{x} = x^{1/2}\), \(\sqrt[3]{x^2} = x^{2/3}\), and \(\dfrac{1}{x^3} = x^{-3}\).

Constant multiples, sums and differences

Constants carry through, and derivatives of sums are sums of derivatives:

\[\frac{d}{dx}\big[c\,f(x)\big] = c\,f'(x) \qquad \frac{d}{dx}\big[f(x) \pm g(x)\big] = f'(x) \pm g'(x)\]

Together with the power rule, these let you differentiate any polynomial term by term.

Worked problem

Polynomials and powers

Differentiate \(f(x) = 4x^5 - 3x^2 + 7x - 2\) and \(g(x) = \dfrac{6}{\sqrt{x}}\).

Show solution
  1. Term by term: \(f'(x) = 20x^4 - 6x + 7\). The constant −2 contributes nothing.
  2. Rewrite \(g(x) = 6x^{-1/2}\). Then \(g'(x) = 6 \cdot (-\tfrac12) x^{-3/2} = -3x^{-3/2} = -\dfrac{3}{x\sqrt{x}}\).

Answer: f′(x) = 20x⁴ − 6x + 7 and g′(x) = −3x^(−3/2)

The product rule

The derivative of a product is not the product of the derivatives. Instead:

\[\frac{d}{dx}\big[f(x)\,g(x)\big] = f'(x)\,g(x) + f(x)\,g'(x)\]

In words: derivative of the first times the second, plus the first times derivative of the second.

Why it works: in the difference quotient for \(fg\), add and subtract \(f(x+h)g(x)\) on top:

\[\frac{f(x+h)g(x+h) - f(x)g(x)}{h} = f(x+h)\,\frac{g(x+h) - g(x)}{h} + g(x)\,\frac{f(x+h) - f(x)}{h}\]

As \(h \to 0\), \(f(x+h) \to f(x)\) and the two difference quotients become \(g'(x)\) and \(f'(x)\).

A rectangle gives a physical picture. If a plate has sides \(f\) and \(g\) that are both growing, its area \(A = fg\) grows in two strips: one of width \(f'\) along side \(g\), and one of width \(g'\) along side \(f\). The tiny corner piece shrinks away in the limit.

Worked problem

Product rule

Differentiate \(y = (x^2 + 1)(3x - 5)\), then check by expanding first.

Show solution
  1. Product rule: \(y' = 2x(3x - 5) + (x^2 + 1)(3) = 6x^2 - 10x + 3x^2 + 3 = 9x^2 - 10x + 3\).
  2. Check: \(y = 3x^3 - 5x^2 + 3x - 5\), so \(y' = 9x^2 - 10x + 3\). The answers agree.

Answer: y′ = 9x² − 10x + 3

Worked problem

Product with a trig function

Differentiate \(y = x^2 \sin x\).

Show solution
  1. \(f = x^2\), \(f' = 2x\); \(g = \sin x\), \(g' = \cos x\).
  2. \[y' = 2x\sin x + x^2\cos x\]

Answer: y′ = 2x sin x + x² cos x

The quotient rule

For a quotient:

\[\frac{d}{dx}\left[\frac{f(x)}{g(x)}\right] = \frac{f'(x)\,g(x) - f(x)\,g'(x)}{\big[g(x)\big]^2}\]

The order in the numerator matters because of the minus sign. A common memory aid: "low d-high minus high d-low, over the square of what's below."

Worked problem

Quotient rule

Differentiate \(y = \dfrac{x^2 + 1}{x - 3}\).

Show solution
  1. \(f = x^2 + 1\), \(f' = 2x\); \(g = x - 3\), \(g' = 1\).
  2. \[y' = \frac{2x(x - 3) - (x^2 + 1)(1)}{(x - 3)^2} = \frac{x^2 - 6x - 1}{(x-3)^2}\]

Answer: y′ = (x² − 6x − 1)/(x − 3)²

The chain rule

The chain rule differentiates compositions, functions inside functions, and it is the rule you will use most. If \(y = f(u)\) and \(u = g(x)\), then

\[\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx} \qquad \text{or} \qquad \frac{d}{dx} f\big(g(x)\big) = f'\big(g(x)\big)\,g'(x)\]
Diagram: x goes into the inside function g, giving u, which goes into the outside function f, giving y
Think of a composition as a pipeline. Each stage multiplies the rate of change: if u changes 3 times as fast as x, and y changes 2 times as fast as u, then y changes 6 times as fast as x.

A practical way to apply it: identify the outside function and the inside function. Differentiate the outside, leaving the inside alone, then multiply by the derivative of the inside.

Worked problem

Power of a polynomial

Differentiate \(y = (3x^2 + 1)^5\).

Show solution
  1. Outside: \(u^5\). Inside: \(u = 3x^2 + 1\).
  2. Derivative of outside: \(5u^4 = 5(3x^2 + 1)^4\). Derivative of inside: \(6x\).
  3. \[y' = 5(3x^2+1)^4 \cdot 6x = 30x(3x^2+1)^4\]

Answer: y′ = 30x(3x² + 1)⁴. Expanding first would take far longer

Worked problem

Root and trig compositions

Differentiate \(y = \sqrt{1 + x^2}\) and \(z = \sin(x^2)\).

Show solution
  1. For \(y = (1 + x^2)^{1/2}\): \(y' = \tfrac12(1 + x^2)^{-1/2} \cdot 2x = \dfrac{x}{\sqrt{1 + x^2}}\).
  2. For \(z\): outside \(\sin u\), inside \(x^2\). \(z' = \cos(x^2) \cdot 2x\).

Answer: y′ = x/√(1 + x²) and z′ = 2x cos(x²)

The chain rule applies repeatedly to longer chains. Work from the outside in, multiplying a derivative at each layer.

Worked problem

Three layers

Differentiate \(y = \cos^3(2x)\), which means \(\big[\cos(2x)\big]^3\).

Show solution
  1. Outermost: a cube. Its derivative gives \(3\cos^2(2x)\).
  2. Next layer: cosine. Its derivative gives \(-\sin(2x)\).
  3. Innermost: \(2x\). Its derivative gives 2.
  4. \[y' = 3\cos^2(2x)\cdot\big(-\sin(2x)\big)\cdot 2 = -6\cos^2(2x)\sin(2x)\]

Answer: y′ = −6 cos²(2x) sin(2x)

Worked problem

A chain of physical quantities

A copper winding has resistance \(R = R_0\big[1 + \alpha(T - 20)\big]\), with \(R_0 = 100\ \Omega\) and \(\alpha = 0.0039\) per °C. During start-up its temperature rises as \(T(t) = 20 + 5t\) °C, with \(t\) in minutes. How fast is the resistance changing?

Show solution
  1. Resistance depends on temperature, and temperature depends on time, so use the chain rule: \(\dfrac{dR}{dt} = \dfrac{dR}{dT}\cdot\dfrac{dT}{dt}\).
  2. \(\dfrac{dR}{dT} = R_0\alpha = 100 \times 0.0039 = 0.39\ \Omega\)/°C.
  3. \(\dfrac{dT}{dt} = 5\) °C/min.
  4. \(\dfrac{dR}{dt} = 0.39 \times 5 = 1.95\ \Omega\)/min.

Answer: 1.95 Ω per minute. Notice how the units chain together: (Ω/°C)(°C/min) = Ω/min

Exponential and logarithmic functions

The number \(e \approx 2.71828\) is chosen so that the exponential function is its own derivative:

\[\frac{d}{dx} e^{x} = e^{x} \qquad \frac{d}{dx} \ln x = \frac{1}{x} \quad (x > 0)\]

Combined with the chain rule, these give \(\dfrac{d}{dx} e^{g(x)} = e^{g(x)} g'(x)\) and \(\dfrac{d}{dx}\ln g(x) = \dfrac{g'(x)}{g(x)}\). For other bases, \(\dfrac{d}{dx} a^x = a^x \ln a\) and \(\dfrac{d}{dx}\log_a x = \dfrac{1}{x\ln a}\).

Exponentials describe anything whose rate of change is proportional to its current size: radioactive decay, cooling, charging and discharging capacitors, bacterial growth, and the pressure drop in a draining tank. In each case the derivative brings out the same exponential, multiplied by a rate constant.

Worked problem

Logarithms

Differentiate \(y = \ln(x^2 + 1)\) and \(z = 2^x\).

Show solution
  1. Chain rule with \(\ln u\): \(y' = \dfrac{2x}{x^2 + 1}\).
  2. \(z' = 2^x \ln 2 \approx 0.693 \cdot 2^x\).

Answer: y′ = 2x/(x² + 1) and z′ = 2ˣ ln 2

Worked problem

Charging a capacitor

A 100 μF capacitor charges through a 10 kΩ resistor from a 12 V supply. Its voltage is \(V(t) = 12\left(1 - e^{-t/RC}\right)\). Find the rate of change of voltage and the charging current at \(t = 0\) and \(t = 1\) s.

Show solution
  1. The time constant is \(RC = (10\,000)(100 \times 10^{-6}) = 1\) s.
  2. Differentiate with the chain rule: \(\dfrac{dV}{dt} = 12 \cdot \dfrac{1}{RC} e^{-t/RC} = 12e^{-t}\) V/s.
  3. At \(t = 0\): 12 V/s. At \(t = 1\) s: \(12e^{-1} \approx 4.41\) V/s.
  4. Capacitor current is \(i = C\,\dfrac{dV}{dt}\). At \(t = 0\): \(100 \times 10^{-6} \times 12 = 1.2\) mA. At \(t = 1\) s: about 0.44 mA.

Answer: The current starts at 1.2 mA (= 12 V / 10 kΩ) and decays exponentially, just as circuit theory predicts

Trigonometric functions

With angles in radians, the derivatives of the trigonometric functions are:

\[\frac{d}{dx}\sin x = \cos x \qquad \frac{d}{dx}\cos x = -\sin x \qquad \frac{d}{dx}\tan x = \sec^2 x\]

The first two follow from the definition and the limits \(\dfrac{\sin x}{x} \to 1\) and \(\dfrac{1 - \cos x}{x} \to 0\) from Lesson 1. The third follows from the quotient rule applied to \(\sin x / \cos x\). Others you will occasionally need: \(\dfrac{d}{dx}\sec x = \sec x\tan x\), \(\dfrac{d}{dx}\csc x = -\csc x\cot x\), and \(\dfrac{d}{dx}\cot x = -\csc^2 x\).

These formulas only hold in radians. In degrees an extra factor of \(\pi/180\) appears in every derivative, which is why engineering calculus always uses radians.

Vibrations and oscillations

An object in simple harmonic motion (a mass on a spring, a vibrating machine part, alternating current) has position \(x(t) = A\cos(\omega t)\), where \(A\) is the amplitude and \(\omega\) the angular frequency in rad/s. Differentiating twice with the chain rule:

\[v = \dot{x} = -A\omega\sin(\omega t) \qquad a = \ddot{x} = -A\omega^2\cos(\omega t) = -\omega^2 x\]
Graphs of cos t, −sin t and −cos t: position, velocity and acceleration in simple harmonic motion
Velocity is a quarter cycle ahead of position, and acceleration is exactly opposite to position. Each differentiation multiplies the amplitude by ω.

The result \(a = -\omega^2 x\) is the defining equation of simple harmonic motion: acceleration proportional to displacement and directed back toward equilibrium.

Worked problem

Acceleration of a vibrating part

A machine panel vibrates at 50 Hz with an amplitude of 0.02 mm. Find its peak velocity and peak acceleration.

Show solution
  1. Angular frequency: \(\omega = 2\pi f = 2\pi(50) \approx 314.2\) rad/s. Amplitude: \(A = 2 \times 10^{-5}\) m.
  2. Peak velocity: \(A\omega = (2 \times 10^{-5})(314.2) \approx 6.28 \times 10^{-3}\) m/s, about 6.3 mm/s.
  3. Peak acceleration: \(A\omega^2 = (2 \times 10^{-5})(314.2)^2 \approx 1.97\) m/s², about 0.2 g.

Answer: About 6.3 mm/s and 1.97 m/s². Vibration limits in machinery standards are usually given as velocity, in mm/s

Notice how frequency amplifies the derivatives: velocity scales with \(\omega\) and acceleration with \(\omega^2\). A tiny displacement at high frequency can mean a large acceleration, which is why high-frequency vibration damages bearings and electronics.

Implicit differentiation

Sometimes \(y\) is defined by an equation instead of an explicit formula, such as \(x^2 + y^2 = 25\) for a circle. You can still find \(dy/dx\): differentiate both sides with respect to \(x\), treating \(y\) as a function of \(x\), so every derivative of a \(y\) term picks up a factor \(dy/dx\) by the chain rule. Then solve for \(dy/dx\).

Worked problem

Slope of a circle

Find the slope of the circle \(x^2 + y^2 = 25\) at the point (3, 4).

Show solution
  1. Differentiate both sides: \(2x + 2y\dfrac{dy}{dx} = 0\).
  2. Solve: \(\dfrac{dy}{dx} = -\dfrac{x}{y}\).
  3. At (3, 4): \(\dfrac{dy}{dx} = -\dfrac34\).

Answer: −3/4. The tangent is perpendicular to the radius, which has slope 4/3

Worked problem

A curve that cannot be solved for y

The curve \(x^3 + y^3 = 6xy\) passes through (3, 3). Find its slope there.

Show solution
  1. Differentiate both sides, using the product rule on the right: \(3x^2 + 3y^2 y' = 6y + 6x y'\).
  2. Collect the \(y'\) terms: \(y'(3y^2 - 6x) = 6y - 3x^2\), so \(y' = \dfrac{2y - x^2}{y^2 - 2x}\).
  3. At (3, 3): \(y' = \dfrac{6 - 9}{9 - 6} = -1\).

Answer: −1

Logarithmic differentiation

For functions with variable exponents, or long products and quotients, take the natural logarithm of both sides first, then differentiate implicitly.

Worked problem

A variable exponent

Differentiate \(y = x^x\) for \(x > 0\).

Show solution
  1. Neither the power rule (fixed exponent) nor the exponential rule (fixed base) applies. Take logs: \(\ln y = x\ln x\).
  2. Differentiate: \(\dfrac{y'}{y} = \ln x + x \cdot \dfrac1x = \ln x + 1\).
  3. Multiply by \(y\): \(y' = x^x(\ln x + 1)\).

Answer: y′ = xˣ(ln x + 1)

Inverse trigonometric functions

Implicit differentiation also gives the derivatives of the inverse trig functions, which appear when integrating and in geometry problems:

\[\frac{d}{dx}\arctan x = \frac{1}{1 + x^2} \qquad \frac{d}{dx}\arcsin x = \frac{1}{\sqrt{1 - x^2}}\]

For example, if \(y = \arctan x\), then \(\tan y = x\). Differentiating gives \(\sec^2 y \cdot y' = 1\), so \(y' = \cos^2 y = \dfrac{1}{1 + \tan^2 y} = \dfrac{1}{1 + x^2}\).

Hyperbolic functions and hanging cables

One more family of functions appears often enough in engineering to learn now. The hyperbolic sine and cosine are built from exponentials:

\[\sinh x = \frac{e^{x} - e^{-x}}{2} \qquad \cosh x = \frac{e^{x} + e^{-x}}{2}\]

They share many identities with the trigonometric functions, with a few sign changes; the most useful is \(\cosh^2 x - \sinh^2 x = 1\). Their derivatives follow directly from the exponential rule:

\[\frac{d}{dx}\sinh x = \cosh x \qquad \frac{d}{dx}\cosh x = \sinh x\]

Note there is no minus sign, unlike \(\cos x\). Check it yourself: differentiating \(\tfrac12(e^x + e^{-x})\) gives \(\tfrac12(e^x - e^{-x})\).

A cable or chain hanging freely under its own weight takes the shape of a catenary, \(y = a\cosh(x/a)\), where \(a\) is the ratio of the horizontal tension to the weight per unit length. Power lines, suspension-bridge cables before the deck is hung, and hanging chains all follow this curve. The derivative gives the cable's slope, which determines the direction of the tension at the supports.

Worked problem

Slope of a power line

A transmission line between two towers 60 m apart hangs in the shape \(y = 50\cosh(x/50)\) metres, with \(x\) measured from the lowest point. Find the angle of the cable at a point 20 m from the low point, and the sag at the towers.

Show solution
  1. Slope: \(y' = 50 \cdot \sinh(x/50) \cdot \dfrac{1}{50} = \sinh(x/50)\).
  2. At \(x = 20\): \(y' = \sinh(0.4) \approx 0.411\). The angle is \(\arctan(0.411) \approx 22.3°\).
  3. The towers are at \(x = \pm 30\). Sag: \(y(30) - y(0) = 50\left[\cosh(0.6) - 1\right] \approx 9.27\) m.

Answer: About 22.3° at 20 m from the low point; sag about 9.3 m

Hyperbolic functions also appear in heat transfer through fins, in the deflection of beams on elastic foundations, and in the analysis of long transmission lines.

Choosing the right rule

Most real expressions need several rules at once. Decide what the expression is at its outermost level, apply that rule, and repeat on the pieces.

  • A sum or difference: differentiate term by term.
  • A constant times something: keep the constant and differentiate the rest.
  • A product of two non-constant factors: product rule.
  • A quotient: simplify if you can; otherwise use the quotient rule.
  • A function of something other than plain \(x\): chain rule.
  • A variable in an exponent with a variable base, or a tangled product: logarithmic differentiation.

Worked problem

Several rules together

Differentiate \(y = x^2 e^{-3x}\).

Show solution
  1. At the top level this is a product, so start with the product rule.
  2. Derivative of \(x^2\) is \(2x\). Derivative of \(e^{-3x}\) needs the chain rule: \(-3e^{-3x}\).
  3. \[y' = 2x\,e^{-3x} + x^2(-3e^{-3x}) = x\,e^{-3x}(2 - 3x)\]

Answer: y′ = x e^(−3x)(2 − 3x)

Common mistakes

  • MistakeDifferentiating a product as the product of derivatives: (x² sin x)′ = 2x cos x.

    InsteadUse the product rule: 2x sin x + x² cos x.

  • MistakeForgetting the inner derivative in the chain rule: (sin 5x)′ = cos 5x.

    InsteadMultiply by the derivative of the inside: 5 cos 5x.

  • MistakeReversing the numerator of the quotient rule.

    InsteadIt is f′g − fg′ over g². Getting the order wrong flips the sign of the answer.

  • MistakeApplying the power rule to an exponential: (2ˣ)′ = x·2ˣ⁻¹.

    InsteadThe power rule needs a fixed exponent. For a fixed base, (aˣ)′ = aˣ ln a.

  • MistakeUsing degrees in trigonometric derivatives.

    Insteadsin′ = cos only in radians. Convert angles to radians first.

  • MistakeIn implicit differentiation, treating y as a constant: the derivative of y² written as 0 or 2y.

    Insteady depends on x, so the derivative of y² is 2y·(dy/dx).

Summary and key terms

  • Power rule: (xⁿ)′ = nxⁿ⁻¹ for any real n. Rewrite roots and reciprocals as powers first.
  • Constants factor out, and the derivative of a sum is the sum of the derivatives.
  • Product rule: (fg)′ = f′g + fg′. Quotient rule: (f/g)′ = (f′g − fg′)/g².
  • Chain rule: (f(g(x)))′ = f′(g(x))·g′(x). Work from the outside in, multiplying a derivative at each layer.
  • Exponentials and logarithms: (eˣ)′ = eˣ, (ln x)′ = 1/x, (aˣ)′ = aˣ ln a.
  • Trigonometric functions (radians): (sin x)′ = cos x, (cos x)′ = −sin x, (tan x)′ = sec² x.
  • Implicit differentiation finds dy/dx from an equation in x and y. Logarithmic differentiation handles variable exponents.
Power rule
d/dx xⁿ = nxⁿ⁻¹.
Product rule
d/dx (fg) = f′g + fg′.
Quotient rule
d/dx (f/g) = (f′g − fg′)/g².
Chain rule
d/dx f(g(x)) = f′(g(x))·g′(x), or dy/dx = (dy/du)(du/dx).
Composition
A function applied to the output of another function.
Implicit differentiation
Differentiating both sides of an equation in x and y, treating y as a function of x.
Logarithmic differentiation
Taking ln of both sides before differentiating.
Angular frequency
ω = 2πf, in rad/s.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Differentiate \(y = 3x^4 - \dfrac{2}{x} + 5\sqrt{x}\).

    Show answer

    Rewrite as 3x⁴ − 2x⁻¹ + 5x^(1/2). y′ = 12x³ + 2x⁻² + (5/2)x^(−1/2) = 12x³ + 2/x² + 5/(2√x).

  2. Differentiate \(y = (2x + 1)(x^3 - 4)\) with the product rule.

    Show answer

    y′ = 2(x³ − 4) + (2x + 1)(3x²) = 2x³ − 8 + 6x³ + 3x² = 8x³ + 3x² − 8.

  3. Differentiate \(y = \dfrac{x}{x^2 + 1}\).

    Show answer

    y′ = ((1)(x² + 1) − x(2x))/(x² + 1)² = (1 − x²)/(x² + 1)².

  4. Differentiate \(y = (5 - x^2)^{4}\).

    Show answer

    y′ = 4(5 − x²)³(−2x) = −8x(5 − x²)³.

  5. Differentiate \(y = e^{x^2}\) and \(y = \ln(\cos x)\).

    Show answer

    For e^(x²): 2x e^(x²). For ln(cos x): (−sin x)/(cos x) = −tan x.

  6. Differentiate \(y = \sin^2 x\). Then use the identity \(\sin^2 x = \tfrac12(1 - \cos 2x)\) to check your answer.

    Show answer

    Chain rule: 2 sin x cos x. Using the identity: ½(2 sin 2x) = sin 2x, and sin 2x = 2 sin x cos x. They match.

  7. A mass on a spring has position \(x(t) = 0.05\cos(8t)\) m. Find its velocity and acceleration at \(t = 0.2\) s.

    Show answer

    v = −0.4 sin(8t); at t = 0.2, v = −0.4 sin(1.6) ≈ −0.400 m/s. a = −3.2 cos(8t); a(0.2) = −3.2 cos(1.6) ≈ 0.093 m/s².

  8. Find \(dy/dx\) for \(x^2 + xy + y^2 = 7\), and the slope at (1, 2).

    Show answer

    2x + y + xy′ + 2yy′ = 0, so y′ = −(2x + y)/(x + 2y). At (1, 2): −4/5.

  9. Differentiate \(y = x^{\sin x}\) for \(x > 0\).

    Show answer

    ln y = sin x · ln x, so y′/y = cos x · ln x + (sin x)/x. y′ = x^(sin x) (cos x ln x + sin x / x).

  10. The flow through a valve is \(Q = 0.8\sqrt{p}\) L/s, where the pressure \(p\) (kPa) is rising as \(p(t) = 100 + 4t\) (t in s). How fast is the flow increasing at \(t = 0\)?

    Show answer

    dQ/dt = (0.4/√p)(dp/dt). At t = 0, p = 100, so dQ/dt = (0.4/10)(4) = 0.16 L/s per second.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz