
\section{Introduction to Vector Fields}\label{sec:vectorFields}
A \textbf{vector field} is a mapping $\mathbf{F} : \mathbb{R}^n \supset D \rightarrow \mathbb{R}^n$ which sends vectors $\mathbf{x} \in D$ to vectors $\mathbf{F} (\mathbf{x})$ in the same space. Here, $D$ is the \textbf{domain} of $\mathbf{F}$, and we usually assume that $n=2$ or $n=3$.
For vector fields in $\mathbb{R}^3$,  we will use the component notation
$$
\mathbf{r} = \langle x, y, z \rangle \in \mathbb{R}^3 \Rightarrow \mathbf{F}(\mathbf{r}) = F_1 (x,y,z) \mathbf{i} + F_2 (x,y,z) \mathbf{j} + F_3 (x,y,z) \mathbf{k},
$$
where the functions $F_i : \mathbb{R}^3 \rightarrow \mathbb{R}$ (the component functions of $\mathbf{F}$) are scalar-valued. In $\mathbb{R}^2$, the notation is similar except that we only have 2 components and 2 variables. We will say that a vector field is \textbf{smooth}, or $C^1$, if all its component functions are $C^1$. We will also refer to a function $f : \mathbb{R}^n \supset D \rightarrow \mathbb{R}$ as a \textbf{scalar field}.

\begin{figure}[h]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width =\linewidth]{figures/21fig1.png}
\caption{A vector field in $\mathbb{R}^2$.  At each point $(x,y)$, we attach the vector $\mathbf{F}(x,y)$.  An example is shown when $(x,y) = (5,-5)$.}
\end{minipage}
\end{figure}

\begin{figure}[h!]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width =.55\linewidth]{figures/21fig2.png}
\caption{The vector field $\mathbf{F}(x,y) = \mathbf{a}$.}
\label{21fig2}
\end{minipage}
\end{figure}

\begin{figure}[h!]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width =.55\linewidth]{figures/21fig3.png}
\caption{The vector field $\mathbf{F}(x,y) = x \mathbf{i} + y \mathbf{j}$. }
\label{21fig3}
\end{minipage}
\end{figure}

\begin{figure}[h!]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width = .55\linewidth]{figures/21fig4.png}
\caption{The vector field  $\mathbf{F}(x,y) = -y \mathbf{i} + x \mathbf{j}$.}
\label{21fig4}
\end{minipage}
\end{figure}

\subsection{Examples of Vector Fields from Physics} In physics, vector fields arise naturally as \textbf{force fields} or \textbf{velocity fields}.  We take some time to look at a few examples.

\begin{example}
The \textbf{gravitational field} in $\mathbb{R}^3$ describes the force exerted by a stationary object of mass $M>0$ (typically, large), placed at the origin, on a smaller moving object of mass $m>0$. This field is given by the expression
\begin{equation}\label{21eq-1}
\mathbf{F} (\mathbf{r}) = -\frac{G Mm\mathbf{r}}{\vert \mathbf{r} \vert^3} = \frac{GMm}{\vert \mathbf{r} \vert^2} \left(- \frac{\mathbf{r}}{\vert \mathbf{r} \vert} \right),
\end{equation}
where $G > 0$ is the gravitational constant.  Notice that, due to the`` $-$'' coefficient, all of the vectors point towards the origin, with magnitude $\vert \mathbf{F} (\mathbf{r}) \vert = \frac{GMm}{\vert \mathbf{r} \vert^2}$.

\begin{figure}[h!]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width =\linewidth]{figures/21fig5.png}
\caption{A gravitational field in $\mathbb{R}^3$.}
\end{minipage}
\end{figure}
\end{example}


\begin{example}
An \textbf{electrostatic force field} in $\mathbb{R}^3$ describes the force exerted by a stationary electric charge $q_0$ placed at the origin on a moving object of charge $q$:
\begin{equation}\label{21eq-2}
\mathbf{E} (\mathbf{r}) = \frac{c q_0 q \mathbf{r}}{\vert \mathbf{r} \vert^3} = \frac{c q_0 q}{\vert \mathbf{r} \vert^2} \left(\frac{\mathbf{r}}{\vert \mathbf{r} \vert} \right),
\end{equation}
where $c>0$ is a constant depending on the units. 
Both the gravitational field \eqref{21eq-1} and the electrostatic field \eqref{21eq-2} have the form $k\bfr/|\bfr|^3$ for some constant $k$, and we will often use this general form to include both examples. However, the gravitational force is always attractive (directed towards the origin), while the electrostatic force can be either attractive or repulsive depending on the signs of $q_0$ and $q$.


