# Mathematical Preliminary for EM

Derivative gives us relationship between two small increments of variables.

If we have a one-dimensional function $f(x)$,

$df = \left(\frac{df}{dx}\right) dx$

gives the relationship between $df$ and $dx$

$\nabla f = \cfrac{1}{h_i}{\partial f \over \partial q^i} \mathbf{e}^i$
If we have a 3-dimensional function $f(x,y,z)$, the derivative will have to give us the relationship between $df$ and $d\vec{r} = (dx,dy,dz)$.
This kind of derivative is called gradient.
As we know $df$ can be represented as below using partial derivatives:
$df = \left(\frac{\partial f}{\partial x}\right)dx + \left(\frac{\partial f}{\partial y}\right)dy + \left(\frac{\partial f}{\partial z}\right)dz$
So, in Cartesian coordinates, we can define gradient as follows
$\nabla f \equiv \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z} \right)$
so we can write $df = \nabla f \cdot d\vec{r}$

#### Cylindrical coordinates

$\nabla f={\partial f \over \partial \rho}\hat{\boldsymbol \rho} + {1 \over \rho}{\partial f \over \partial \varphi}\hat{\boldsymbol \varphi} + {\partial f \over \partial z}\hat{\mathbf z}$

#### Spherical coordinates

$\nabla f={\partial f \over \partial r}\hat{\mathbf r}+ {1 \over r}{\partial f \over \partial \theta}\hat{\boldsymbol \theta}+ {1 \over r\sin\theta}{\partial f \over \partial \varphi}\hat{\boldsymbol \varphi}$

## Divergence

$\nabla\cdot\mathbf{A} = \cfrac{1}{\prod_j h_j} \frac{\partial }{\partial q^i}(A^i\prod_{j\ne i} h_j)$
Or, more explicitly in 3-dim,
$\nabla\cdot\mathbf{A} = \cfrac{1}{h_1h_2h_3} \left[ {\partial\over\partial q_1}(A_1h_2h_3) + {\partial\over\partial q_2}(A_2h_3h_1) + {\partial\over\partial q_3}(A_3h_1h_2) \right]$

#### Cartesian coordinates

$\nabla\cdot\mathbf{A} = {\partial A_x \over \partial x} + {\partial A_y \over \partial y} + {\partial A_z \over \partial z}$

#### Cylindrical coordinates

$\nabla\cdot\mathbf{A} = {1 \over \rho}{\partial \left( \rho A_\rho \right) \over \partial \rho} + {1 \over \rho}{\partial A_\varphi \over \partial \varphi} + {\partial A_z \over \partial z}$

#### Spherical coordinates

$\nabla\cdot\mathbf{A} = {1 \over r^2}{\partial \left( r^2 A_r \right) \over \partial r} + {1 \over r\sin\theta}{\partial \over \partial \theta} \left( A_\theta\sin\theta \right) + {1 \over r\sin\theta}{\partial A_\varphi \over \partial \varphi}$

## Curl

$\nabla\times\mathbf{A} = \frac{1}{h_1h_2h_3} \mathbf{e}_i \epsilon_{ijk} h_i \frac{\partial (h_k A_k)}{\partial q^j}$
where $\epsilon_{ijk}$ is the Levi-Civita symbol.
Or, more explicitly,
$\nabla\times\mathbf{A} = \frac{1}{h_1h_2h_3} \left| \begin{array}{ccc} h_1\textbf{e}_1 & h_2\textbf{e}_2 & h_3\textbf{e}_3 \\ {\partial\over\partial q_1} & {\partial\over\partial q_2} &{\partial\over\partial q_3} \\ h_1A_1 & h_2A_2 & h_3A_3 \end{array} \right|$

#### Cartesian coordinates

$\nabla\times\mathbf{A} = \left(\frac{\partial A_z}{\partial y} - \frac{\partial A_y}{\partial z}\right) \hat{\mathbf x} + \left(\frac{\partial A_x}{\partial z} - \frac{\partial A_z}{\partial x}\right) \hat{\mathbf y} + \left(\frac{\partial A_y}{\partial x} - \frac{\partial A_x}{\partial y}\right) \hat{\mathbf z}$

#### Cylindrical coordinates

$\nabla\times\mathbf{A} = \left( \frac{1}{\rho} \frac{\partial A_z}{\partial \varphi} - \frac{\partial A_\varphi}{\partial z} \right) \hat{\boldsymbol \rho} + \left( \frac{\partial A_\rho}{\partial z} - \frac{\partial A_z}{\partial \rho} \right) \hat{\boldsymbol \varphi} + \frac{1}{\rho} \left( \frac{\partial \left( \rho A_\varphi\right) }{\partial \rho} - \frac{\partial A_\rho}{\partial \varphi} \right) \hat{\mathbf z}$

#### Spherical coordinates

$\nabla\times\mathbf{A} = \frac{1}{r\sin\theta} \left(\frac{\partial}{\partial \theta} \left(A_\varphi\sin\theta \right) - \frac{\partial A_\theta}{\partial \varphi} \right) \hat{\mathbf r} + \frac{1}{r} \left( \frac{1}{\sin\theta} \frac{\partial A_r}{\partial \varphi} - \frac{\partial}{\partial r} \left( r A_\varphi \right) \right) \hat{\boldsymbol \theta} {}+ \frac{1}{r} \left( \frac{\partial}{\partial r} \left( r A_{\theta} \right) - \frac{\partial A_r}{\partial \theta} \right) \hat{\boldsymbol \varphi}$

## Laplacian

$\nabla^2 f = \nabla\cdot\nabla f = \frac1{r^2}\frac{\partial}{\partial r}\left( r^2\frac{\partial f}{\partial r}\right)+\frac1{r^2\sin\theta}\frac{\partial}{\partial\theta}\left(\sin\theta\frac{\partial f}{\partial\theta}\right) + \frac1{r^2\sin^2\theta}\frac{\partial^2f}{\partial\phi^2}$
$\nabla^2\mathbf{A} = \nabla\cdot\nabla \mathbf{A} = ?$