# Derivative rules examples

Derivative rules in Calculus are formulas or methods for calculating a function’s derivative and are used to differentiate various types of functions and operations.

In this blog we will cover the following derivative rules with their examples:

Let’s jump into the primary examples for understanding each of those differentiation rules:

## Constant Rule

Differentiating constant functions rule is called the constant rule. The rule states that the derivative of a constant function is 0. A function that is a constant has no rate of change i.e it has no slope. A constant function is just a plain horizontal line.

For a function $$f(x) = c$$, the constant rule can be expressed as:

$$\frac{d}{dx}(c)=0$$

Example:

1. The derivative of $$f(x) = 3$$ is equal to 0.
2. The derivative of $$f(x) = -5$$ is equal to 0.
3. The derivative of $$f(x) = 1/2$$ is equal to 0.

## Power Rule

The power rule helps us to find the derivative of a variable like raised to a power. Variables raised to a power looks like: $$x^5$$, $$2x^{-2}$$, $$4x^3$$.

For a function $$f(x)=x^n$$, where n is a real number, the power rule can be expressed as:

$$\frac{d}{dx}(x^n)=nx^{n−1}$$

The power rule states that in order to calculate the derivative of such functions, we need to take the exponent and multiply it by the coefficient (the number in front of the variable), and decrease the exponent by 1.

### Examples:

1. For a function $$f(x)=x^5$$, the power rule can be expressed as:

$$\frac{d}{dx}(x^5)=5x^{4}$$

2. For a function $$f(x)=x^{1/2}$$, the power rule can be expressed as:

$$\frac{d}{dx}(x^{1/2})=\frac{1}{2}x^{-1/2}$$

3. For a function $$f(x)=2x^{3}$$, the power rule can be expressed as:

$$\frac{d}{dx}(2x^{3})= 6x^{2}$$

## Sum and Difference Rule

The sum rule states that the derivative of a sum is equal to the sum of the derivatives.
The difference rule states that the derivative of a difference is equal to the difference of the derivatives.

For the functions $$f(x)$$,$$g(x)$$ the sum rule can be expressed as:

$$\frac{d}{dx}(f(x) + g(x))=\frac{d}{dx}(f(x)) + \frac{d}{dx}(g(x))$$

and the difference rule can be expressed as:

$$\frac{d}{dx}(f(x) – g(x))=\frac{d}{dx}(f(x)) – \frac{d}{dx}(g(x))$$

### Examples:

1. For the function $$f(x)=x^5$$, $$g(x)=x^2$$, the sum rule can be expressed as:

\begin{align*} \dfrac{d}{dx}(f(x) + g(x))&=\dfrac{d}{dx}(x^5 + x^2)\\ &=\dfrac{d}{dx}(x^5) + \dfrac{d}{dx}(x^2)\\ &=5x^4 + 2x\end{align*}

2. For the function $$f(x)=2x^4$$, $$g(x)=5x^3$$, the difference rule can be expressed as:

\begin{align*} \dfrac{d}{dx}(f(x) – g(x))&=\dfrac{d}{dx}(2x^4 – 5x^3)\\ &=\dfrac{d}{dx}(2x^4) – \dfrac{d}{dx}(5x^3)\\ &=8x^3 – 15x^2\end{align*}

## Constant Multiple Rule

The constant multiple rule signifies that the derivative of a constant multiplied by a function is the constant multiplied by the derivative of the function.

For a function $$cf(x)$$ (where c is constant) the constant multiple rule can be expressed as:

$$\frac{d(cf(x))}{dx}=c\frac{d(f(x))}{dx}$$

### Examples:

1. For a function $$f(x)=x^5$$, if we want 2 as a constant multiplier, the constant multiple rule can be expressed as:

$$\frac{d}{dx}(2(x^5))=10x^{4}$$

2. For a function $$f(x)=x^{1/2}$$, if we want 8 as a constant multiplier, the constant multiple rule can be expressed as:

$$\frac{d}{dx}(8(x^{1/2}))=4x^{-1/2}$$

3. For a function $$f(x)=x^{4}+8$$, if we want 4 as a constant multiplier, the constant multiple rule can be expressed as:

\begin{align*} \dfrac{d}{dx}(4f(x))&=4\dfrac{d}{dx}(x^4+8)\\ &=4(\dfrac{d}{dx}(x^4)+\dfrac{d}{dx}(8))\\ &=4(4x^3)+0\\ &=16x^3 \end{align*}

4. For a function $$f(x)=x^{4}+2x^{3}+8$$, if we want 2 as a constant multiplier, the constant multiple rule can be expressed as:

\begin{align*} \dfrac{d}{dx}(2f(x))&=2\dfrac{d}{dx}(x^{4}+2x^{3}+8)\\ &=2(\dfrac{d}{dx}(x^4)+\dfrac{d}{dx}(2x^3)+\dfrac{d}{dx}(8))\\ &=2((4x^3)+ (6x^2) +0)\\ &=8x^3 + 12x^2 \end{align*}

## Product Rule

The product rule states that the derivative of a product of two functions is the first function multiplied by the derivative of the second function plus the second function multiplied by the derivative of the first function.

For the functions $$f(x)$$, $$g(x)$$ the product rule can be expressed as:

$$\frac{d}{dx}(f(x)g(x))=\frac{d}{dx}(f(x)).g(x) + \frac{d}{dx}(g(x)).f(x)$$

### Examples:

1. For a function $$f(x)=x^{3}$$, $$g(x)=x^{2}$$, the product rule can be expressed as:

\begin{align*} \dfrac{d}{dx}(f(x).g(x))&=\dfrac{d}{dx}((x^{3}).(x^{2}))\\ &=\dfrac{d}{dx}(x^{3}).(x^{2})+\dfrac{d}{dx}(x^{2}).(x^{3})\\ &=((3x^{2}).(x^{2})) + ((2x).(x^{3}))\\ &=3x^{4} + 2x^{4}\\ &=5x^{4}\end{align*}

2. For a function $$f(x)=x^{5}+2x^{2}$$, $$g(x)=3x^{2}+4$$, the product rule can be expressed as:

\begin{align*} \dfrac{d}{dx}(f(x).g(x))&=\dfrac{d}{dx}((x^{5}+2x^{2}).(3x^{2}+4))\\ &=\dfrac{d}{dx}(x^{5}+2x^{2}).(3x^{2}+4)+\dfrac{d}{dx}(3x^{2}+4)).(x^{5}+2x^{2})\\ &=((5x^{4}+4x).(3x^{2}+4)) + ((6x).(x^{5}+2x^{2}))\\ &=((5x^{4}.3x^{2}) + (5x^{4}.4)+ (4x.3x^{2}) + (4x.4)) + ((6x).(x^{5})\\ &+ (6x).(2x^{2})))\\ &=(15x^{6} + 20x^{4}+ 12x^{3} + 16x + 6x^{6} + 12x^{3})\\ &=(15x^{6} + 6x^{6}) + 20x^{4} + (12x^{3} + 12x^{3}) + 16x\\ &=21x^{6} + 20x^{4} + 24x^{3} + 16x \end{align*}

## Quotient Rule

The quotient rule is used to find the derivative of functions that are in the form $$\frac{f(x)}{g(x)}$$ i.e the ratio of two differentiable functions.

The Quotient rule states that the derivates of functions (which are in the form $$\frac{f(x)}{g(x)}$$) is equal to the function present in the numerator (f(x)) multiplied by the function present in the denominator (g(x)) minus the derivative of the function present in the denominator (g(x)) multiplied by the function present in the numerator (f(x)), and then, all of that is divided by the square of the function present in the denominator (g(x)).

For the functions in ratio $$f(x)/g(x)$$ the quotient rule can be expressed as:

\begin{align*} \dfrac{d}{dx}(\dfrac{f(x)}{g(x)})=\dfrac{\dfrac{d}{dx}(f(x))⋅g(x)−\dfrac{d}{dx}(g(x))⋅f(x)}{(g(x))^{2}}\end{align*}

### Examples:

1. For the functions in ratio $$\frac{x^{3}}{x^{2}}$$, the quotient rule can be expressed as:

\begin{align*} \dfrac{d}{dx}(\dfrac{f(x)}{g(x)})&=\dfrac{d}{dx}(\dfrac{x^{3}}{x^{2}})\\ &=\dfrac{\dfrac{d}{dx}(x^{3})⋅x^{2}−\dfrac{d}{dx}(x^{2})⋅x^{3}}{(x^{2})^{2}}\\ &=\dfrac{((3x^2)⋅x^{2})−(2x)⋅x^{3}}{(x^{4})}\\ &=\dfrac{x^{4}}{x^{4}}\\ &=1\end{align*}