\end{example}

\begin{example}
A \textbf{velocity field} $\mathbf{v} (x,y,z)$ describes the motion of a medium such as fluid or gas. At each point $(x,y,z)$, the vector $\mathbf{v} (x,y,z)$ is the velocity measured at that point. This may change from point to point (for example, when air flows through a funnel, the velocity increases when we get to the narrow part).  It may also change over time, in which case the vector field may depend on the additional variable $t$.

\begin{figure}[h!]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width =.85\linewidth]{figures/21fig6.png}
\caption{A 2-dimensional velocity field (imagine a thin layer of water flowing on a surface). In this example,  as $x\to\infty$ grows, the velocity becomes closer to horizontal and has larger magnitude.}
\end{minipage}
\end{figure}
\end{example}

Our next (and final) example appears often, both in physics and in mathematics, so we choose to give it as a definition.

\begin{definition}\label{21def-1}
Suppose that $f : \mathbb{R}^3 \supset D \rightarrow \mathbb{R}$ is a scalar field on some domain, and that the gradient $\nabla f : = \langle f_x, f_y, f_z \rangle$ exists for every $\langle x,y,z \rangle \in D$.  Then,  the \textbf{gradient field} of $f$ is defined by the equation $\mathbf{F} (\mathbf{r}) = \nabla f(\mathbf{r})$ for $\mathbf{r} \in D$. We will say that $f$ is the  \textbf{potential function} for $\mathbf{F}$.
\end{definition}

This is a bit different from physics terminology, which is as follows: a scalar function $V : D \rightarrow \mathbb{R}$ is a potential function for the vector field $\mathbf{F}$ if
$\mathbf{F} = - \nabla f$  (note the negative sign!).
For example, the Coulomb potential is given by
$$
\mathbf{V} (\mathbf{r}) = \frac{c q_0 q}{\vert \mathbf{r} \vert}, \textrm{ so that } \mathbf{E} = - \nabla \mathbf{V}.
$$
In mathematics, it is easier to use the convention in Definition \ref{21def-1} (${\bf F}=\nabla f$, without the minus sign). Most calculus textbooks follow this convention.



\subsection{Field Lines} \textbf{Field lines} (also called \textit{flow lines, integral curves}, or \textit{trajectories}) are curves that are tangent to the field vectors at every point.  Mathematically, we express this idea as
\begin{equation}\label{21eq-fieldline}
\frac{d \mathbf{r}}{dt} = \lambda (t) \mathbf{F} (\mathbf{r}(t)), \quad \lambda (t) \neq 0,
\end{equation}
where $\mathbf{r} (t)$ is a parametrization of the curve and $\lambda (t)$ is some scalar function.  We can simplify (\ref{21eq-fieldline}) by reparametization: if $u = u(t)$ is chosen to satisfy
$$
\frac{du}{dt} = \lambda (t) \Rightarrow \frac{d \mathbf{r}}{dt} = \frac{d \mathbf{r}}{du} \frac{du}{dt} = \lambda (t) \frac{d \mathbf{r}}{du}
$$
then in the new parametrization $\mathbf{r} = \mathbf{r} (u)$, \eqref{21eq-fieldline} becomes
\begin{equation}\label{21eq-fieldline2}
\frac{d \mathbf{r}}{du} = \mathbf{F} (\mathbf{r}(u)).
\end{equation}

