Differentiation – Operations and Rules

Preliminary Reading

The five elementary functions — constant, power, exponential, logarithmic, trigonometric — are not five isolated facts. They are building blocks. Almost every function encountered in practice is one of these five, or several of these five combined through a small number of operations:

Addition: $(f+g)(x) = f(x) + g(x)$

Subtraction: $(f-g)(x) = f(x) – g(x)$

Multiplication: $(f \cdot g)(x) = f(x) \cdot g(x)$

Division: $(f/g)(x) = \dfrac{f(x)}{g(x)}, \quad g(x) \neq 0$

Composition (function of a function): $(f \circ g)(x) = f(g(x))$

This is why five elementary functions are enough to generate an enormous family of further functions — every polynomial is built from the power function through addition; every rational function is a division of two such polynomials; $e^{\sin x}$ is a composition of the exponential and the trigonometric elementary; and so on.

Since new functions are built from the five elementary functions using only these five operations, knowing how differentiation behaves under each operation is enough to differentiate the entire family — without ever needing a new primitive fact.

$$\frac{d}{dx}\left[f(x) + g(x)\right] = f'(x) + g'(x)$$

$$\frac{d}{dx}\left[f(x) – g(x)\right] = f'(x) – g'(x)$$

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

$$\frac{d}{dx}\left[\frac{f(x)}{g(x)}\right] = \frac{f'(x)g(x) – f(x)g'(x)}{[g(x)]^2}$$

$$\frac{d}{dx}\left[f(g(x))\right] = f'(g(x)) \cdot g'(x)$$

Each example below uses the five elementary derivatives already established, combined through one of the five rules above.

Example (Sum Rule): $f(x) = x^3 + \sin x$

$$f'(x) = \frac{d}{dx}(x^3) + \frac{d}{dx}(\sin x) = 3x^2 + \cos x$$

Example (Difference Rule): $f(x) = e^x – \ln x$

$$f'(x) = \frac{d}{dx}(e^x) – \frac{d}{dx}(\ln x) = e^x – \frac{1}{x}$$

Example (Product Rule): $f(x) = x^2 \cdot e^x$

$$f'(x) = \frac{d}{dx}(x^2)\cdot e^x + x^2 \cdot \frac{d}{dx}(e^x) = 2x \, e^x + x^2 e^x = e^x(2x + x^2)$$

Example (Product Rule): $f(x) = x \sin x$

$$f'(x) = 1 \cdot \sin x + x \cdot \cos x = \sin x + x\cos x$$

Example (Quotient Rule): $f(x) = \tan x = \dfrac{\sin x}{\cos x}$

$$f'(x) = \frac{\cos x \cdot \cos x – \sin x \cdot (-\sin x)}{\cos^2 x} = \frac{\cos^2 x + \sin^2 x}{\cos^2 x} = \frac{1}{\cos^2 x} = \sec^2 x$$

Example (Quotient Rule): $f(x) = \cot x = \dfrac{\cos x}{\sin x}$

$$f'(x) = \frac{-\sin x \cdot \sin x – \cos x \cdot \cos x}{\sin^2 x} = \frac{-(\sin^2 x + \cos^2 x)}{\sin^2 x} = \frac{-1}{\sin^2 x} = -\csc^2 x$$

Example (Quotient Rule): $f(x) = \sec x = \dfrac{1}{\cos x}$

$$f'(x) = \frac{0 \cdot \cos x – 1 \cdot (-\sin x)}{\cos^2 x} = \frac{\sin x}{\cos^2 x} = \frac{1}{\cos x}\cdot\frac{\sin x}{\cos x} = \sec x \tan x$$

Example (Quotient Rule): $f(x) = \csc x = \dfrac{1}{\sin x}$

$$f'(x) = \frac{0 \cdot \sin x – 1 \cdot \cos x}{\sin^2 x} = \frac{-\cos x}{\sin^2 x} = -\csc x \cot x$$

Example (Quotient Rule): $f(x) = \dfrac{x^2 – 1}{x + 3}$

$$f'(x) = \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}$$

Example (Chain Rule): $f(x) = e^{\sin x}$

Here $f(x) = h(g(x))$ with $h(u) = e^u$ and $g(x) = \sin x$.

$$f'(x) = h'(g(x)) \cdot g'(x) = e^{\sin x} \cdot \cos x$$

Example (Chain Rule): $f(x) = \ln(x^2 + 1)$

Here $h(u) = \ln u$ and $g(x) = x^2 + 1$.

$$f'(x) = \frac{1}{x^2+1} \cdot 2x = \frac{2x}{x^2+1}$$

Example (Chain Rule): $f(x) = \sin(x^3)$

Here $h(u) = \sin u$ and $g(x) = x^3$.

