# Fundamentals of Calculus, Special Relativity and Quantum mechanics/Derivatives

The field of calculus is based upon three fundamental concepts: the limit, the derivative, and the integral. Of these, the limit is the most fundamental and is the basis of the derivative and the integral. This chapter will introduce the limit, and then build the derivative from it. The following chapter, Integrals, will introduce the integral. This text assumes that the reader is already familiar with the basic concept of functions in one or more dimensions and their notation (e.g. $f(x)=y$ or $f(x,y)=z$).

## Limit

A limit is written like this:
    $\lim _{x\to X}f(x)=Y$
which is read as "the limit as $x$ approaches $X$ of $f(x)$ equals $Y$." This means that as the input variable $x$ of the function is given values which get arbitrarily closer to the specified value $X$, the output $f(x)$ will get arbitrarily closer to the limit value $Y$. For those interested, this principle can be used to precisely define a limit with an Epsilon-Delta Argument.
The figure on the right is a graphical representation of the following limit:
    $\lim _{x\to 2}f(x)=f(2)$
This may at first seem like a trivial statement, but many limits encountered later in the study of calculus are not so straightforward. Here, the specified value for the function input variable is $2$, and arbitrarily close values of $x$ are represented by $2+\delta$ and $2-\delta$. Similarly, the limit value here is $f(2)$, and arbitrarily close values of $f(x)$ are represented by $f(2)+\varepsilon$ and $f(2)-\varepsilon$. Based on the graph, one can see that as any $x$ value within $2\pm \delta$ is set closer to $2$, the corresponding $f(x)$ value, falling within $f(2)\pm \varepsilon$, will come closer to $f(2)$. Thus, this limit equals, or is defined as, $f(2)$.
Limits may not always be defined at any given point. A simple example of this occurs when a function has an asymptote at $X$, and the only value that $f(x)$ continues to approach is infinity! In this case, we have a limit equal to infinity, which is not defined:
    $\lim _{x\to X}f(x)=\infty$
Limits can also be defined in any number of dimensions which introduces another possible scenario for an undefined limit. The principle is the same, that as the input variables approach some specified value, the output approaches the limit value. With more input variables, however, the possibility exists that the output will approach different limit values when different input variables are considered individually. In this case, the limit is not defined.
Whether or not a limit is defined at a certain point or set of points in the domain of a function will become important if one wishes to work with the function's derivatives and integrals. This will be made clearer in the sections that follow.

## First derivative

A derivative is a function that describes the rate of change of another function. Arguably the most basic form of the derivative, the first derivative can be conceptualized using the graph of a function. The first derivative of a function $y=f(x)$ gives the rate of change of $y$ per change in $x$. Consider the graph of the function $f(x)=x$, drawn in the first figure on the right. In this function, it is clear that if $x$ increases by one unit, $y$ also increases by one unit. This means that the rate of change of $y$ per change in $x$ is one unit per unit, or simply one. This implies that the first derivative of this function is always equal to one, which is written like this:
    ${\frac {\mathrm {d} y}{\mathrm {d} x}}=1$
Note that from basic algebra, the slope of the function $f(x)=x$ is one. So in this case, the derivative of the function is equal to the slope of the function. The $\mathrm {d}$ symbol here is called a differential element, and represents an extremely small change. So, the derivative as written here is an extremely small change in $y$ divided by an extremely small change in $x$. This is commonly used as notation for a first derivative, but it is not a formal definition. The formal definition of a first derivative gives a formula that describes the rate of change of the function at hand, and uses a limit to extablish the "extremely small change" mentioned above. It is as follows:
    $\lim _{h\to 0}{\frac {f(x+h)-f(x)}{h}}$
Here, the change in $x$ is represented by $h$, and the change in $y$ is put in the form of (final - initial). In this case, the initial value is given by $f(x)$ and the final by $f(x+h)$. Bearing this in mind, the quotient contained within the limit will clearly give the average rate of change between any two points on the graph, separated by some $h$.
This can be represented visually by drawing a secant line between the two points, as shown in the second figure on the right. Again from algebra, it is clear that the quotient discussed previously is equal to the slope of this secant line. This slope is of course constant across the entire secant line, since it is in fact a line. The instantaneous rate of change of the graphed function, however, is not constant. As the value of $x$ increases, the value of $y=f(x)$ starts to increase more and more per $x$. Based on its conceptual definition, a first derivative should represent this rate of change at any specific point in the function, and not a single average value across an interval of the function. So the slope of the secant line here is not consistent with the derivative of the function.
This is where the limit comes in. For any value of $h$ this secant line will give the average rate of change across an interval, and not the rate of change at a single point. The rate of change at a point can be represented instead by a tangent line, a line that touches only one point within the function. The two-point quotient can be made use of here by setting the $x$ distance between the two points, or $h$ to zero. This would place a zero in the denominator, however, leaving the quotient undefined. To get around this, the limit of the quotient $\lim _{h\to 0}$ can instead be considered.
When evaluated, this limit will yield a new function (rather than simply a constant value, as in the first example) that gives the slope of tangent line at any point on the original function. This new function is the first derivative of the original function.

