## Differentiation rules

The first principle of calculus is tedious and it gives you plenty of opportunities to make mistakes. Fortunately, there are some shortcuts.

### Constant rule

This is really just a special case of the product rule, but you will use it so often that it’s easier to think of it separately. If k is a constant, then

d/(dx)(k*f(x)) = k*d/(dx)f(x).

### Sum & difference rules

The derivative of the sum is equal to the sum of the derivatives. The same goes for subtraction. This means that

(f + g)' = f' + g' qquad and qquad (f - g)' = f' - g',

or, using Leibniz’s notation,

d/(dx)(u+v) = (du)/(dx) + (dv)/(dx) qquad and qquad d/(dx)(u-v) = (du)/(dx) - (dv)/(dx).

### Power rule

Polynomials are very easy to differentiate thanks to the power rule.

d/(dx)(x^n) = nx^(n-1).

For example, the derivative of x^100 with respect to x is 100x^99.

### Product rule

The derivative of the product is not the product of the derivatives. Rather,

(fg)' = f'g + fg',

or, using Leibniz’s notation,

d/(dx)(uv) = (du)/(dx)*v + (dv)/(dx)*u.

### Quotient rule

We can use the product and power rules together to tackle rationals, but using the quotient rule is much easier:

(f/g)' = (f'g - fg')/g^2,

or, using Leibniz’s notation,

d/(dx)(u/v) = v^-2((du)/(dx)*v - (dv)/(dx)*u).

### Chain rule

To differentiate composite functions, we need to use the chain rule:

(f \circ g)' = (f' \circ g)*g',

or, using Leibniz’s notation,

(dy)/(dx) = (dy)/(du) * (du)/(dx).