$$f'(x) = \cos(x^3) \cdot 3x^2 = 3x^2 \cos(x^3)$$

Example (Chain Rule): $f(x) = (3x+1)^5$

Here $h(u) = u^5$ and $g(x) = 3x+1$.

$$f'(x) = 5(3x+1)^4 \cdot 3 = 15(3x+1)^4$$

Example (Product Rule combined with Chain Rule): $f(x) = x^2 \ln(2x)$

$$f'(x) = 2x \cdot \ln(2x) + x^2 \cdot \frac{1}{2x}\cdot 2 = 2x\ln(2x) + x$$

Example (Quotient Rule combined with Chain Rule): $f(x) = \dfrac{e^{2x}}{x}$

$$f'(x) = \frac{2e^{2x}\cdot x – e^{2x}\cdot 1}{x^2} = \frac{e^{2x}(2x-1)}{x^2}$$

The chain rule handles a function built as a function of a function. The examples so far used only one layer of composition — $h(g(x))$. In practice, especially once derivatives are used to track how one quantity affects another through several intermediate steps, compositions stack several layers deep. The rule extends the same way at every layer: differentiate the outer layer with respect to its immediate input, multiply by the derivative of that input with respect to the next layer in, and continue until reaching $x$.

Two-layer composition, restated generally

If $f(x) = h(g(x))$,

$$f'(x) = h'(g(x)) \cdot g'(x)$$

Three-layer composition

If $f(x) = h(g(k(x)))$, treat it as $h$ applied to $g(k(x))$, then apply the two-layer rule again to the inner piece:

$$f'(x) = h’\big(g(k(x))\big) \cdot g’\big(k(x)\big) \cdot k'(x)$$

Each factor differentiates one layer with respect to the layer immediately inside it — the same pattern simply repeats once more.

Example (three layers): $f(x) = \sin!\left(e^{x^2}\right)$

Here the layers, from outside in, are $h(u) = \sin u$, $g(v) = e^v$, $k(x) = x^2$.

$$f'(x) = \cos!\left(e^{x^2}\right) \cdot e^{x^2} \cdot 2x = 2x \, e^{x^2} \cos!\left(e^{x^2}\right)$$

Example (three layers): $f(x) = \ln!\left(\sin(x^2)\right)$

Layers: $h(u) = \ln u$, $g(v) = \sin v$, $k(x) = x^2$.

$$f'(x) = \frac{1}{\sin(x^2)} \cdot \cos(x^2) \cdot 2x = \frac{2x\cos(x^2)}{\sin(x^2)}$$

Example (three layers): $f(x) = \left(\ln(3x+1)\right)^2$

Layers: $h(u) = u^2$, $g(v) = \ln v$, $k(x) = 3x+1$.

$$f'(x) = 2\ln(3x+1) \cdot \frac{1}{3x+1} \cdot 3 = \frac{6\ln(3x+1)}{3x+1}$$

Example (four layers): $f(x) = e^{\sin(x^3)}$, composed step by step

Layers: $h(u) = e^u$, $g(v) = \sin v$, $k(x) = x^3$.

$$f'(x) = e^{\sin(x^3)} \cdot \cos(x^3) \cdot 3x^2 = 3x^2\cos(x^3)\, e^{\sin(x^3)}$$

Chain rule combined with product rule: $f(x) = x \cdot e^{x^2}$

The outer structure is a product ($x$ times $e^{x^2}$), so the product rule applies first; differentiating $e^{x^2}$ within that product requires the chain rule.

$$f'(x) = 1 \cdot e^{x^2} + x \cdot \left(e^{x^2}\cdot 2x\right) = e^{x^2} + 2x^2 e^{x^2} = e^{x^2}(1+2x^2)$$

Chain rule combined with quotient rule: $f(x) = \dfrac{\ln(x^2+1)}{x}$

The outer structure is a quotient, so the quotient rule applies first; differentiating $\ln(x^2+1)$ within the numerator requires the chain rule.

$$f'(x) = \frac{\left(\dfrac{1}{x^2+1}\cdot 2x\right)\cdot x \;-\; \ln(x^2+1)\cdot 1}{x^2} = \frac{\dfrac{2x^2}{x^2+1} – \ln(x^2+1)}{x^2}$$

A composed function is exactly what is built whenever one quantity is passed through several stages before producing a final output — each stage taking the previous stage’s output as its own input.

The chain rule is the precise statement of how a small change at the very first stage ultimately affects the very last stage, by tracking its effect through every intermediate stage along the way, one layer’s derivative at a time.

This is the same layer-by-layer tracking idea that reappears later wherever outputs are produced through multiple successive stages of transformation.

Scroll to Top