# 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

$\frac{d}{dx}(k\cdot f(x))=k\cdot \frac{d}{dx}f(x)\text{.}$

## 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\pm g{)}^{\prime}={f}^{\prime}\pm {g}^{\prime}\text{.}$

or, using Leibniz’s notation,

$\frac{d}{dx}(u\pm v)=\frac{du}{dx}\pm \frac{dv}{dx}\text{.}$

## Power rule

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

$\frac{d}{dx}({x}^{n})=n{x}^{n-1}\text{.}$

For example, the derivative of ${x}^{100}$ with respect to $x$ is $100{x}^{99}\text{.}$

## Product rule

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

$(fg{)}^{\prime}={f}^{\prime}g+f{g}^{\prime}\text{,}$

or, using Leibniz’s notation,

$\frac{d}{dx}(uv)=\frac{du}{dx}\cdot v+\frac{dv}{dx}\cdot u\text{.}$

## Quotient rule

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

${\left(\frac{f}{g}\right)}^{\prime}=\frac{{f}^{\prime}g-f{g}^{\prime}}{{g}^{2}}\text{,}$

or, using Leibniz’s notation,

$\frac{d}{dx}\left(\frac{u}{v}\right)={v}^{-2}(\frac{du}{dx}\cdot v-\frac{dv}{dx}\cdot u)\text{.}$

## Chain rule

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

$(f\circ g{)}^{\prime}=({f}^{\prime}\circ g)\cdot {g}^{\prime}\text{,}$

or, using Leibniz’s notation,

$\frac{dy}{dx}=\frac{dy}{du}\cdot \frac{du}{dx}\text{.}$