**Vector calculus** is about differentiation and integration of vector fields, primarily in
\(\mathbb{R}^3\) with coordinates \(x,y,z\) and unit vectors \(\hat{\imath},\hat{\jmath},\hat{k}\). Here we will
focus on differentiation.

## Definitions

### Parametric curve

A parametric curve is

a function with one-dimensional input and a multi-dimensional output.

Parametric curves may be expressed as a set of equations, such as $$ f(t)= \left\{ \begin{array}{l} f_x(t)=t^3-3t \\ f_y(t)=3t^2 \end{array} \right. \nonumber $$ or as a vector $$ f(t) = \left\langle \;t^3-3t,\; 3t^2\; \right\rangle \label{eq:parmcurve} $$

### Multi-variable functions

A multi-variable function is a function with more than one argument. This concept extends the idea of a function of one variable to several variables.

In other words, let \(f\) be a function of variables \(x, y, \cdots\), then function \(f(x,y.\cdots)\) is a multi-variable function.

#### Scalar field

When a multi-variable function returns a scalar value for each point, it is called a scalar field.

A scalar field maps \(n\)-dimensional space to real numbers. Scalar fields are commonly visualized as values on a grid of points in the plane. For instance, a weather map showing the temperature \(T\) at each point \((x,y)\) on a map.

For example: scalar field \(z=\sin x + \cos y\), can be plotted with the result encoded as color, or on the \(z\)-axis.

#### Vector field

When a multi-variable function assigns a vector to each point \((x,y)\), it is called a vector field.

Vector fields are commonly visualized as arrows from a grid of points in the plane. This allows a \(n\)-dimensional input and output to be visualized in a \(n\)-dimensional drawing, where the arrows further give an intuition of e.g. fluid or air flow. An example of a vector field is a weather map where the magnitude and angle of the vectors represent the speed and direction of the wind at each point \((x,y)\).

In other words, let \(M,N,\cdots\) be functions of variables \(x,y,\cdots\). Then the function \(\vec{F}\) defined below, is called a vector field. $$ \vec{F}=\hat\imath M + \hat\jmath N +\;\cdots = \left\langle M, N, \cdots \right\rangle $$

The vectors are drawn starting at input \((x,y)\) where the magnitude and direction is determined by \(\vec{F}(x,y)\). For example, the plots for \(\vec{F}=\left\langle\; x,\; y \right\rangle\), and \(\vec{F}=\left\langle\; -y,\; x \right\rangle\) are shown below.

### Rotation

If an object is rotating in two dimensions, you can describe the rotation completely with a single value: the angular velocity, \(\omega=\phi/t\). Where a positive value indicates a counter-clockwise rotation.

For an object rotating in three dimensions, the direction can be described using a 3D vector, \(\vec{\omega}\). The magnitude of the vector indicates the angular speed; the direction indicates the axis around which it tends to swirl.

The direction of the angular velocity is determined by the convention called the **right-hand rule for rotation**:

When the object is rotating counter-clockwise, the direction of angular velocity is along with the circular path directed upwards.

## Differentiation

**Del (\(\nabla\))** is a shorthand form to simplify long mathematical expressions such as the Maxwell
equations. Think of this symbol as loosely representing a vector of partial derivative operators
$$
\newcommand{pdv}[1]{\tfrac{\partial}{\partial #1}}
\nabla
=
\hat{\imath}\pdv{x} +
\hat{\jmath}\pdv{y} +
\hat{k}\pdv{z}
$$
Or, in vector notation
$$
\newcommand{pdv}[1]{\tfrac{\partial}{\partial #1}}
\nabla
=
\left\langle
\pdv{x},
\pdv{y},
\pdv{z}
\right\rangle
$$

Depending how \(\nabla\) is applied, it may denote: a gradient scalar field; the divergence of a vector field; or the curl of a vector field. Each of these are described below.

### Gradient

Let \(f\) be a scalar field with variables \(x,y,z\). The vector derivative of the scalar field \(f(x,y,z)\) is defined as the gradient. Denoted as the \(\nabla\) “multiplied” by a scalar field \(f\) $$ \newcommand{pdv}[1]{\tfrac{\partial}{\partial #1}} \begin{align} \nabla f &=\left\langle \pdv{x}, \pdv{y}, \pdv{z} \right\rangle f \\ &= \left\langle \pdv{x}f, \pdv{y}f, \pdv{z}f \right\rangle \end{align} $$

The gradient of \(f\) at point \((x,y)\) is a vector that points in the direction that makes the function \(f\) increase the fastest. The magnitude of the gradient at point \((x,y)\) equals the slope in that direction.

#### Example

Find the gradient for scalar field \(f(x,y,z)=x+y^2+z^3\) $$ \newcommand{pdv}[1]{\tfrac{\partial}{\partial #1}} \begin{align*} \nabla f &=\left\langle \pdv{x}, \pdv{y}, \pdv{z} \right\rangle f \\ &=\left\langle \pdv{x}f, \pdv{y}f, \pdv{z}f \right\rangle \\ &=\left\langle 1, 2y, 3z^2 \right\rangle \end{align*} $$

### Divergence

For intuition, picture the vector field as a fluid where each vector describes the velocity at that point. Around some points, where all vectors point outward, the fluid just springs in to existence, as if there is a source. A positive divergence tells you how much of a source it is. Divergence is also positive if there is more flowing out than in that point.

Let \(\vec{v}\) be a vector field where \(v_x,v_y,v_z\) are each functions of variables \(x,y,z\). $$ \vec{v} = \left\langle v_x, v_y, v_z \right\rangle $$

The divergence of vector field \(\vec{v}\) is written as a dot-product $$ \newcommand{pdv}[1]{\tfrac{\partial}{\partial #1}} \begin{align} \nabla \cdot \vec{v} &=\left\langle \pdv{x}, \pdv{y}, \pdv{z} \right\rangle \cdot \left\langle v_x, v_y, v_z \right\rangle \\ &=\pdv{x}v_x + \pdv{y}v_y + \pdv{z}v_z \end{align} $$

When the divergence at point \((x,y)\) is positive, the density increases. In other words, more is coming in than is leaving at that point. For example the electric field of two electric charges

#### Example

Find the divergence for vector field \(\vec{v}(x,y,z)=\left\langle xy,yz,xz\right\rangle\) $$ \newcommand{pdv}[1]{\tfrac{\partial}{\partial #1}} \begin{align*} \nabla \cdot \vec{v} &=\left\langle \pdv{x}, \pdv{y}, \pdv{z} \right\rangle \cdot \left\langle xy,yz,xz\right\rangle \\ &= \pdv{x}xy + \pdv{y}yz + \pdv{z}xz \\ &= y + z + x = x + y + z \end{align*} $$ The result is a scalar.

### Curl

For intuition, think about the vector field as a fluid flow. Imagine placing a tiny paddlewheel into the vector field at a point. Would it spin around? If it spins clockwise, it is said to have positive curl.

Let \(\vec{v}\) be a vector field where \(v_x,v_y,v_z\) are each functions of variables \(x,y,z\). $$ \vec{v} = \left\langle v_x, v_y, v_z \right\rangle $$

The curl (rotation) of vector field \(\vec{v}\) is written as a cross-product. $$ \newcommand{pdv}[1]{\tfrac{\partial}{\partial #1}} \begin{align} \nabla \times \vec{v} &=\left\langle \pdv{x}, \pdv{y}, \pdv{z} \right\rangle \times \left\langle v_x, v_y, v_z \right\rangle \end{align} $$

The cross product can be computed using the pseudo-determinant. $$ \require{color} \newcommand{pdv}[1]{\tfrac{\partial}{\partial #1}} \begin{align} \nabla \times \vec{v} &=\begin{vmatrix} \color{red}{\hat{\imath}} & \color{green}{\hat{\jmath}} & \color{blue}{\hat{z}} \\ \color{red}{\pdv{x}} & \color{green}{\pdv{y}} & \color{blue}{\pdv{z}} \\ \color{red}{v_x} & \color{green}{v_y} & \color{blue}{v_z} \end{vmatrix} \\ &=\color{red}{\hat\imath} \begin{vmatrix} \color{green}{\pdv{y}} & \color{blue}{\pdv{z}} \\ \color{green}{v_y} & \color{blue}{v_z} \end{vmatrix} – \color{green}{\hat\jmath} \begin{vmatrix} \color{red}{\pdv{x}} & \color{blue}{\pdv{z}} \\ \color{red}{v_x} & \color{blue}{v_z} \end{vmatrix} + \color{blue}{\hat z} \begin{vmatrix} \color{red}{\pdv{x}} & \color{green}{\pdv{y}} \\ \color{red}{v_x} & \color{green}{v_y} \end{vmatrix} \\ &=\left\langle \begin{array}{c} \color{green}{\pdv{y}} \color{blue}{v_z} – \color{blue}{\pdv{z}} \color{green}{v_y} \\ \color{blue}{\pdv{z}} \color{red}{v_x} – \color{red}{\pdv{x}} \color{blue}{v_z} \\ \color{red}{\pdv{x}} \color{green}{v_y} – \color{green}{\pdv{y}} \color{red}{v_x} \end{array} \right\rangle \end{align} $$

#### Example

Find the curl for vector field \(\vec{v}(x,y,z)=\left\langle xy,yz,xz\right\rangle\) $$ \newcommand{pdv}[1]{\tfrac{\partial}{\partial #1}} \begin{align*} \nabla \times \vec{v} &= \left\langle \pdv{x}, \pdv{y}, \pdv{z} \right\rangle \times \left\langle xy,yz,xz\right\rangle \\ &= \begin{vmatrix} \hat\imath & \hat\jmath & \hat z \\ \pdv{x} & \pdv{y} & \pdv{z} \\ xy & yz & xz \end{vmatrix} \\ &= \left\langle \pdv{y}xz – \pdv{z}yz, -\left(\pdv{x}xz – \pdv{z}xy\right), \pdv{x}yz – \pdv{y}xy \right\rangle \\ &= \left\langle 0 – y, -(z – 0), 0 – x \right\rangle \\ &=\left\langle -y, -z, -x \right\rangle \end{align*} $$ The result is a vector.

## Notes

If you prefer a visual explanation of divergence and curl, refer to YouTube