# 18 Differentiation

Imagine you are Galileo's assistant. You have gone to the leaning tower of Pisa to test whether objects with different masses fall at different speeds. As you release an object you start a timer so that at $t = 0$ the downward velocity is also zero.

You know from Newton's equations (though Newton hadn't written them at this point) that $s=ut+\frac{1}{2}at^2$. We know $u=0$ and that $a$ is the acceleration due to gravity so we can write $s=\frac{1}{2}gt^2$.
Note: We are measuring downwards from the release point.

Newton's first equation of motion states $v=u+at$ so we can write $v=gt$. The acceleration due to gravity $g$ is constant over these distances so the velocity is proportional to the time. Time $t$ is the independent variable and distance $s$ is the dependent variable.

$s=\frac{1}{2}gt^2$

$v=gt$

We can be pretty sure that distance and velocity are related. The question is how? Start with $s=\frac{1}{2}gt^2$. To convert $s=\frac{1}{2}gt^2$ into $gt$ we need to multiply the expression by the exponent of $t$ and then reduce the exponent by $1$.

The process has given us the rate of change of distance with respect to time, $s$ with respect to $t$, which is the velocity. If we repeat the process we get the rate of change of velocity with respect to time, $v$ with respect to $t$, which is $g$ the acceleration.

Velocity is the rate of change of position. Acceleration is the rate of change of velocity.

The process is called differentiation. In this case it has given us velocity and acceleration. In general, differentiation gives us the rate of change of one variable with respect to another.

## 18.1 Polynomials

If $y=ax^n + bx^{n-1} + cx^{n-2} . . .$ then $\frac{dy}{dx} = nax^{n-1} + (n - 1)bx^{n-2} + (n - 2)cx^{n-3} . . .$

 Example 18.1 Given $y=2x^3 + 4x^2 + 3x + 5$ find $dy / dx$ $y$ $=$ $2x^3 + 4x^2 + 3x + 5$ $\frac{dy}{dx}$ $=$ $3.2x^2 + 2.4x + 3 + 0$ $=$ $6x^2 + 8x + 3$

## 18.2 Chain Rule

If $y=y(u)$ and $u=u(x)$ then $\frac{dy}{dx} = \frac{dy}{du} \frac{du}{dx}$

 Example 18.2 Given $y=(2x^3+4x^2)^4$ find $dy / dx$. Let $u=2x^3+4x^2$ so $y=u^4$ then $\frac{dy}{du}=4u^3$ and $\frac{du}{dx}=6x^2+8x$ $\frac{dy}{du}\frac{du}{dx}$ $=$ $4u^3 (6x^2 + 8x)$ $=$ $4(2x^3+4x^2)^3 (6x^2 + 8x)$ Sanity Check: As a quick sanity check look at the $x^3$ term in the question. If we expanded the bracket the highest order term would be $16x^{12}$. When we differentiate this term we would get $192x^{11}$.If we expand the highest order term in our answer we get $4. 8x^9 . 6x^2 = 192x^{11}$ so we can have some confidence our answer is correct.
 Example 18.3 Differentiate $y=sin(3x)$. Let $u=3x$ then $\frac{du}{dx}=3$ and $y=sin(u)$ then $\frac{dy}{du}=cos(u)$ so $\frac{dy}{dx}=\frac{dy}{du} \frac{du}{dx} = cos(u) . 3 = 3cos(3x)$ More generally $\frac{d}{dx} sin(ax) = acos(ax)$ Similarly $\frac{d}{dx} cos(ax) = -asin(ax)$ and $\frac{d}{dx} tan(ax) = a sec^2 (ax)$

## 18.3 Product Rule

If $u=u(x)$ and $v=v(x)$ then $\frac{d}{dx}(uv) = u \frac{dv}{dx} + v \frac{du}{dx}$

 Example 18.4 Differentiate $y=3x^3 e^x$ Let $u=3x^3$ and $v=e^x$ then $\frac{du}{dx}=9x^2$ and $\frac{dv}{dx}=e^x$ $\frac{dy}{dx}$ $=$ $u\frac{dv}{dx} + v \frac{du}{dx}$ $=$ $3x^3.e^x + e^x.9x^2$ $=$ $3x^2.e^x(x + 3)$
 Example 18.5 Differentiate $y=3x^2 cos(4x)$ Let $u=3x^2$ and $v=cos(4x)$ then $\frac{du}{dx}=6x$ and $\frac{dv}{dx}=-4sin(4x)$ $\frac{dy}{dx}$ $=$ $u\frac{dv}{dx} + v \frac{du}{dx}$ $=$ $3x^2(-4sin(4x)) + cos(4x) 6x$ $=$ $3x(2cos(4x)-4xsin(4x))$

