# Derivative
**An expression measuring the rate of change of a [[function]] with respect to a change in its input.**
> [!Derivative]
> Let $f$ be a real-valued function defined on an *open interval* containing the point $x$.
>
> $f$ is *differentiable* at $x$ if the limit
> $L=\lim_{h\rightarrow 0}\frac{f(x+h)-f(x)}{h}$
> exists.
>
> The limit $L$ is the *derivative* of $f$ at $x$.
The existence of a derivative of the function $f$ implies that $f$ must also be *continuous* at $x$.
The derivative of a *single variable* function at a point is equal to the *slope of the tangent* to its graph at that point.
>[!Explanation]+
> For *single variable* functions, the *slope* of a *secant* of their graph approximates the
> *rate of change* of the function between the two points of intersection.
>
> If the points of intersection are at $x$ and $x+h$, then
> $\text{rate of change}\approx\text{slope}_{\text{secant}}=\frac{f(x+h)-f(x)}{h}$
> Suppose $h$ *approached zero*. As $h$ decreases, the points of intersection are brought closer together. In the below diagram, this is represented by the secants increasing in opacity.
>
> ![[DerivativeExplanation1.svg]]
> The *limit* of the slopes of the secant as $h$ approaches zero is *equal* to the slope of the *tangent* to the graph at $x$, represented by the brightest line.
>
> As tangents contact a curve at one point, the limit is the *best linear approximation*[^1] of the rate of change of the function at the point $x$. Thus,
> $f'(x)=\lim_{h\rightarrow 0}\frac{f(x+h)-f(x)}{h}$
^1860be
>[!Example]-
> Suppose the derivative of $f(x)=x^{3}$ is to be evaluated at $x=2$.
> $\begin{align*}
> f'(x)&=\lim_{h\rightarrow 0}\frac{f(x+h)-f(x)}{h} \\
> &=\lim_{h\rightarrow 0}\frac{(x+h)^{3}-x^{3}}{h} \\
> &=\lim_{h\rightarrow 0}\frac{x^{3}+3x^{2}h+3xh^{2}+h^{3}-x^{3}}{h} \\
> &=\lim_{h\rightarrow 0}3x^{2}+3xh+h^{2} \\
> &=3x^{2} \\
> \therefore f'(2)&=12
> \end{align*}$
> Shown below is the graph of $x^{3}$ and two copies of the line $12x$, with one shifted to be tangent to the graph at $x=2$.
>
> ![[DerivativeExample1.svg|400]]
The process of determining a derivative is *differentiation* and is the inverse of [[Antiderivative|antidifferentiation]] and [[Integral|integration]]. Differentiation and integration are related by the [[fundamental theorem of calculus]].
Functions defined *implicitly* can also be differentiated through [[implicit differentiation]].
The concept of the derivative can be generalised to functions of *several real variables* with [[Partial Derivative|partial derivatives]].
## Notation
### Leibniz's notation
Leibniz's notation uses $d$ to represent *infinitesimal* increments of a variable, in a similar way to the use of $\Delta$ to represent finite increments. It is commonly used to specify the *variable of differentiation*, i.e. the independent variable.
> The *first derivative* of $y=f(x)$ is denoted as
> $\frac{dy}{dx}\quad\frac{df}{dx}\quad\frac{d}{dx}f$
> The *$n$th derivative* is denoted as
> $\frac{d^{n}y}{dx^{n}}\quad\frac{d^{n}f}{dx^{n}}\quad\frac{d^{n}}{dx^{n}}f$
>[!Explanation]-
> The notation for the $n$th derivative is an *abbreviation* of the repeated application of the *differential operator* $\frac{d}{dx}$, for example:
> $\frac{d^{2}y}{dx^{2}}=\frac{d}{dx}\left(\frac{dy}{dx}\right)$
> The derivative of $y$ at the point $x=a$ is notated as
> $\left.\frac{dy}{dx}\right|_{x=a}$
### Lagrange's notation
Lagrange's notation uses the *prime mark* to denote derivatives. It is used when the derivative is considered as a function itself.
> The *first to third derivatives* of $f(x)$ are denoted as
> $f'(x)\quad f''(x)\quad f'''(x)$
> For *larger orders* derivatives, $f^{(n)}(x)$ is used.
### Euler's notation
Euler's notation uses a $D$ to explicitly symbolise the *differential operator*.
> The *first and $n$th derivative* are denoted as
> $Df(x)\quad D^{n}f(x)$
> A subscript may be attached to the operator to specify the *variable of differentiation*.
> $D_{x}f(x)=Df(x)=f'(x)$
## Differentiation rules
The derivative of any function can be calculated using the definition, though this is often impractical.
Several well-known formulas for derivatives form a set of *differentiation rules* that can be used to determine more complex derivatives.
### Constants
The derivative of any constant $c\in\mathbb{R}$ is *zero*. If $f(x)=c$, then
$f'(x)=0$
### Linearity of differentiation
The derivative of a *linear combination* of functions is equal to the same linear combination of their derivatives.
Commonly this rule is broken down into the *constant factor* and *sum* rule.
>[!Constant factor rule]
> $\frac{d}{dx}a[f(x)]=a[f'(x)]$
^eed876
>[!Sum rule]
> $\frac{d}{dx}[f(x)\pm g(x)]=f'(x)\pm g'(x)$
### Additional rules
- [[Product rule]]
- [[Quotient rule]]
- [[Power rule]]
- [[Reciprocal rule]]
- [[Chain rule]]
- [[Inverse function rule]]
## Extensions
### Partial derivative
A [[partial derivative]] is the derivative of a *multivariable function* with respect to only *one* of its variables, while the others are *treated as constants*.
$\frac{\partial}{\partial x}f\quad f_{x}\quad\partial_{x}f$
![[PartialDerivativesExplanation1.svg|500]]
*The tangent to the red line at some point $x$ is the partial derivative of the function with respect to $x$ when $y=1$.*
### Directional derivative
The [[directional derivative]] of a *multivariable function* $f$ is its derivative in the direction of a vector $\mathbf{v}$ at a point $\mathbf{x}$.
$\nabla_{\mathbf{V}}f(\mathbf{x})\quad f'_\mathbf{v}(\mathbf{x})\quad D_{\mathbf{v}}f(\mathbf{x})$
[^1]: Note the phrasing used. The concept of the derivative equalling the slope of the tangent leads to it often being described as an *"instantaneous rate of change"*, a confusing oxymoron since *"instantaneous"* implies a single point in time whereas *"change"* requires a range of time.