 ## Differentiation From First Principles

Recall that when finding the gradient of a straight line, one can choose two points on the line and calculate the rise over run. When finding the gradient of a point on a curve, one must find the gradient of the tangent at that point. This can be done by calculating rise over run for two points on the tangent but these will not be points that lie on the curve. By taking two points on the curve that lie very closely together, the straight line between them will have approximately the same gradient as the tangent there.

Suppose we want to find the gradient of the curve of $y=f(x)$ at a general point $x$. Take another point close by $x+h$ where $h$ is small. The two points have corresponding $y$ coordinates $f(x)$ and $f(x+h)$ and so rise over run is given by $\frac{f(x+h)-f(x)}{x+h-x}$. By taking $h$ to be as small as possible, i.e. the limit as $h$ tends to 0, then rise over run will be the same as the gradient of the tangent. This is known as DIFFERENTIATION FROM FIRST PRINCIPLES: $f$

Example 1 – Differentiate $y=x^2$ from first principles. $\frac{dy}{dx}=\lim_{h\rightarrow 0}\frac{(x+h)^2-x^2}{h}=\lim_{h\rightarrow 0}\frac{x^2+2xh+h^2-x^2}{h}=\lim_{h\rightarrow 0}(2x+h)=2x$

Example 2 – Differentiate $y=2x^3$ from first principles. $\frac{dy}{dx}=\lim_{h\rightarrow 0}\frac{2(x+h)^3-2x^3}{h}=\lim_{h\rightarrow 0}\frac{2x^3+6x^2h+6xh^2+2h^3-2x^3}{h}$ $=\lim_{h\rightarrow 0}(6x^2+6xh+2h^2)=6x^2$