# Quantum Chemistry/Multivariable differentiation

Functions dependent on multiple variables require a different approach to differentiation than single variable functions. The partial derivative of a multivariable function is the derivative with respect to one of its variables, with all other variables treated as constants.
The notation convention is like single variable differentiation as the function is written on top of the variable it is differentiated with respect to. A cursive d is used instead of d, and the variables held constant are indicated outside the parentheses in a subscript. For example, the partial derivative of the function $f$ with respect to $x$, holding $y$ constant, is:
$\left({\frac {\partial f}{\partial x}}\right)_{y}$
Partial derivatives show how the function changes as one variable is changing if all others do not change. To determine the change in the function if all variables are changing, partial derivatives where one variable changing is determined for each variable of the function separately.
In two dimensions:
$df(x,y)=\left({\frac {\partial f(x,y)}{\partial x}}\right)_{z}\ +\left({\frac {\partial f(x,y)}{\partial y}}\right)_{x}$
In three dimensions:
$df(x,y,z)=\left({\frac {\partial f(x,y,z)}{\partial x}}\right)_{y,z}\ +\left({\frac {\partial f(x,y,z)}{\partial y}}\right)_{x,z}\ \ +\ \left({\frac {\partial f(x,y,z)}{\partial z}}\right)_{x,y}$
The second partial derivative of a function can be determined from partial differentiation with respect to one variable, and then partial differentiation again with respect to the other variable, the one held constant in the last partial derivative. Second partial derivatives with different sequence of differentiation may not always be equal. In the following two-dimensional example, they are equal:
$\left({\frac {\partial }{\partial y}}\left({\frac {\partial f(x,y)}{\partial x}}\right)_{y}\right)_{x}$
$\left({\frac {\partial }{\partial x}}\left({\frac {\partial f(x,y)}{\partial y}}\right)_{x}\right)_{y}$
Alongside the full notation, it is also common notation to write the order of differentiation as a superscript on the function, then below it the variables of partial differentiation. This does not account for order in which the function is differentiated.
${\frac {\partial ^{2}\ f(x,y)}{\partial x\partial y}}$
Useful rules in calculus can be applied to partial derivatives, such as the chain rule:
$\left({\frac {\partial f(x,y)}{\partial x}}\right)_{y}\ \left({\frac {\partial x}{\partial y}}\right)_{f(x,y)}\left({\frac {\partial y}{\partial f(x,y)}}\right)_{x}=-1$
Partial derivatives are used in the derivation of the time-independent Schrödinger equation, angular momentum, the model for the hydrogen atom, and appears in operators such as the Hamiltonian. It is also used extensively in thermodynamics.

### Example

$\psi (x,y)=A\sin {\left({\frac {n_{x}\pi }{L}}x\right)}\ \sin {\left({\frac {n_{y}\pi }{L}}y\right)}$
The derivative of this wavefunction with respect to $x$:
$\left({\frac {\psi (x,y)}{\partial x}}\right)_{y}=A\sin {\left({\frac {n_{x}\pi }{L}}x\right)}\ \sin {\left({\frac {n_{y}\pi }{L}}y\right)}$
Differentiating with respect to $x$ while holding $y$ constant means $y$ is treated as a constant in differentiation, so only terms with $y$ are differentiated:
$={\frac {\partial }{\partial x}}\left[A\sin {\left({\frac {n_{x}\pi }{L}}x\right)}\right]\sin {\left({\frac {n_{y}\pi }{L}}y\right)}$
$A$ is a constant independent of $x$ so it can be moved out of the differential:
$={\frac {\partial }{\partial x}}\left[\sin {\left({\frac {n_{x}\pi }{L}}x\right)}\right]A\sin {\left({\frac {n_{y}\pi }{L}}y\right)}$
To differentiate the $x$ term, the chain rule is used:
$={\frac {\partial }{\partial x}}\left[{\frac {n_{x}\pi }{L}}x\right]\cos {\left({\frac {n_{x}\pi }{L}}x\right)}A\sin {\left({\frac {n_{y}\pi }{L}}y\right)}$
Once again, constants can be removed from differentiation:
$={\frac {n_{x}\pi }{L}}x{\frac {\partial }{\partial x}}\left[x\right]\cos {\left({\frac {n_{x}\pi }{L}}x\right)}A\sin {\left({\frac {n_{y}\pi }{L}}y\right)}$
$={\frac {n_{x}\pi }{L}}x\ \cos {\left({\frac {n_{x}\pi }{L}}x\ \right)}\ A\ \sin {\left({\frac {n_{y}\pi }{L}}y\right)}$
The derivative of the wavefunction with respect to $y$:
$\left({\frac {\psi (x,y)}{\partial y}}\right)_{x}=A\sin {\left({\frac {n_{x}\pi }{L}}x\right)}\ \sin {\left({\frac {n_{y}\pi }{L}}y\right)}$
Differentiating with respect to $y$ while holding $x$ constant means $x$ is treated as a constant in differentiation, so only terms with $y$ are differentiated:
$=A\sin {\left({\frac {n_{x}\pi }{L}}x\right)}{\frac {\partial }{\partial y}}\left[\sin {\left({\frac {n_{y}\pi }{L}}y\right)}\right]$
To differentiate the $y$ term, the chain rule is used:
$=A\sin {\left({\frac {n_{x}\pi }{L}}x\right)}{\frac {\partial }{\partial y}}\left[\sin {\left({\frac {n_{y}\pi }{L}}y\right)}\right]$
$=A\sin {\left({\frac {n_{x}\pi }{L}}x\right)}\ \cos {\left({\frac {n_{x}\pi }{L}}x\ \right)}\ {\frac {\partial }{\partial y}}\left[{\frac {n_{y}\pi }{L}}y\right]$
Once again, constants can be removed from differentiation:
$=A\sin {\left({\frac {n_{x}\pi }{L}}x\right)}\ \cos {\left({\frac {n_{x}\pi }{L}}x\ \right)}\ {\frac {n_{y}\pi }{L}}\ {\frac {\partial }{\partial y}}\left[y\right]$
$=A\sin {\left({\frac {n_{x}\pi }{L}}x\right)}\ \cos {\left({\frac {n_{x}\pi }{L}}x\ \right)}\ {\frac {n_{y}\pi }{L}}$