Differentiation primer

23 April 2019

1. Simple case: xax^a

ddx(xa)=axa1\frac{d}{dx} (x^a) = a x^{a-1}

For each term in xx we can multiply the term by the index of xx then subtract 11 from the index of xx.

By way of example: ddx(3x25x)=6x5\frac{d}{dx} (3x^2 - 5x) = 6x - 5

2. Simple case: sinx\sin x and cosx\cos x

sinx\sin x and cosx\cos x, where xx is a small angle in radians:

ddx(sinkx)=kcoskxddx(coskx)=ksinkx\frac{d}{dx}(\sin kx) = k \cos kx \\ \frac{d}{dx}(\cos kx) = - k \sin kx

Note: need to always use radians when differentiating trigonometric functions.

There are also small angle approximations:
sinxxcosx112x2tanxx\sin x \approx x \\ \cos x \approx 1 - \frac 1 2 x^2 \\ \tan x \approx x

3. Simple case: exponentials and logarithms

The definition of exe^x is that the graph of the gradient is the same as the graph of y=exy = e^x; ddx(ex)=ex\frac{d}{dx}(e^x) = e^x

ddx(ekx)=kekxddx(ln(xa))=axddx(akx)=akxklna\frac{d}{dx}(e^{kx}) = ke^{kx} \\ \frac{d}{dx}(\ln (x^a)) = \frac a x \\ \frac{d}{dx}(a ^{kx}) = a ^{kx} k \ln a

where kk is a real constant and a>0a \gt 0

4. Chain rule

The chain rule is used to differentiate composite functions i.e. a function of a function.

dydx=dydu×dudx\frac{dy}{dx} = \frac{dy}{du} \times \frac{du}{dx}

where yy is a function of uu, and uu is a function of xx

In general:

If y=(f(x))ny = (f(x))^n then dydx=n(f(x))n1f(x)\frac{dy}{dx} = n(f(x))^{n-1} f'(x)

If y=f(g(x))y = f(g(x)) then dydx=f(g(x))g(x)\frac{dy}{dx} = f'(g(x)) g'(x)

By way of example, to differentiate y=(3x25x)3y = (3x^2 - 5x)^3:

Let u=3x25x    dudx=6x5y=u3    dydu=3u2dydx=dydu×dudx    dydx=3u2×(6x5)=3(3x25x)2(6x5)\text{Let } u = 3x^2 - 5x \implies \frac{du}{dx} = 6x - 5 \\ y = u^3 \implies \frac{dy}{du} = 3u^2 \\ \frac{dy}{dx} = \frac{dy}{du} \times \frac{du}{dx} \implies \frac{dy}{dx} = 3u^2 \times (6x - 5) \\ = 3(3x^2 - 5x)^2 (6x - 5)

5. Product rule

Used for the product of two functions

If y=uvy = uv then dydx=udvdx+vdudx\frac{dy}{dx} = u \frac{dv}{dx} + v \frac{du}{dx} where uu and vv are both functions of xx

e.g. y=x2(3x+1)y = x^2 (3x + 1)

Let u=x2    dudx=2xLet v=(3x+1)    dvdx=3\text{Let } u = x^2 \implies \frac{du}{dx} = 2x \\ \text{Let } v = (3x + 1) \implies \frac{dv}{dx} = 3

dydx=udvdx+vdudx=x2(3)+(3x+1)2x=3x2+2x(3x+1)=3x2+6x2+2x=9x2+2x=x(9x+2)\frac{dy}{dx} = u \frac{dv}{dx} + v \frac{du}{dx} = x^2 (3) + (3x + 1) 2x \\ = 3x^2 + 2x(3x + 1) \\ = 3x^2 + 6x^2 + 2x = 9x^2 + 2x = x(9x + 2)

6. Quotient rule

If y=uvy = \frac u v then dydx=1v2(vdudxudvdx)\frac{dy}{dx} = \frac{1}{v^2} ( v \frac{du}{dx} - u \frac{dv}{dx} )
where uu and vv are functions of xx

Or in function notation:
If f(x)=g(x)h(x)f(x) = \frac{g(x)}{h(x)} then f(x)=1(h(x))2(h(x)g(x)g(x)h(x))f'(x) = \frac{1}{(h(x))^2} ( h(x) g'(x) - g(x) h'(x))

By way of example:

y=tanx=sinxcosx=uvdydx=1v2(vdudxudvdx)u=sinx    dudx=cosxv=cosx    dvdx=sinxdydx=1cos2x×((cosx)(cosx)(sinx)(sinx))=cos2x+sin2xcos2x=1cos2x=sec2xy = \tan x = \frac{\sin x}{\cos x} = \frac u v \\ \frac{dy}{dx} = \frac{1}{v^2} ( v \frac{du}{dx} - u \frac{dv}{dx} ) \\ u = \sin x \implies \frac{du}{dx} = \cos x \\ v = \cos x \implies \frac{dv}{dx} = - \sin x \\ \frac{dy}{dx} = \frac{1}{\cos^2 x} \times ( (\cos x) (\cos x) - (\sin x) (- \sin x) ) \\ = \frac{\cos^2 x + \sin^2 x}{\cos^2 x} = \frac{1}{\cos^2 x} = \sec^2 x

