# Calculus/Differentiation
## Prerequisites

In order to understand and calculate derivatives, one must understand the following topics:
Calculus/Limits
Geometry

## Introduction to Differentiation

Differentiation is the process of finding the unique slope of a line at any point on that line, should such a slope exist. As we shall show, there are commonplace functions that fail this requirement at some point.
Generally, a slope can be found by taking the change in y-coordinates divided by the change in x-coordinates or:
${\frac {(y_{2}-y_{1})}{(x_{2}-x_{1})}}={\frac {\Delta y}{\Delta x}}=m$
where m is the slope.
Now what happens when we attempt to take the slope of a point on a line, or how fast the y's are changing in respect to the x's at a single point? The formula fails when $\Delta x$ or $\Delta y=0$
In order to do this, we have to undergo differentiation.

## Definition of a Derivative

The following formula will calculate the slope of a line at any point:
$f^{\prime }(x)=\lim _{h\to 0}{\frac {f(x+h)-f(x)}{h}}$
where $f^{\prime }$ indicates the derivative, and h is the difference between a point h units away from x and x
Given $f(x)=3x^{2}$, to find the derivative of f(a) (where a is any x coordinate within the domain of f(x)), use the definition of derivative.
$f^{\prime }(x)=\lim _{h\to 0}{\frac {3(a+h)^{2}-3a^{2}}{h}}$
Here's an exercise to try:
Find $f^{\prime }(2)$, given that $f(x)=4x^{2}$. The solution is below.
$f^{\prime }(2)=\lim _{h\to 0}{\frac {4(2+h)^{2}-16}{h}}=\lim _{h\to 0}{\frac {4(4+4h+h^{2})-16}{h}}=\lim _{h\to 0}{\frac {16+16h+4h^{2}-16}{h}}=\lim _{h\to 0}{\frac {16h+4h^{2}}{h}}=\lim _{h\to 0}(16+4h)=16$
Therefore, the slope of 4x^2 at x=2 is 16.
This is a somewhat tedious process when bigger functions are involved. Take for example:
$f(x)=3x^{6}+sin^{2}x-12^{x}+5$
Using the definition of derivative, your equation looks like this:
$f^{\prime }(x)=\lim _{h\to 0}{\frac {(3(x+h)^{6}+sin^{2}(x+h)-12^{(x+h)}+5)-(3x^{6}+sin^{2}(x)-12^{x}+5)}{h}}$
Have fun solving that algebraically!
Luckily, this is where rules for derivatives come in.

## Where Derivation Fails

Two examples of commonplace functions either have ambiguous derivatives or none at some point. The absolute value function has an ambiguous derivative at x=0 For |x|, |x| = -x and the derivative of |x| is -1 if x < 0. |x| = x and the derivative of |x| is 1 if x > 0. But if x=0, then |x|, x, and -x are all zero. No matter how close a number is to zero, the derivative of |x| is 1 for x > 0 but -1 for any x less than zero. Because one cannot determine whether the derivative of |x| is -1, 1, or something else at x=0, one has an ambiguous derivative at x=0... and thus none.
Another function that most off us know well is 1/x. For f(x) = 1/x
$f^{\prime }(x)=\lim _{h\to 0}{\frac {f(x+h)-f(x)}{h}}$ implies
$f^{\prime }(1/x)=\lim _{h\to 0}{\frac {f(1/(x+h))-f(1/x)}{h}}$
$f^{\prime }(1/x)=\lim _{h\to 0}{\frac {(x/x(x+h))-(x+h)/x(x+h)}{h}}$
$f^{\prime }(1/x)=\lim _{h\to 0}{\frac {(x-(x+h))}{hx(x+h)}}$
$f^{\prime }(1/x)=\lim _{h\to 0}{\frac {-h}{hx(x+h)}}$
$f^{\prime }(1/x)=\lim _{h\to 0}{\frac {-1}{x(x+h)}}$
$f^{\prime }(1/x)=\lim _{h\to 0}{\frac {-1}{x^{2}}}$
$f^{\prime }(1/x)={\frac {-1}{x^{2}}}$
No derivative of 1/x can exist at x=0.

## Derivative Rules

In the following table, f(x) and g(x) are functions whereas "a" is a constant number. f'(x) and g'(c) are the derivatives of the functions f(x) and g(x), respectively.
| Rule Name | Original Function | Derivative |
| Chain Rule | f(g(x)) | f'(g(x))•g'(x) |
| constant function derivative | a | 0 |
| Addition Rule | f(x)+g(x) | f'(x)+g'(x) |
| ??? | x | 1 |
| Scalar Rule | a•f(x) | a•f'(x) |
| Power Rule | (f(x))$^a$ | a•(f(x))$^{a-1}$ˆ•f'(x) |
| Product Rule | f(x)•g(x) | f(x)•g'(x) + g(x)•f'(x) |
| Quotient Rule | f(x)/g(x) | (g(x)•f'(x) - f(x)•g'(x)) / (g(x))$^2$ |
| derivative of trigonometric function | sin(x) | cos(x) |
| derivative of trigonometric function | cos(x) | -sin(x) |
| derivative of trigonometric function | tan(x) | sec$^2$(x) |
| derivative of trigonometric function | ln(x) | 1/x |
| derivative of trigonometric function | e$^x$ | e$^x$ |