To \textit{check} that a given curve $\mathbf{r}(t)$ is a field line, it suffices to evaluate $\frac{d \mathbf{r}}{dt}$ and check that it is parallel to $\mathbf{r}$.  As an example, consider again the vector field
$$
\mathbf{F} (x,y) = - y \mathbf{i} + x \mathbf{j}.
$$
Let us show that the curves $\mathbf{r} (t) = a \cos (t) \mathbf{i} + a \sin (t) \mathbf{j}$ (circles centered at the origin, of some radius $a>0$) are, in fact, field lines for $\mathbf{F}(x,y)$. We have
\begin{align*}
\frac{d \mathbf{r}}{dt} &= - a \sin (t) \mathbf{i} + a \cos (t) \mathbf{j}
\\
& = - y (t) \mathbf{i} + x(t) \mathbf{j} \\
& = \mathbf{F} (\mathbf{r} (t)).
\end{align*}
Hence, for each $a > 0$,  the curve associated to $\mathbf{r}$ is a field line for $\mathbf{F}$.

\begin{example}
On the following page,  we show the field lines for the same vector fields as appeared in Figure \ref{21fig2}, Figure \ref{21fig3} and Figure \ref{21fig4}. When we overlay the field lines (the red curves) over the vector field (the green arrows),  the orientation of the field lines are determined by the direction of the vector field. 
\end{example}

\pagebreak



\begin{figure}[h!]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width =.525\linewidth]{figures/21fig7.png}
\caption{The field lines associated to the constant vector field $\mathbf{F}(x,y) = \mathbf{a}$ are parallel lines in the direction $\mathbf{a}$.}
\end{minipage}
\end{figure}

\begin{figure}[h!]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width =.525\linewidth]{figures/21fig8.png}
\caption{The field lines associated to the central force ield $\mathbf{F}(x,y) = x \mathbf{i} + y \mathbf{j}$ are rays originating from the origin.}
\end{minipage}
\end{figure}

\begin{figure}[h!]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width = .525\linewidth]{figures/21fig9.png}
\caption{The field lines associated to the vector field $\mathbf{F}(x,y) = -y \mathbf{i} + x \mathbf{j}$ are concentric circles with the origin as a common centre. The inherited orientation of the field lines is counterclockwise.}
\end{minipage}
\end{figure}




\subsection{Solving for Field Lines; Existence of Field Lines}
Now, in reality, we often want to \textit{determine} an equation for the field lines of a given vector field.  This corresponds to solving the equation
$
\frac{d \mathbf{r}}{dt} = \lambda (t) \mathbf{F} (\mathbf{r}(t)).
$
We can further simplify our lives by assuming that our parametrization satisfies \eqref{21eq-fieldline2}.  The calculation proceeds by re-writing \eqref{21eq-fieldline2} in terms of component functions:
$$
\frac{dx}{dt} = F_1 (\mathbf{r} (t)), \, \frac{dy}{dt} = F_2 (\mathbf{r}(t)), \, \frac{dz}{dt} = F_3 (\mathbf{r}(t)).
$$
We need to solve this for the unknown functions $x(t)$, $y(t)$ and $z(t)$. We will use the \textit{Separation of Variables}
method from Partial Differential Equations: eliminate the $t$ variable via
\begin{equation}\label{21eq-separationofvar}
dt = \frac{dx}{F_1} = \frac{dy}{F_2} = \frac{dz}{F_3},
\end{equation}
and then solve the equations for $x,y,z$. We illustrate this in the example below.

\begin{example}
Determine the field lines of the vector field $\mathbf{F}(x,y) = 2x^2 \mathbf{i} - \frac{y}{4} \mathbf{j}$.
\end{example}

\medskip

\noindent
For this vector field, we have $F_1 (x,y) = 2x^2$ and $F_2 (x,y) = - \frac{y}{4}$. Note that, so long as neither $x = 0$ or $y = 0$,  \eqref{21eq-separationofvar} tells us that
$$
dt= \frac{dx}{2 x^2} = - \frac{4 dy}{y}.
$$
We integrate both sides (see the remark below for justification):
$$
 \int \frac{dy}{y} = - \frac{1}{8} \int \frac{dx}{x^2} \Rightarrow \ln |y| = \frac{1}{8x} + C.
$$
Solving for $y$ as a function of $x$, we have
$$
\vert y \vert = e^{\frac{1}{8x} + C} = e^C e^{\frac{1}{8x}} \Rightarrow y = C_1 e^{\frac{1}{8x}},
$$
where $C_1 = \pm e^{C}$ and $x \neq 0$ and $y \neq 0$. 