Generalising; ddx(tankx)=ksec2kx\frac{d}{dx} (\tan kx) = k \sec^2 kx

Using the quotient rule and differentiating sinx\sin x and cosx\cos x we can derive:

ddx(tankx)=ksec2kxddx(csckx)=kcsckxcotkxddx(seckx)=kseckxtankxddx(cotkx)=kcsc2kx\frac{d}{dx} ( \tan kx ) = k \sec ^2 kx \\ \frac{d}{dx} ( \csc kx ) = -k \csc kx \cot kx \\ \frac{d}{dx} ( \sec kx ) = k \sec kx \tan kx \\ \frac{d}{dx} ( \cot kx ) = -k \csc^2 kx

dydx=1/dxdy\frac{dy}{dx} = 1 / \frac{dx}{dy} can be used to differentiate the inverse of the trigonometric functions e.g. arcsinx\arcsin x

By way of example for arcsinx\arcsin x

Let y=arcsinxSo x=sinydxdy=cosy    dydx=1cosyUsing sin2y+cos2y1cos2y=1sin2ycosy=1sin2y=11x2\text{Let } y = \arcsin x \\ \text{So } x = \sin y \\ \frac{dx}{dy} = \cos y \implies \frac{dy}{dx} = \frac{1}{\cos y} \\ \text{Using } \sin^2 y + \cos^2 y \equiv 1 \\ \cos^2 y = 1 - \sin^2 y \\ \cos y = \sqrt{1 - \sin^2 y} = \frac{1}{\sqrt{1 - x^2}}

ddx(arcsinx)=11x2\frac{d}{dx} (\arcsin x) = \frac 1 {\sqrt{1-x^2}} ddx(arccosx)=11x2\frac{d}{dx} (\arccos x) = - \frac 1 {\sqrt{1-x^2}} ddx(arctanx)=11+x2\frac{d}{dx} (\arctan x) = \frac 1 {1+x^2}

7. Parametric differentiation

If xx and yy are both given as functions of a parameter tt then dydx=dydt/dxdt=dydt×dtdx\frac{dy}{dx} = \frac{dy}{dt} / \frac{dx}{dt} = \frac{dy}{dt} \times \frac{dt}{dx}

8. Implicit differentiation

Implicit differentiation allows for differentiation to happen more easily when it is difficult to algebraicly manipulate the function you are trying differentiate into the usual y=y = \dots form.

There are two useful results to bear in mind for implicit differentiation:

  1. ddx(yn)=ny(n1)dydx\frac{d}{dx}(y^n) = ny^{(n-1)} \frac{dy}{dx}
  2. ddx(xy)=xdydx+y\frac{d}{dx}(xy) = x \frac{dy}{dx} + y

The first means you can treat yy just as you would xx, and then include (multiply by) dydx\frac{dy}{dx}. All the dydx\frac{dy}{dx} terms can then be collected on one side to be left with the usual dydx=\frac{dy}{dx} = \dots

The second can be verified by the use of the product rule, using xyxy for uvuv.

By way of example:

e2x+e2y=xy (1)e^{2x} + e^{2y} = xy \text{ (1)}

Using the product rule for ddx(xy)\frac{d}{dx}(xy):
ddx(uv)=vdudx+udvdxLet u=x    dudx=1Let v=y    dvdx=1dydxSo ddx(xy)=y+xdydx\frac{d}{dx} (uv) = v \frac{du}{dx} + u \frac{dv}{dx} \\ \text{Let } u = x \implies \frac{du}{dx} = 1 \\ \text{Let } v = y \implies \frac{dv}{dx} = 1 \frac{dy}{dx} \\ \text{So } \frac{d}{dx} (xy) = y + x \frac{dy}{dx}

Differentiating (1) with regard to xx:
2e2x+2e2ydydx=y+xdydx    2e2xy=xdydx2e2ydydx=(x2e2y)dydx    dydx=2e2xyx2e2y2e^{2x} + 2e^{2y} \frac{dy}{dx} = y + x \frac{dy}{dx} \\ \implies 2e^{2x} - y = x \frac{dy}{dx} - 2e^{2y} \frac{dy}{dx} = (x - 2e^{2y}) \frac{dy}{dx} \\ \implies \frac{dy}{dx} = \frac{2e^{2x}-y}{x-2e^{2y}}

Appendix — things to remember

  1. If you need to take logs of both sides, use ln\ln as this can be differentiated into 1x\frac 1 x