# Differentiation

Differentiation is a technique used to find the gradient, or slope, of a line on a graph. It is the opposite of integration. Differentiating a function gives a derivative. This derivative is an equation which will give the gradient of a graph when numbers are put in. A derivative is a rate of change; how one variable or thing changes when another changes.

## [change]Notation

When differentiating, there are many ways to write it out. The most common way is $\frac{dy}{dx}$. This means differentiate y with respect to x. The function y must be defined by values of x. Another way is $\frac{d}{dx}\left(f(x)\right)$. This is used when you do not want to define y, and is often used for examples and identities, such as below.
You can also use the function notation. The first derivative of a function $f(x)$ is, in this notation, $f'(x)$, where the f is followed by a small vertical dash ', like an apostrophe. Another notation is to use dots on top of the variable to differentiate. This can only be used if it is very obvious what you are differentiating with respect to. In the example below, it is obvious that we are differentiating with respect to x so the dot notation can be used.
$y = x^2 + \frac{2x}{3}$

$\frac{dy}{dx} \equiv \dot{y} \equiv f'(x) \equiv \frac{d}{dx}\left(x^2 + \frac{2x}{3}\right) = 2x + \frac{2}{3}$

## [change]Methods of differentiation

### [change]Simple equations

The method for a normal equation is: take the power x is raised to, multiply x by this number, and then subtract 1 from the power. In a formula, this is:
$\frac{d}{dx}(ax^n) = nax^{n-1}$

For example: $\frac{d}{dx}(4x^2) = 8x$

Equations with many terms are differentiated by differentiating each term by itself:
$\frac{d}{dx}\left(2x^2 + 3x - x^{-1}\right) = 4x + 3 + x^{-2}$

### [change]Equations with e and ln

The differentials of e are fairly simple, because $e^(x)$ is the derivative of itself:
$\frac{d}{dx}\left(e^x\right) = e^x$
In a more general form, where e is raised to a function of x, $f(x)$:
$\frac{d}{dx}\left(e^{f(x)}\right) = f'(x) \times e^{f(x)}$
This is a simple example of the chain rule. (see below)

The differential of $\ln x$ is $1/x$, and in a general form:
$\frac{d}{dx}\left(\ln{f\left(x\right)}\right) = \frac{f'(x)}{f(x)}$

## [change]Rules of differentiation

The methods shown above for differentiation do not work when you have a function of a function or a function divided or multiplied by another. Three rules show what happens in these cases, and are called the chain rule, quotient rule and product rule respectively.

### [change]Chain rule

The chain rule is used where a function of x is put into another function, for example $\ln {x^2}$. The method is to differentiate the "outside" function with respect to the inside function, and then the inside function with respect to x. This formula can then be applied, where u is the "inside" function:
$\frac{dy}{dx} = \frac{dy}{du} \times \frac{du}{dx}$

#### [change]Example

Let $y = \ln{x^2}$. Make $y = ln u$ so that u = $x^2$.
$\frac{dy}{du} = \frac{1}{u} = \frac{1}{x^2}$
$\frac{du}{dx} = 2x$
$\frac{dy}{dx} = 2x \times \frac{1}{x^2} = \frac{2x}{x^2} = \frac{2}{x}$

### [change]Product rule

The product rule states that the differential of $y = u \times v$ (where u and v are functions of x) with respect to x is the sum of one differentiated multiplied by the other (which is not differentiated). This, as a formula, is:
$\frac{dy}{dx} = v\frac{du}{dx} + u\frac{dv}{dx}$

#### [change]Example

$y = 2x^2 \times e^x$
$u = 2x^2 \Rightarrow \frac{du}{dx} = 4x$
$v = e^x \Rightarrow \frac{dv}{dx} = e^x$

$\frac{dy}{dx} = (e^x \times 4x) + (2x^2 \times e^x) = e^x(4x + 2x^2) = 2xe^x(2 + x)$

## [change]Uses of differentiation

Differentiation is used in many different aspects of science and maths. For example, chemical reaction rates are modeled by differential equations. Probably the most important and easy to understand use of differentiation is with displacement, velocity and acceleration.

Velocity is defined as the rate of change of displacement with time. Displacement is essentially distance from a point, and velocity is essentially speed, although there are some differences. Taking displacement to be x and time to be t, velocity v is:
$v = \frac{\Delta x}{\Delta t} = \frac{dx}{dt}$
Say a particle starts 5m from point P. In ten seconds, it moved to 30m from P, with a steady velocity and no acceleration, and no forces acting on it. The velocity of the particle in this time is:
$v = \frac{\Delta x}{\Delta t} = \frac{30 - 5}{10} = 2.5 m s^{-1}$

Acceleration is defined as the rate of change of velocity, with respect to time:
$a = \frac{\Delta v}{\Delta t} = \frac{dv}{dt} = \frac{d^{2}x}{dt^2}$
Now the particle, 30m from P, has accelerated from 2.5m s−1 (v1) with an acceleration of 3m s−2 for 5 seconds. We would like to know the new velocity (v2):
$a = \frac{\Delta v}{\Delta t} \Rightarrow a = \frac{v_2 - v_1}{t} \Rightarrow a \times t = v_2 - 2.5 \Rightarrow v_2 = (3 \times 5) + 2.5 = 17.5 m s^{-1}$