\smallskip
\noindent
If $x = 0$, then we have the equations
$$
\frac{dx}{dt} = F_1 (x,y) = 2x^2 = 0, \, \frac{dy}{dt} = - \frac{y}{4}.
$$
This corresponds to half-lines on the $y$-axis which point towards the origin.  Similarly, if $y = 0$, we have
$$
\frac{dx}{dt} = 2x^2, \, \frac{dy}{dt} = -\frac{y}{4} = 0,
$$
which corresponds to half lines on the $x$-axis. The full diagram looks something like the following.

\begin{figure}[h!]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width =0.8\linewidth]{figures/21fig10.png}
\caption{Some field lines of $\mathbf{F}(x,y) = 2x^2 \mathbf{i} - \frac{y}{4} \mathbf{j}$ overlain on a portion of the vector field.  In this diagram, we only include $\mathbf{F}(x,y)$ where $-10 \leq x,y \leq 10$. }
\end{minipage}
\end{figure}


\begin{remark}
The integration step above is not obvious at all -- in fact, it follows from the implicit function theorem.  This method,  leading to the equality of the anti-derivatives shown above, is known as the \textit{Method of Separation of Variables}, and should be covered in Math 215/255.
\end{remark}

Finally, we can ask ourselves: how do we know, after following the procedure outlined above, that we have found \textit{all} of the given field lines? The following result guarantees that our work has paid off--once we find one field line through every point $\bfr$ with $\mathbf{F} (\mathbf{r}) \neq \mathbf{0}$, we have found them all.