## 18.4 Quotient Rule

If $u=u(x)$ and $v=v(x)$ then $\frac{d}{dx}(\frac{u}{v}) = \frac{v \frac{du}{dx} - u \frac{dv}{dx}}{v^2}$

 Example 18.6 Differentiate $y = tan(x)$ Let $u=sin(x)$ and $v=cos(x)$ then $\frac{du}{dx}=cos(x)$ and $\frac{dv}{dx}=-sin(x)$ $\frac{d}{dx}(\frac{u}{v})$ $=$ $\frac{v \frac{du}{dx} - u \frac{dv}{dx}}{v^2}$ $=$ $\frac{cos(x).cos(x) - sin(x)(-sin(x))}{cos^2 (x)}$ $=$ $\frac{cos^2(x) + sin^2(x)}{cos^2 (x)}$ Remember $sin^2(x) + cos^2(x) = 1$ $=$ $\frac{1}{cos^2 (x)} = sec^2 (x)$
 Example 18.7 Given $y = \frac{4-3x}{2x-3}$ find $dy / dx$ Let $u=4-3x$ and $v=2x-3$ So $\frac{du}{dx}=-3$ and $\frac{dv}{dx}=2$ $\frac{d}{dx}(\frac{u}{v})$ $=$ $\frac{v \frac{du}{dx} - u \frac{dv}{dx}}{v^2}$ $=$ $\frac{(2x-3)(-3) - (4-3x)2}{(2x-3)^2}$ $=$ $\frac{-6x + 9 - 8 + 6x}{(2x-3)^2}$ $=$ $\frac{1}{(2x-3)^2}$

## 18.5 Using Differentiation

Imagine you have a cylindrical container which is 5 metres in diameter and 10 metres tall. If liquid is pouring in to the container at a rate of 1000 litres per second what is the rate of change of depth?

The volume of liquid is given by $V = \pi r^2 y$ where $y$ is the depth of liquid.

 $V$ $=$ $\pi r^2 y$ Differentiating both sides with respect to time $t$ we get $\frac{dV}{dt}$ $=$ $\pi r^2 \frac{dy}{dt}$ So the rate of change of depth is given by $\frac{dy}{dt}$ $=$ $\frac{1}{\pi r^2} \frac{dV}{dt}$ 1000 litres $=$ 1 cubic metre so $\frac{dy}{dt}$ $=$ $\frac{1}{\pi r^2}$ $=$ $0.051$ m/s or $51$ mm/s

The radius of a cylinder is constant, it is not dependent on the depth of liquid. What would happen if we had a conical funnel instead of a cylinder?

Using the dimensions from above, imagine we have a conical vessel with a maximum diameter of 5 metres and a height of 10 metres. If the small end is downwards and liquid is pouring into the vessel at 1000 litres per second what is the rate of change of depth when the depth is 2 metres?

Unlike the case of the cylinder the radius of the top of the liquid varies with the depth of the liquid. This means we have to replace $r$ with $x$ where $x=f(y)$.

 $V$ $=$ $\frac{\pi x^2 y}{3}$ From similar triangles we can see $x/y = r/h$ so $V$ $=$ $\frac{\pi r^2 y^3}{3h^2}$ Differentiating both sides with respect to time $t$ we get $\frac{dV}{dt}$ $=$ $\frac{\pi r^2y^2}{h^2} \frac{dy}{dt}$ So the rate of change of depth is given by $\frac{dy}{dt}$ $=$ $\frac{h^2}{\pi r^2 y^2} \frac{dV}{dt}$ 1000 litres $=$ 1 cubic metre so $\frac{dy}{dt}$ $=$ $\frac{10^2}{\pi 2.5^2 2^2}$ $=$ $1.27$ m/s

## 18.6 Table of Common Standard Differentials

In the following table the left hand column contains functions of $x$ ($y=f(x)$). The right hand column contains the differentials of the functions with respect to $x$ ($dy/dx=f'(x)$).

$y=f(x)$    $dy/dx = f'(x)$
$x^n$$nx^{n-1} sin(ax)$$acos(ax)$
$cos(ax)$$-asin(ax) tan(ax)$$asec^2(ax)$
$e^{ax}$$ae^{ax} ln(ax)$$1/x$