2. For the functions in ratio $$\frac{x^{4} + x^{2}}{5x^{3}}$$, the quotient rule can be expressed as:

\begin{align*} \dfrac{d}{dx}(\dfrac{f(x)}{g(x)})&=\dfrac{d}{dx}(\dfrac{x^{4} + x^{2}}{5x^{3}})\\ &=\dfrac{\dfrac{d}{dx}(x^{4} + x^{2})⋅5x^{3} − \dfrac{d}{dx}(5x^{3})⋅(x^{4} + x^{2})}{(5x^{3})^{2}}\\ &=\dfrac{(4x^{3} + 2x)⋅5x^{3} − (15x^{2})⋅(x^{4} + x^{2})}{(5x^{3})^{2}}\\ &=\dfrac{20x^{6} + 10x^{4} − 15x^{6} – 15x^{4}}{(5x^{5})}\\ &=\dfrac{5x^{6} – 5x^{4}}{(5x^{5})}\\ &=\dfrac{x^{6} – x^{4}}{x^{5}}\end{align*}

## Chain Rule

The chain rule helps us to find the derivative of composite functions i.e the functions which are in the form $$f(g(x))$$, $$f(g(h(x)))$$ e.t.c. The chain rule plays a vital role in deep learning while performing the backpropagation in a neural network.

For a composite function $$f(g(x))$$, which can be represented as $$y = f(u)$$ and $$u =g(x)$$, the chain rule can be expressed as:

\begin{align*} \dfrac{dy}{dx}=\dfrac{dy}{du}.\dfrac{du}{dx}\end{align*}

For a composite function $$f(g(h(x)))$$, which can be represented as $$y = f(u)$$, $$u = g(k))$$ and $$k =h(x)$$, the chain rule can be expressed as:

\begin{align*} \dfrac{dy}{dx}=\dfrac{dy}{du}.\dfrac{du}{dk}.\dfrac{dk}{dx}\end{align*}

For a composite function $$f(g(h(t(x)))$$, which can be represented as $$y = f(u)$$, $$u = g(k))$$, $$k =h(m)$$ and $$m =t(x)$$ the chain rule can be expressed as:

\begin{align*} \dfrac{dy}{dx}=\dfrac{dy}{du}.\dfrac{du}{dk}.\dfrac{dk}{dm}.\dfrac{dm}{dx}\end{align*}

### Examples:

1. For a composite function $$sin(x^{3})$$, which can be represented as $$u =x^{3}$$ and $$y = sin(u)$$, the chain rule can be expressed as:

\begin{align*} \dfrac{dy}{dx}&=\dfrac{dy}{du}.\dfrac{du}{dx}\\ &=\dfrac{d}{dx}(sin(u)).\dfrac{d}{dx}(x^{3})\\ &=(cos(u)).(2x^{2})\\ &=(cos(x^{3})).(2x^{2})\\ &=2x^{2}cos(x^{3})\end{align*}

2. For a composite function $$2x + 4)^{3}$$, which can be represented as $$u =2x+4$$ and $$y = u^{3}$$, the chain rule can be expressed as:

\begin{align*} \dfrac{dy}{dx}&=\dfrac{dy}{du}.\dfrac{du}{dx}\\ &=\dfrac{d}{dx}(u^{3}).\dfrac{d}{dx}(2x + 4))\\ &=(3(u)^2).(2)\\ &=3(x + 4)^{2}.(2)\\ &=6(x + 4)^{2}\end{align*}

3. For a composite function $$(x^{5}−x^{2})^{8}$$, which can be represented as $$u =x^{5}−x^{2}$$ and $$y = u^{8}$$, the chain rule can be expressed as:

\begin{align*} \dfrac{dy}{dx}&=\dfrac{dy}{du}.\dfrac{du}{dx}\\ &=\dfrac{d}{dx}(u^{8}).\dfrac{d}{dx}(x^{5}−x^{2}))\\ &=(8(u)^7).(5x^{4}-2x)\\ &=8(x^{5}−x^{2})^{7}.(5x^{4}-2x)\end{align*}