\begin{theorem}[Existence and Uniqueness of Solutions to ODE's]
If $\mathbf{F} : \mathbb{R}^n \supset D \rightarrow \mathbb{R}^n$ is smooth on an open set $O \subset D$ containing $\mathbf{r}_0$, and if $\mathbf{F} (\mathbf{r}_0) \neq \mathbf{0}$, then there exists exactly one field line through $\mathbf{r}_0$.
\end{theorem}

If $\mathbf{F}(\mathbf{r}_0) =0$, then $\mathbf{r}_0$ is a \textit{stationary point}. (If we interpret ${\bf F}$ as a velocity field, then an object placed at $\bfr_0$ should stay there indefinitely because its velocity is always zero.) In the previous example, notice that there is exactly one field line through every point in the plane, \textit{except} at the origin---precisely where $\mathbf{F} = \mathbf{0}$! The origin, in this example, is a stationary point. By the theorem above, this gives us all field lines.

\bigskip

\section*{Worked Problems}
\begin{enumerate}[1.]
\item {\it
Find all field lines of the vector field ${\bf F}=x(x+1)\ii + y \jj$, using the following procedure.

\smallskip

(a) Assuming that $x(x+1)$ and $y$ are both non-zero, find a family of field lines by solving the corresponding ordinary differential equation via the Method of Separation of Variables. }

\medskip

We have the following differential equation when $x,x+1,y$ are all non-zero:
	\begin{equation}\label{21eq-pp1}
		\frac{dy}{y} = \frac{dx}{x(x+1)} 
	\end{equation}
Using partial fractions, $\displaystyle \frac{1}{x(x+1)} = \frac{1}{x} - \frac{1}{x+1}$. Then if we integrate both sides of (\ref{21eq-pp1}), we get
	\begin{align*}
		\log|y|+C &= \log|x| - \log|x+1| \\
		\log|y|+C &= \log\left| \frac{x}{x+1} \right| \\
		|y| &= \left| \frac{x}{x+1} \right| e^{-C} 
	\end{align*}
The field lines are curves $\displaystyle y = \frac{Dx}{x+1}$, where $D=\pm e^{-C}$ is a nonzero constant.
\bigskip 

{\it (b) Check that the curves you found in (a) are in fact field lines. }

\medskip

We need to show that for an arbitrary field line ${\bf r}(t)$, ${\bf r'}(t)$ is parallel to ${\bf F}$ at each point on the curve. We can parametrize the field lines from (a) by $ {\bf r}(t) = t\ii + \frac{Dt}{t+1}\jj$. Then $ {\bf r'}(t) =  \ii + \frac{D}{(t+1)^2} \jj$, and
	\begin{align*}
		{\bf F}(x(t),y(t)) &= x(t)(x(t)+1)\ii + y(t)\jj
		\\
		&= t(t+1)\ii + \frac{Dt}{t+1}\jj 
		\\
		&= t(t+1)\left(\ii+ \frac{D}{(t+1)^2}\jj \right) = t(t+1) {\bf r}'(t)
	\end{align*}

\medskip

{\it(c) Consider the cases $x=0$, $x+1=0$, $y=0$ separately. Are there any field lines corresponding
to these cases? Draw the picture of all the field lines you have found, with orientation.}

\medskip

When $x=0$ and $x=-1$, we have ${\bf F} = y\jj$, with the vectors pointing vertically away from the $x$-axis. Along the line $y=0$, ${\bf F}$ is nonzero when $x \neq 0,-1$. The field vectors are $x(x+1)\ii$, with the direction changing at each of the points $(0,0)$ and $(1,0)$. 

\medskip

{\it(d) A theorem from class says that if ${\bf F}$ is a smooth vector field on an open domain containing
$\bfr_0$, and if ${\bf F}(\bfr_0)\neq 0$, then there is exactly one field line through $\bfr_0$. Identify all points
with ${\bf F}(\bfr)=0$, Is it true that for every other point $\bfr_0$ in the plane, there is exactly one field line
through $\bfr_0$ that you found above? If so, then this means you have found all the field lines.}

\medskip

We have ${\bf F} = 0$ at the points $(0,0),(-1,0)$. Let ${\bf r}_0 = (x_0,y_0)$ be a point different from $(0,0),(-1,0)$. 

\begin{itemize}
\item If ${\bf r}_0$ lies on one of the lines $x=0,x=-1$, or $y=0$, then exactly one of the curves from part (c) passes through ${\bf r}_0$. 

\item Otherwise, let  $D_0 = \frac{y_0(x_0+1)}{x_0}$ (this is well defined since $x_0\neq 0$ and nonzero since $y_0(x_0+1)\neq 0$), Then the curve $ y = \frac{D_0x}{x+1}$ passes through ${\bf r}_0$. Moreover, for any other curve $ y = \frac{Dx}{x+1}$ that passes through ${\bf r}_0$, we must also have $ y_0 = \frac{Dx_0}{x_0+1}$, so that $D = D_0$. 
\end{itemize}

Therefore there is exactly one field line through each point other than $(0,0),(-1,0)$.
\end{enumerate}


	\begin{figure}[h!]
		\centering\includegraphics[width=\linewidth]{figures/21fig11.png}
		\caption{Field lines of $\mathbf{F}(x,y) = x(x+1)\mathbf{i} + y \mathbf{j}$ overlain on a portion of the vector field. The constant solutions $x = 0$, $x=-1$ and $y=0$ correspond to the thick red lines. In this diagram, we only included the part of $\mathbf{F}(x,y)$ where $-3 \leq x,y \leq 3$.}
	\end{figure}
	
	\vfill
	
	\pagebreak

\section*{Practice Problems}
\begin{enumerate}[1.]
\item{
Find and sketch the field lines of the vector field 
${\bf F}(x,y)= -x^3 {\bf i}+y  {\bf j} $
in $\mathbb{R}^2$. Indicate the flow direction in your sketch.
}

\medskip

\item{
Let $f(x,y)=x^2+4y^4$.  Find the field line of the vector field ${\bf F} =\nabla f$ which
passes through the point $(2,6)$.} 

\medskip

\item 
{
Find all field lines of the vector field ${\bf F}=\frac{1-x^2}{x}\ii + y^2 \jj$, using the following procedure.

\smallskip

(a) Assuming that $x$, $1-x^2$, and $y$ are all non-zero,  solve the corresponding ordinary differential equation using the Method of Separation of Variables. (You may have to consider multiple cases.)


\smallskip

(b) What happens when $x=0$, $1-x^2=0$, or $y=0$? Are there any field lines corresponding
to these cases?

\smallskip

(c) Draw a picture of the field lines you found. Make sure to indicate their orientation. (You can check that by evaluating ${\bf F}$ at sample points.) You should have exactly one field line through every point where ${\bf F}\neq {\bf 0}$.}

\end{enumerate}