## Differentiability

A first derivative may not be defined at every point on every function. If the first derivative of a function $f(x)$ is defined for some point $x$, then $f(x)$ is said to be differentiable at $x$. If the derivative exists for every point in the domain of a function, one can simply state that the entire function is a differentiable function.
Consider a point in the domain of a function such that the function is not differentiable at that point. The derivative of the function does not exist here. Conceptually, this means that no unique tangent line can be drawn at this point. A simple example of this phenomenon is the absolute value function, $f(x)=|x|$, drawn in the next figure on the right. Consider the point at $x=0$. Here, the graph comes to a sharp corner, and one can see that any number of tangent lines could be drawn. Thus the derivative of this function is not clearly defined here, and the function is not differentiable at this point.
Mathematically, this means that the definition of the first derivative is not defined. For any point where $f(x)$ is defined, this only occurs when the limit $\lim _{h\to 0}$ does not exist.

## Multiple Derivatives

The second derivative of a function is simply the derivative of the first derivative of the function. Similarly, the third derivative is the derivative of the second derivative. This idea can be extended to form any number of subsequent derivatives, where the nth derivative of $y=f(x)$ is typically written as:
    ${\frac {\mathrm {d} ^{n}y}{\mathrm {d} x^{n}}}$
A conceptual example of this principle comes from basic physics. If the function $f(x)$ represents the position of an object, than the first derivative of the function would represent the rate of change of the objects position, defined as its velocity. The second derivative would represent the rate of change of the object's velocity, defined as its acceleration. The third derivative would represent the rate of change of the object's acceleration (commonly referred to as "jerk"), and so on.
For some functions, only a finite number of derivatives may be taken before the resulting function is no longer differentiable. For others, another derivative may always be taken, regardless of how many derivatives have already been taken. Such functions are said to be infinitely differentiable.

## Partial derivatives

A partial derivative is used when a function depends on more than one variable. It also gives the rate of change of the function output, but with respect to only of one input variable, while the others are held constant. Consider a function $w=f(x,y,z)$. The three partial derivatives with respect to $x$, $y$, and $z$ would be written as:
    ${\frac {\partial w}{\partial x}},{\frac {\partial w}{\partial y}},{\frac {\partial w}{\partial z}}$
which is read is "the partial derivative of $w$ with respect to $x$", or simply "partial $w$, partial $x$" (and similarly for $y$ and $z$. The $\partial$ symbol, read as "partial", still represents a differential element, the same as $\mathrm {d}$. The difference in notation is simply used to make a clearer distinction between partial derivatives and the non-partial derivatives discussed previously, known as ordinary derivatives. The principles of differentiability and multiple derivatives apply to partial derivatives just as they do to ordinary derivatives.

## Notation

Over the years, several systems of notation for derivatives have been developed. It is advisable that students of calculus familiarize themselves with each of these. The table below lists some examples of the four main notation systems, each writing the same four derivatives of the function $y=f(x)$. The example derivatives are, from left to right, the first ordinary derivative with respect to $x$, the second ordinary derivative with respect to $x$, the first partial derivative with respect to $x$, and the second partial derivative with respect to $x$.
| Leibniz's Notation | Lagrange's Notation | Euler's Notation | Newton's Notation |
| ${\frac {\mathrm {d} y}{\mathrm {d} x}},{\frac {\mathrm {d} ^{2}y}{\mathrm {d} x^{2}}},{\frac {\partial y}{\partial x}},{\frac {\partial ^{2}y}{\partial x^{2}}}$ | $f'(x),f''(x),f_{x},f_{xx}$ | $Df,D^{2}f,\partial _{x}f,\partial _{xx}f$ | ${\dot {y}},{\ddot {y}}$ |
Of these, Leibniz's notation is considered by many to be the most unambiguous, and will be the convention used in this text. It is worth noting that Newton's notation is often only used under specific circumstances in mechanics, where the independent variable represents time and the derivative subsequently represents a rate of change per unit time, such as a velocity. While notation for partial differentiation does exist in this system, it is not straightforward and an example is not given here. It is recommended that the reader refer to the Wikipedia article on Notation for Differentiation for details on the nuances of these notation systems.