# Differentiation

### Derivatives

###### Basic Form

If $$y = ax^n$$ then $$y' = a \:.\: n \:.\: x^{n - 1}$$

Example 01

\begin{equation*} \begin{split} y & = 2x^7 \\\\ y' & = 2 \:.\: 7 \:.\: x^{7-1} \\\\ y' & = 14 \:.\: x^6 \end{split} \end{equation*}

Example 02

\begin{equation*} \begin{split} y & = 4x \\\\ y & = 4 \:.\: x^1\\\\ y' & = 4 \:.\: 1 \:.\: x^{1-1} \\\\ y' & = 4 \:.\: x^0 \\\\ y' & = 4 \end{split} \end{equation*}

Example 03

\begin{equation*} \begin{split} y & = 5 \\\\ y & = 5 \:.\: x^0\\\\ y' & = 5 \:.\: 0 \:.\: x^{0-1} \\\\ y' & = 0 \end{split} \end{equation*}

A function can be differentiated several times. Second derivative is differentiation of the first derivative.

Example 04

\begin{equation*} \begin{split} y & = 5x^3 \\\\ y' & = 5 \:.\: 3 \:.\: x^{3-1} \quad {\color {blue} \text{(first derivative)}}\\\\ y' & = 15 \:.\: x^2 \\\\ y'' & = 15 \:.\: 2 \:.\: x^{2 - 1} \quad {\color {blue} \text{(second derivative)}}\\\\ y'' & = 30 \:.\: x \end{split} \end{equation*}

Notations of Derivative

 First derivative $$y'$$ $$\dfrac {dy}{dx}$$ Second derivative $$y''$$ $$\dfrac {d^2y}{dx^2}$$
###### Chain Rule

$$\dfrac {dy}{dx} = \dfrac {dy}{du} \:.\: \dfrac {du}{dx}$$

Chain rule can be used to differentiate some functions with different parameter.

Example 05

Given that $$y (u) = u^2 + 5u$$ and $$u (x) = 3x$$. Determine $$\dfrac {dy}{dx}$$

\begin{equation*} \begin{split} y (u) & = u^2 + 5u \\\\ \dfrac {dy}{du} & = 2u + 5 \end{split} \end{equation*}

\begin{equation*} \begin{split} u (x) & = 3x \\\\ \frac {du}{dx} & = 3 \end{split} \end{equation*}

\begin{equation*} \begin{split} \frac {dy}{dx} & = \frac {dy}{du} \:.\: \frac {du}{dx} \\\\ \frac {dy}{dx} & = (2u + 5) \:.\: 3 \\\\ \frac {dy}{dx} & = 6u + 15 \\\\ \frac {dy}{dx} & = 6(3x) + 15 \\\\ \frac {dy}{dx} & = \bbox[5px, border: 2px solid magenta] {18x + 15} \end{split} \end{equation*}

Another use of chain rule is to differentiate some complex functions.

Example 06

Differentiate $$y = (3x + 2)^5$$

Method 1

Let $$u = 3x + 2$$, then $$y = u^5$$

$$y = u^5 \rightarrow \dfrac {dy}{du} = 5 \:.\: u^4$$

$$u = 3x + 2 \rightarrow \dfrac {du}{dx} = 3$$

\begin{equation*} \begin{split} \frac {dy}{dx} & = \frac {dy}{du} \:.\: \frac {du}{dx} \\\\ \frac {dy}{dx} & = 5 \:.\: u^4 \:.\: 3 \\\\ \frac {dy}{dx} & = 15 \:.\: u^4  \\\\ \frac {dy}{dx} & = \bbox[5px, border: 2px solid magenta] {15 \:.\: (3x + 2)^4} \end{split} \end{equation*}

Method 2

\begin{equation*} \begin{split} y & = ({\color {red} 3x + 2})^5 \\\\ \frac {dy}{dx} & = 5 \:.\: {\color {red} 3} \:.\: (3x + 2)^4 \\\\ \frac {dy}{dx} & = \bbox[5px, border: 2px solid magenta] {15 \:.\:  (3x + 2)^4} \end{split} \end{equation*}