CLASS 12

Derivatives and Differentiation

Master the rules of differentiation — power rule, chain rule, product and quotient rules — with solved examples and LaTeX-rendered formulas.

4 min readSeptember 5, 2024

What is a Derivative?

The derivative of a function f(x)f(x) measures the instantaneous rate of change of the function with respect to xx. Geometrically, it equals the slope of the tangent line to the curve at a given point.

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

This limit is called the first principles definition of a derivative.

Notation

Several notations are used interchangeably:

| Notation | Meaning | |----------|---------| | f(x)f'(x) | Derivative of ff with respect to xx | | dydx\dfrac{dy}{dx} | Leibniz notation | | y˙\dot{y} | Newton's dot notation (common in physics) | | DxfD_x f | Operator notation |

Fundamental Differentiation Rules

Power Rule

For any real number nn:

ddx[xn]=nxn1\frac{d}{dx}[x^n] = n \cdot x^{n-1}

Examples:

  • ddx[x3]=3x2\frac{d}{dx}[x^3] = 3x^2
  • ddx[x1/2]=12x1/2=12x\frac{d}{dx}[x^{1/2}] = \frac{1}{2}x^{-1/2} = \frac{1}{2\sqrt{x}}
  • ddx[x2]=2x3\frac{d}{dx}[x^{-2}] = -2x^{-3}

Sum and Difference Rule

ddx[f(x)±g(x)]=f(x)±g(x)\frac{d}{dx}[f(x) \pm g(x)] = f'(x) \pm g'(x)

Product Rule

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

Mnemonic: "First times derivative of second, plus second times derivative of first"

Example: Differentiate y=x2sinxy = x^2 \sin x

dydx=2xsinx+x2cosx=x(2sinx+xcosx)\frac{dy}{dx} = 2x \cdot \sin x + x^2 \cdot \cos x = x(2\sin x + x\cos x)

Quotient Rule

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

Example: Differentiate y=x2+1x3y = \dfrac{x^2 + 1}{x - 3}

dydx=2x(x3)(x2+1)(1)(x3)2=2x26xx21(x3)2=x26x1(x3)2\frac{dy}{dx} = \frac{2x(x-3) - (x^2+1)(1)}{(x-3)^2} = \frac{2x^2 - 6x - x^2 - 1}{(x-3)^2} = \frac{x^2 - 6x - 1}{(x-3)^2}

Chain Rule

For composite functions y=f(g(x))y = f(g(x)):

dydx=dydududxwhere u=g(x)\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx} \quad \text{where } u = g(x)

Example: Differentiate y=sin(3x2+1)y = \sin(3x^2 + 1)

Let u=3x2+1u = 3x^2 + 1, so y=sinuy = \sin u:

dydx=cosu6x=6xcos(3x2+1)\frac{dy}{dx} = \cos u \cdot 6x = 6x\cos(3x^2 + 1)

Derivatives of Standard Functions

ddx[sinx]=cosxddx[cosx]=sinxddx[tanx]=sec2xddx[ex]=exddx[lnx]=1xddx[ax]=axlna\begin{aligned} \frac{d}{dx}[\sin x] &= \cos x \\ \frac{d}{dx}[\cos x] &= -\sin x \\ \frac{d}{dx}[\tan x] &= \sec^2 x \\ \frac{d}{dx}[e^x] &= e^x \\ \frac{d}{dx}[\ln x] &= \frac{1}{x} \\ \frac{d}{dx}[a^x] &= a^x \ln a \end{aligned}

Implementing Numerical Differentiation

python
def numerical_derivative(f, x: float, h: float = 1e-7) -> float:
    """
    Approximate f'(x) using the central difference formula.
    More accurate than forward difference for small h.
    
    Formula: f'(x) ≈ [f(x+h) - f(x-h)] / (2h)
    """
    return (f(x + h) - f(x - h)) / (2 * h)

import math

# Test with f(x) = sin(x), f'(x) = cos(x)
f = math.sin
x = math.pi / 4  # 45°

approx  = numerical_derivative(f, x)
exact   = math.cos(x)
error   = abs(approx - exact)

print(f"Approximate: {approx:.10f}")
print(f"Exact:       {exact:.10f}")
print(f"Error:       {error:.2e}")  # ~2.3e-14 ✓

Higher-Order Derivatives

The second derivative measures the rate of change of the first derivative (concavity):

f(x)=d2ydx2=ddx[dydx]f''(x) = \frac{d^2y}{dx^2} = \frac{d}{dx}\left[\frac{dy}{dx}\right]

Concavity test:

  • If f(x)>0f''(x) > 0: curve is concave up (∪)
  • If f(x)<0f''(x) < 0: curve is concave down (∩)
  • If f(x)=0f''(x) = 0: possible inflection point

Applications

Finding Critical Points

At a local maximum or minimum, f(x)=0f'(x) = 0 (or undefined).

Algorithm in TypeScript:

typescript
interface CriticalPoint {
  x: number;
  type: 'maximum' | 'minimum' | 'inflection' | 'unknown';
}

function classifyCriticalPoint(
  fPrime: (x: number) => number,
  fDoublePrime: (x: number) => number,
  x: number
): CriticalPoint {
  const secondDerivative = fDoublePrime(x);
  
  if (Math.abs(fPrime(x)) > 1e-6) {
    return { x, type: 'unknown' }; // Not actually a critical point
  }

  if (secondDerivative > 0) return { x, type: 'minimum' };
  if (secondDerivative < 0) return { x, type: 'maximum' };
  return { x, type: 'inflection' };
}

Derivatives Quiz

3 questions · Select one answer per question

What is the derivative of f(x) = 5x⁴ - 3x² + 7?

Using the chain rule, what is d/dx[sin(x²)]?

If f''(x) > 0 at a critical point, the function has a:

Answer all questions to submit

Found an error? Contribute on GitHub