\section{Vectors in $\mathset{R}^n$}

Recall when we introduced the ordered $n$-tuple  $(x_1,x_2,\ldots,x_n)$ in $\mathset{R}^n$ we labelled it $\lvec{x}$ and represented it by the column matrix
\[\lvec{x}=\begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_n\end{bmatrix}=[x_1\, x_2\, \ldots\, x_n]^T\]
At that time we mentioned it could be used to represent a vector.  We now make more precise the concept of a vector.

\definition{A \textbf{vector} is a quantity having both a \textbf{magnitude} and \textbf{direction}.}

Physical examples of vectors are displacement which has both a magnitude (distance travelled) as well as a direction (like east) associated with it.  Other important vectors include velocity, acceleration, momentum, and force.  Notationally vectors will be identified by boldfaced lower case letters in this text such as $\lvec{u}$.  In handwritten form it is common to put an arrow on top of the letter or a bar above or below the letter, i.e. $\vec{u}$, $\bar{u}$, or $\underset{\bar{~}}{u}$\,.

Geometrically a vector quantity is an arrow having length and direction.  To characterize them mathematically we introduce the related concept of a directed line segment. We visualize the following in two or three dimensions but we can generalize to $n$ dimensions.

\definition{Let $O$ and $P$ be two points. The line segment from point $O$ (called the \textbf{tail} or \textbf{initial point}) to the point $P$ (called the \textbf{tip} or \textbf{terminal point}) is called the \textbf{directed line segment} from $O$ to $P$ and is denoted by the symbol $\overrightarrow{OP}$.}

\begin{center}
\includegraphics[width=2in]{vectors/vector}
\end{center}

A directed line segment is almost the same as a vector except a vector is independent of its position in space.  With that in mind we define the equivalence of two directed line segments as follows.

\definition{Two directed line segments $\overrightarrow{OP}$ and $\overrightarrow{QR}$ are said to be \textbf{equivalent} if they have the same direction and length.}

In the following diagram $\overrightarrow{OP}$ is equivalent to $\overrightarrow{QR}$\,.
\begin{center}
\includegraphics[width=2in]{vectors/vectorequivalent}
\end{center}

If we fix a point in space, $O$, call it the \textbf{origin}, then every directed line segment will be equivalent to some directed line segment whose initial point is $O$.  Any quantity having magnitude and direction can also be represented by one such directed line segment.  Hence an alternate working definition for a vector is as follows:\footnote{To be even more precise we could characterize a vector as the unique representative of the equivalence class of directed line segments whose tail is at the origin $O$\,.}

\definition{A \textbf{vector} is a directed line segment from the origin $O$ to a point $P$.}

The connection to ordered $n$-tuples now comes about by introducing a Cartesian coordinate system.  A vector can be completely characterized by the coordinates of the terminal (tip) point $P$.  In two and three dimensions, now using the same letter for the tip point $U$ as the vector $\lvec{u}$, this becomes:
\begin{center}
\includegraphics[height=1.5in]{vectors/vector2d}~~~~~~~~~~~~\includegraphics[height=1.5in]{vectors/vector3d}
\end{center}
In summary:
\begin{itemize}
\item In $\mathset{R}^2$ a vector is written as $\lvec{u} = (u_1, u_2)=\begin{bmatrix} u_1\\u_2\end{bmatrix}$\,.
\item In $\mathset{R}^3$ a vector is written as $\lvec{u} = (u_1 , u_2, u_3)=\begin{bmatrix} u_1\\u_2\\u_3\end{bmatrix}$\,.
\item In $\mathset{R}^n$ a vector is written as $\lvec{u} = (u_1 , u_2, \ldots , u_n)=[u_1\,u_2\,\ldots\,u_n]^T$\,.
\end{itemize}
The numbers $u_1, u_2, \ldots, u_n$ are called the \textbf{components} of the vector.

Vector equality can now be defined in terms of components.
\definition{Two vectors, $\lvec{u}$ and $\lvec{v}$ in $\mathset{R}^n$ are equal if their corresponding components are equal, i.e.
\[u_i=v_i\ \ \ \text{for}\ i=1, \ldots, n\,.\]}

\definition{The \textbf{zero vector} in $\mathset{R}^n$ has all components equal to zero.
\begin{itemize}
\item In $\mathset{R}^2$: $\lvec{0}=(0,0)$\,. 
\item In $\mathset{R}^3$: $\lvec{0}=(0,0,0)$\,.
\item In $\mathset{R}^n$: $\lvec{0}=(\,\underbrace{0, 0, \ldots, 0}_{n\ \text{times}}\,)$\,.
\end{itemize}}

\subsection{Vector Length}
\definition{The \textbf{length} (or \textbf{norm} or \textbf{magnitude}) of a vector $\lvec{u}$ is the distance from the origin to the terminal point of $\lvec{u}$ and is denoted by $\lnorm{\lvec{u}}$\,. In terms of the components of $\lvec{u}$,
  \begin{itemize}
    \item In $\mathset{R}^2$: $\lnorm{\lvec{u}} = \sqrt{u_1^2 + u_2^2}$\,.
    \item In $\mathset{R}^3$: $\lnorm{\lvec{u}} = \sqrt{u_1^2 + u_2^2 + u_3^2}$\,.
    \item In $\mathset{R}^n$: $\lnorm{\lvec{u}} = \sqrt{u_1^2 + u_2^2 + \ldots + u_n^2}$\,.
\end{itemize}}
Here the length in $\mathset{R}^2$ is as expected from the Pythagorean Theorem.
\begin{center}
\includegraphics[height=2in]{vectors/vector2dlength}
\end{center}
In $\mathset{R}^3$ the length $\lnorm{\lvec{u}}$ is the length of the hypotenuse of a triangle the base of which lies in the $x$-$y$ plane having length $\sqrt{u_1^2+u_2^2}$ and whose height is $|u_3|$. It follows, again by the Pythagorean Theorem, that
\[\lnorm{\lvec{u}}=\sqrt{\left(\sqrt{u_1^2 + u_2^2}\right)^2+|u_3|^2}=\sqrt{u_1^2 + u_2^2+u_3^2}\,.\]
\begin{center}
\includegraphics[height=2in]{vectors/vector3dlength}
\end{center}

\begin{example}
  Find the length $\lnorm{\lvec{u}}$ of the given vector.
  \begin{enumerate}
  \item $\lvec{u} = (-1,1)$\\[.5em]
    Solution:\\
    $\lnorm{\lvec{u}} = \sqrt{(-1)^2 + 1^2} = \sqrt{2}$\\
  \item $\lvec{u} = \begin{bmatrix*}[r]2\\ -1\\ -3\end{bmatrix*}$\\[.5em]
    Solution:\\
    $\lnorm{\lvec{u}} = \sqrt{2^2 + (-1)^2 + (-3)^2} = \sqrt{14}$
\end{enumerate}
\end{example}

Only the zero vector has a vanishing length.
\theorem{\label{thm:zerovector}$\lnorm{\lvec{u}} = 0$ if and only if $\lvec{u}=\lvec{0}$\,.}

\definition{If the length of a vector is 1, $\lnorm{\lvec{u}} = 1$, then the vector $\lvec{u}$ is called a \textbf{unit vector}.}

\begin{example}
  Show the vector $\lvec{u}=\left(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}},0\right)$ in $\mathset{R}^3$ is a unit vector.\\[.5em]

  Solution:\\
  Finding the length of $\lvec{u}$, 
  \[\lnorm{\lvec{u}}=\sqrt{u_1^2+u_2^2+u_3^2}=\sqrt{\left(\frac{1}{\sqrt{2}}\right)^2+\left(\frac{1}{\sqrt{2}}\right)^2+0^2}=\sqrt{\frac{1}{2}+\frac{1}{2}+0}=\sqrt{1}=1\,,\]
    shows $\lvec{u}$ has unit length and hence is a unit vector.
\end{example}

It is convenient to define unit vectors along the direction of the positive coordinate axes as follows.
\begin{itemize}
\item In $\mathset{R}^2$:
  \begin{itemize}
  \item The unit vector along the positive $x$-axis is $\lvec{i} = (1,0)$\,.
  \item The unit vector along the positive $y$-axis is $\lvec{j} = (0,1)$\,.
  \end{itemize}
\item In $\mathset{R}^3$:
  \begin{itemize}
  \item The unit vector along the positive $x$-axis is $\lvec{i} = (1,0,0)$\,.
  \item The unit vector along the positive $y$-axis is $\lvec{j} = (0,1,0)$\,.
  \item The unit vector along the positive $z$-axis is $\lvec{k} = (0,0,1)$\,.
  \end{itemize}
\end{itemize}
\begin{center}
\includegraphics[height=1.5in]{vectors/elementaryvectors}
\end{center}

For $\mathset{R}^n$ it is convenient to generalize this approach.
\definition{An \textbf{elementary vector} in $\mathset{R}^n$ is a vector that has one component equal to 1 and all other components equal to 0.  If the 1 occurs as the $i\textsuperscript{th}$ component, then the elementary vector is denoted by $\lvec{e}_i$\,.}
\begin{itemize}
\item In $\mathset{R}^2$:
  \begin{itemize}
  \item $\lvec{e}_1=(1,0)=\lvec{i}$\,.
  \item $\lvec{e}_2=(0,1)=\lvec{j}$\,.
  \end{itemize}
\item In $\mathset{R}^3$:
  \begin{itemize}
  \item $\lvec{e}_1=(1,0,0)=\lvec{i}$\,.
  \item $\lvec{e}_2=(0,1,0)=\lvec{j}$\,.
  \item $\lvec{e}_3=(0,0,1)=\lvec{k}$\,.
  \end{itemize}
\end{itemize}
Note that when writing unit vectors by hand a common convention is to write $\hat{i}$, $\hat{j}$, $\hat{k}$, $\hat{e}_1$, etc. to indicate the vector has unit length.

\subsection{Scalar Multiplication}

Recall we have used the term \textbf{scalar} to refer to an element of the set of real numbers $\mathset{R}$\,.  Scalars physically represent quantities such as temperature or length which do not have a direction.\footnote{At a more technical level, scalars represent quantities that are numbers that are independent of the choice of coordinate system.  So, for instance, the value of the first coordinate of a vector, while being a number, would not be a scalar as a different choice of axes could be made which would make the first coordinate have a different value.  The length of a vector however would be independent of such a choice and is a proper scalar.} We can define multiplication of a vector by a scalar.

\definition{Let $a$ be a scalar and $\lvec{u}$ be a vector. The scalar multiple of $\lvec{u}$ by $a$ is a vector given by:
  \begin{itemize}
  \item In $\mathset{R}^2$: $a\lvec{u} = (au_1 , au_2)$
  \item In $\mathset{R}^3$: $a\lvec{u} = (au_1 , au_2 , au_3)$
  \item In $\mathset{R}^n$: $a\lvec{u} = (au_1 , au_2 , \ldots ,  au_n)$
  \end{itemize}
}

Note since a vector written as a column matrix is just a matrix, this is consistent with our previous definition of scalar multiplication of a matrix.

\begin{example}
  Find $a\lvec{u}$ for the given scalar and vector.
  \begin{enumerate}
  \item $a = -2 \, \, \, , \, \, \, \lvec{u} =(-1,2)$\\[.5em]
    Solution:\\[.2em]
    $a\lvec{u} = -2\lvec{u}=\left((-2)(-1),(-2)(2)\right)=(2,-4)$
  \item $a = 3 \, \, \, , \, \, \, \lvec{u} =\begin{bmatrix*}[r]2\\3\\-1\end{bmatrix*}$\\[.5em]
    Solution:\\[.5em]
    $a\lvec{u} = 3\lvec{u}=\begin{bmatrix*}[r]6\\9\\-3\end{bmatrix*}$
  \item $a = 2 \, \, \, , \, \, \, \lvec{u} = (-1,1,3,5)$\\[.5em]
    Solution:\\
    $a\lvec{u} = 2\lvec{u}=(-2,2,6,10)$\\
  \end{enumerate}
\end{example}

\definition{Two nonzero vectors $\lvec{u}$ and $\lvec{v}$ are \textbf{collinear} if the lines they determine are one and the same. i.e. if their terminal points $U$ and $V$ along with the origin $O$ are collinear.}

\begin{center}
\includegraphics[height=1.5in]{vectors/vectorscollinear}
\end{center}

\theorem{\label{thm:scalarvectormult}Let $\lvec{u}$ be a nonzero vector %in $\mathset{R}^2$ or $\mathset{R}^3$
  and let $a$ be a scalar. Then $\lvec{u}$ and $a\lvec{u}$ are collinear and:
\begin{enumerate}
  \item If $a>0$, then $\lvec{u}$ and $a\lvec{u}$ have the same direction (parallel).
  \item If $a<0$, then $\lvec{u}$ and $a\lvec{u}$ have opposite direction (antiparallel).
  \item $\lnorm{a\lvec{u}} = |a|\lnorm{\lvec{u}}$
\end{enumerate}}

If nonzero vector $\lvec{u}$ is not a unit vector we can find a unit vector along the same direction as $\lvec{u}$ by multiplying it by the scalar that is the reciprocal of its length.

\theorem{Let $\lvec{u}$ be a nonzero vector %in $\mathset{R}^2$ or $\mathset{R}^3$
  then a \textbf{unit vector} in the same direction as $\lvec{u}$ is given by:
\[\frac{1}{\lnorm{\lvec{u}}}\lvec{u}\,.\]}

\textbf{Proof:}\\
Since $\lvec{u}\neq\lvec{0}$, Theorem~\ref{thm:zerovector} shows $\lnorm{\lvec{u}}\neq0$.  Then using Theorem~\ref{thm:scalarvectormult} with positive scalar $a=1/\lnorm{\lvec{u}}$ shows $a\lvec{u}$ is directed along $\lvec{u}$ and has length
\[\lnorm{\frac{1}{\lnorm{\lvec{u}}}\lvec{u}}=\left|\frac{1}{\lnorm{\lvec{u}}}\right|\lnorm{\lvec{u}}=\frac{1}{\lnorm{\lvec{u}}}\lnorm{\lvec{u}}=1\,.\]

\begin{example}
  Find a unit vector parallel to the given vector.
  \begin{enumerate}
  \item $\lvec{u} = (1,-1,2)$\\[.5em]
    Solution:\\
    $\lnorm{\lvec{u}} = \sqrt{1^2+(-1)^2+2^2} = \sqrt{6}$\\
    The unit vector is $\displaystyle\frac{1}{\lnorm{\lvec{u}}}\lvec{u} = \frac{1}{\sqrt{6}}(1,-1,2)$\,.
  \item $\lvec{u} = (-1, 0, -2, 2)$\\[.5em]
    Solution:\\
    $\lnorm{\lvec{u}} = \sqrt{(-1)^2 + 0 + (-2)^2 + 2^2} = \sqrt{9} = 3$\\
    The unit vector is $\displaystyle\frac{1}{\lnorm{\lvec{u}}}\lvec{u} = \frac{1}{3}(-1, 0, -2, 2)$\,.
  \end{enumerate}
\end{example}

\subsection{Vector Addition}
\definition{Let $\lvec{u}$ and $\lvec{v}$ be nonzero vectors in $\mathset{R}^2$ , $\mathset{R}^3$ or $\mathset{R}^n$. The sum of $\lvec{u}$ and $\lvec{v}$ is the \textbf{resultant vector} $\lvec{u}+\lvec{v}$ given by:
  \begin{itemize}
  \item In $\mathset{R}^2$: $\lvec{u} + \lvec{v} = (u_1 + v_1, u_2 + v_2)$\,.
  \item In $\mathset{R}^3$: $\lvec{u} + \lvec{v} = (u_1 + v_1, u_2 + v_2, u_3 + v_3)$\,.
  \item In $\mathset{R}^n$: $\lvec{u} + \lvec{v} = (u_1 + v_1, u_2 + v_2, \ldots ,  u_n + v_n)$\,.
\end{itemize}}
Thus vector addition is done componentwise.  This is consistent with matrix addition and our identification of vectors with column matrices.
  
\begin{example}
  Find the sum of the given vectors.
  \begin{enumerate}
  \item $\lvec{u} = (1, -1, 2)$ , $\lvec{v} = (-5,4,3)$\\
    Solution:\\
    $\lvec{u} + \lvec{v} = (1-5,-1+4,2+3)= (-4,3,5)$
  \item $\lvec{u} = \begin{bmatrix*}[r] 3\\ -1\\ 3 \\2\end{bmatrix*}$ , $\lvec{v} = \begin{bmatrix*}[r] -1\\ 2\\ -2 \\3\end{bmatrix*}$\\[.5em]
      Solution:\\[.2em]
    $\lvec{u}+\lvec{v} = \begin{bmatrix} 3+(-1) \\ -1+2\\ 3+(-2)\\2+3\end{bmatrix} = \begin{bmatrix*}[r] 2\\ 1\\ 1\\ 5\end{bmatrix*}$\\
  \end{enumerate}
\end{example}

The componentwise addition of vectors has the following geometric interpretation in two and three dimensions.  The resultant vector arising from adding two (or more) vectors is the vector formed by joining the vectors successively from tip to tail as shown in the following diagram.
\begin{center}
\includegraphics[height=2in]{vectors/vectoraddition}
\end{center}
Here the vector $\lvec{v}$ is shown with its tail translated from the origin $O$ to the tip of $\lvec{u}$.  If we remove the coordinate system scaffolding we see that vector addition is a geometrical property independent of coordinates.  Noting that our above definition implies that $\lvec{v}+\lvec{u}=\lvec{u}+\lvec{v}$ (vector addition commutes) the resultant can be found by placing the vector $\lvec{v}$ first as well and one has the following diagram:
\begin{center}
\includegraphics[height=1.5in]{vectors/vectorparallelogram}
\end{center}
As the diagram shows the two vectors with tails placed at the origin form a parallelogram, the diagonal of which is the resultant vector with tail placed at the origin.  The is known as the \textbf{parallelogram law} of vector addition.  In three dimensions the two vectors determine a plane in which the parallelogram lies.

\subsection{Vector Components Along Coordinate Axes}
Consider the vector $\lvec{u}=(u_1,u_2,u_3)=(3,2,4)$.  Then
\[\lvec{u}=\begin{bmatrix}3\\2\\4\end{bmatrix}=\begin{bmatrix}3\\0\\0\end{bmatrix}+\begin{bmatrix}0\\2\\0\end{bmatrix}+\begin{bmatrix}0\\0\\4\end{bmatrix}
=3\begin{bmatrix}1\\0\\0\end{bmatrix}+2\begin{bmatrix}0\\1\\0\end{bmatrix}+4\begin{bmatrix}0\\0\\1\end{bmatrix}=3\lvec{i}+2\lvec{j}+4\lvec{k}\,.\]
Here $3\lvec{i}$ is called the \textbf{vector component} of $\lvec{u}$ along $\lvec{i}$ and geometrically the vector $\lvec{u}$ is the sum of these vectors directed along the coordinate axes.
\begin{center}
\includegraphics[height=1.5in]{vectors/vectorcomponents}
\end{center}
Generalizing, we have the following decomposition of vectors into their vector components along coordinate axes.
\begin{itemize}
\item In $\mathset{R}^2$: $\lvec{u} = (u_1, u_2)= u_1\lvec{i} + u_2\lvec{j}$\,.
\item In $\mathset{R}^3$: $\lvec{u} = (u_1, u_2, u_3) = u_1\lvec{i} + u_2\lvec{j} + u_3\lvec{k}$\,.
\item In $\mathset{R}^n$: $\lvec{u} = (u_1, u_2, \ldots, u_n) = u_1\lvec{e}_1 + u_2\lvec{e}_2+\cdots+u_n\lvec{e}_n$\,.
\end{itemize}

\begin{example}
One can go back and forth between vector components as shown in the following examples:
\begin{enumerate}
\item $\lvec{u} = (-1,2) = -\lvec{i}+2\lvec{j}$
\item $\lvec{u} = \begin{bmatrix*}[r] 3\\-4\\5\\2\end{bmatrix*} = 3\lvec{e}_1-4\lvec{e}_2+5\lvec{e}_3+2\lvec{e}_4$
\item $\lvec{u} = 2\lvec{i}+3\lvec{j}-\lvec{k} = (2,3,-1)$
\end{enumerate}
\end{example}
In physical problems writing vectors in terms of elementary vectors can often simplify calculations involving the vectors.

\subsection{Vector Subtraction}

\definition{Let $\lvec{u}$ be a vector. The \textbf{negative of } $\lvec{u}$, denoted $-\lvec{u}$, is defined to be $(-1)\lvec{u}$.  
  \begin{itemize}
  \item In $\mathset{R}^2$: $-\lvec{u} = (-u_1 , -u_2)$
  \item In $\mathset{R}^3$: $-\lvec{u} = (-u_1 , -u_2 , -u_3)$
  \item In $\mathset{R}^n$: $-\lvec{u} = (-u_1 , -u_2 , \ldots ,  -u_n)$
  \end{itemize}
}
Theorem~\ref{thm:scalarvectormult} implies that $-\lvec{u}$ has the same length as $\lvec{u}$ but is directed in the opposite direction~(assuming $\lvec{u}\neq\lvec{0}$).  Vector subtraction can now be defined in terms of vector addition by \emph{adding the negative} as follows.
\definition{Let $\lvec{u}$ and $\lvec{v}$ be nonzero vectors in $\mathset{R}^2$ , $\mathset{R}^3$ or $\mathset{R}^n$. The \textbf{difference} of $\lvec{u}$ and $\lvec{v}$ is the vector $\lvec{u}-\lvec{v}$ given by
  \[\lvec{u}-\lvec{v}=\lvec{u}+(-\lvec{v})\,.\]
In terms of components it is given by
\begin{itemize}
\item In $\mathset{R}^2$: $\lvec{u}-\lvec{v} = (u_1 - v_1, u_2 - v_2)$\,.
\item In $\mathset{R}^3$: $\lvec{u}-\lvec{v} = (u_1 - v_1, u_2 - v_2, u_3 - v_3)$\,.
\item In $\mathset{R}^n$: $\lvec{u}-\lvec{v} = (u_1 - v_1, u_2 - v_2, \ldots ,  u_n - v_n)$\,.
\end{itemize}
}
Once again, the definition is consistent with the interpretation of vectors as column matrices and matrix subtraction.  Geometrically we add the negative vector $-\lvec{v}$ to $\lvec{u}$ tip-to-tail to get the difference $\lvec{u}-\lvec{v}$.
\begin{center}
\includegraphics[height=1.5in]{vectors/vectorsubtraction}
\end{center}

\begin{example}
  Find the difference $\lvec{u}-\lvec{v}$ of the given vectors.
  \begin{enumerate}
  \item $\lvec{u} = (1,-1,2)$ , $\lvec{v} = (-5,4,3)$\\[.5em]
    Solution:\\
    $\lvec{u} - \lvec{v} = (1-(-5) , -1-4 , 2-3) = (6, -5, -1)$
  \item $\lvec{u} = \begin{bmatrix*}[r] 3\\ -1\\ 3 \\2\end{bmatrix*}$ , $\lvec{v} = \begin{bmatrix*}[r] -1\\ 2\\ -2 \\3\end{bmatrix*}$\\[.5em]
      Solution:\\[.2em]
    $\lvec{u} - \lvec{v} = \begin{bmatrix} 3-(-1) \\ -1-2\\ 3-(-2)\\2-3\end{bmatrix} = \begin{bmatrix*}[r] 4\\ -3\\ 5\\ -1\end{bmatrix*}$\\
  \end{enumerate}
\end{example}

The difference of vectors has a convenient geometric interpretation in terms of the parallelogram induced by $\lvec{u}$ and $\lvec{v}$ which we introduced with vector addition.  If we draw the other diagonal as the directed line segment from the point $U$ at the tip of $\lvec{u}$ to the point $V$ at the tip of $\lvec{v}$ and we draw the vector $\lvec{v}-\lvec{u}$ we see that the two will be equivalent.
\begin{center}
\includegraphics[height=1.5in]{vectors/vectordistance}
\end{center}
In other words, the vector $\lvec{v}-\lvec{u}$ is essentially just the other diagonal between the tips of the two vectors.  The correct direction is easily remembered since we must have $\lvec{u}+(\lvec{v}-\lvec{u})=\lvec{v}$ when added tip-to-tail.  We summarize the discussion with the following theorem.

\theorem{\label{thm:differencequivalent}Let $U$ and $V$ be distinct points in $\mathset{R}^n$ % in $\mathset{R}^2$ or $\mathset{R}^3$.
with associated vectors $\lvec{u}$ and $\lvec{v}$.  Then the vector $\lvec{v} - \lvec{u}$ is equivalent to the directed line segment $\overrightarrow{UV}$ from $U$ to $V$. In other words, $\overrightarrow{UV}$ is parallel to the vector $\lvec{v}-\lvec{u}$ and the length of the segment (the distance between $U$ and $V$) equals the length of that difference, $\lnorm{\lvec{v}-\lvec{u}}$\,.}

\begin{example}
  Find the vector that is equivalent to the directed line segment from $P(1,5,7)$ to $Q(2,1,0)$ and use it to find the distance between $P$ and $Q$.

  Solution:\\
  The vectors associated with the points are $\lvec{p}=(1,5,7)$ and $\lvec{q}=(2,1,0)$\,.
  The directed line segment $\overrightarrow{PQ}$ is then equivalent to the difference 
  \begin{align*}
    \lvec{q}-\lvec{p} &= (2,1,0) - (1,5,7)\\
    &= (2-1 , 1-5 , 0-7)\\
    &= (1, -4, -7)\,.
  \end{align*}
  The distance between $P$ and $Q$ equals
  \[\lnorm{\lvec{q}-\lvec{p}}=\sqrt{1^2+(-4)^2+(-7)^2}=\sqrt{1+16+49}=\sqrt{66}\,.\]
\end{example}

The previous discussion suggests the following definition for the distance between two vectors in $\mathset{R}^n$ as the distance between their terminal points (tips).

\definition{The \textbf{distance} $d(\lvec{u},\lvec{v})$ between two vectors $\lvec{u}$ and $\lvec{v}$ is defined to be
  \[d(\lvec{u},\lvec{v})=\lnorm{\lvec{v}-\lvec{u}}\,.\]
  Specifically one has:
  \begin{itemize}
    \item In $\mathset{R}^2$: $d(\lvec{u}, \lvec{v}) = \sqrt{(v_1-u_1)^2 + (v_2-u_2)^2}$\,.
    \item In $\mathset{R}^3$: $d(\lvec{u}, \lvec{v}) = \sqrt{(v_1-u_1)^2 + (v_2-u_2)^2 + (v_3-u_3)^2}$\,.
    \item In $\mathset{R}^n$: $d(\lvec{u}, \lvec{v}) = \sqrt{(v_1-u_1)^2 + (v_2-u_2)^2 + \ldots + (v_n-u_n)^2}$\,.
  \end{itemize}}
  
\begin{example}
  Find the distance between the given vectors.
  \begin{enumerate}
  \item $\lvec{u}=(-1,1)$, $\lvec{v}= (2,5)$\\[.5em]
    Solution:
    \begin{align*}
      d(\lvec{u}, \lvec{v}) &= \lnorm{\lvec{v}-\lvec{u}} \\
      &= \sqrt{(2-(-1))^2+(5-1)^2}\\
      &= \sqrt{9+16} = \sqrt{25} = 5
    \end{align*}
  \item $\lvec{u}=\begin{bmatrix*}[r] 2 \\ -1\\ -3\end{bmatrix*}$ , $\lvec{v}=\begin{bmatrix*}[r]-1 \\ 4\\ 2\end{bmatrix*}$\\[.5em]
    Solution:
    \begin{align*}
      d(\lvec{u},\lvec{v}) &= \lnorm{\lvec{v}-\lvec{u}} \\
      &= \sqrt{(-1-2)^2 + (4-(-1))^2 + (2-(-3))^2}\\
      &= \sqrt{9+25+25} = \sqrt{59}
    \end{align*}
  \end{enumerate}
\end{example}

\subsection{Properties of Vector Operations}
The following properties of vector addition and scalar multiplication are analogous to the more general matrix properties of Theorem~\ref{thm:matrixproperties} and indeed follow from that with the identification of vectors with column matrices.
\theorem{Let $\lvec{u}$, $\lvec{v}$, and $\lvec{w}$ be vectors in $\mathset{R}^n$ and let $a$ and $b$ be scalars. The following are true:
    \leqnomode
  \begin{subequations}
    \renewcommand{\theequation}{\arabic{equation}}
\begin{align}
\label{itm:vectorcommutative}\lvec{u} + \lvec{v} &= \lvec{v} + \lvec{u} & (\text{commutative law for addition})\\
\label{itm:vectorassociative}(\lvec{u}+\lvec{v})+ \lvec{w} &= \lvec{u}+(\lvec{v}+\lvec{w}) & (\text{associative law for addition})\\
\lvec{u} + \lvec{0} &= \lvec{u}\\
\lvec{u}+ (-\lvec{u}) & = \lvec{0}\\
(ab)\lvec{u} &= a(b \lvec{u}) = b(a \lvec{u})\\
a(\lvec{u}+\lvec{v}) &= a \lvec{u} + a \lvec{v} &  (\text{scalar distributive law})\\
\label{itm:vectorscalardistributive}(a+b)\lvec{u} &= a \lvec{u} + b \lvec{u} & (\text{scalar distributive law})\\
1 \lvec{u} &= \lvec{u}\\
%(-1)\lvec{u} &= -\lvec{u} (Removed since this is our definition of -u)
0\lvec{u} &= \lvec{0}
\end{align}\end{subequations}\reqnomode}

\textbf{Proof}:\\
Selected proofs for the two-dimensional case ($n=2$) are as follows. The more general case is analogous.  Let $\lvec{u} = (u_1, u_2)$ , $\lvec{v} = (v_1, v_2)$ , $\lvec{w} = (w_1 , w_2)$ be vectors and $a$ and $b$ scalars.
\begin{description}
\item[(\ref{itm:vectorcommutative}) commutative law:]
  \begin{align*}
    \lvec{u} + \lvec{v} &= (u_1 + v_1 , u_2 + v_2)\\
    &= (v_1 + u_1 , v_2 + u_2)\\
    &= (v_1, v_2) + (u_1 , u_2)\\
    &= \lvec{v} + \lvec{u}
\end{align*}

\item[(\ref{itm:vectorassociative}) associative law:]
\begin{align*}
  (\lvec{u}+\lvec{v})+\lvec{w} &= (u_1+v_1 , u_2+v_2) + (w_1, w_2)\\
  &= (u_1 + v_1 + w_1 , u_2 + v_2 + w_2)\\
  &= (u_1 + (v_1 + w_1), u_2 + (v_2 + w_2))\\
  &= (u_1 , u_2) + (v_1 + w_1 , v_2 + w_2)\\
  &= \lvec{u}+(\lvec{v}+\lvec{w})
\end{align*}

\item[(\ref{itm:vectorscalardistributive}) scalar distributive law:]
\begin{align*}
  (a+b)\lvec{u} &= (a+b)(u_1, u_2)\\
  &= ((a+b)u_1 , (a+b)u_2)\\
  &= (au_1 + bu_1 , au_2 + bu_2)\\
  &= (au_1 , au_2) + (bu_1 , bu_2)\\
  &= a(u_1, u_2)  + b(u_1 , u_2)\\
  &= a \lvec{u} + b \lvec{u}
\end{align*}
\end{description}

\section{Dot Product}

\definition{Let $\lvec{u}$ and $\lvec{v}$ be two vectors in $\mathset{R}^2$ , $\mathset{R}^3$ or $\mathset{R}^n$. Then the \textbf{dot product} (or the \textbf{inner product} or \textbf{scalar product}) of $\lvec{u}$ with $\lvec{v}$ is a scalar denoted $\lvec{u}\cdot\lvec{v}$ given by:
  \begin{itemize}
  \item In $\mathset{R}^2$: $\lvec{u}\cdot \lvec{v} = u_1v_1 + u_2v_2$\,.
  \item In $\mathset{R}^3$: $\lvec{u}\cdot \lvec{v} = u_1v_1 + u_2v_2 + u_3v_3$\,.
  \item In $\mathset{R}^n$: $\lvec{u}\cdot \lvec{v} = u_1v_1 + u_2v_2 +\cdots+ u_nv_n$\,.
  \end{itemize}
}
Writing the vectors as column matrices the dot product effectively equals
\[\lvec{u}\cdot\lvec{v}=\lvec{u}^T\lvec{v}\,,\]
provided we interpret the latter as the entry of the resulting $1\times1$ matrix.

\begin{example}
  Compute the dot product of the given vectors.
  \begin{enumerate}
  \item $\lvec{u} = (1, -2, -1)$ , $\lvec{v} = (3,-1,1)$\\[.5em]
    Solution:\\
    $\lvec{u}\cdot \lvec{v} = 1(3) + (-2)(-1) + (-1)(1) = 3+2-1 = 4$
  \item $\lvec{u} = \begin{bmatrix*}[r] -1\\ 1\\ 2\\ 3\end{bmatrix*}$ , $\lvec{v} =\begin{bmatrix*}[r] 5\\2\\3\\-2\end{bmatrix*}$\\[.5em]
    Solution:\\
    $\lvec{u}\cdot\lvec{v} =\lvec{u}^T\lvec{v}=\begin{bmatrix} -1 & 1 & 2 & 3 \end{bmatrix}\begin{bmatrix*}[r] 5\\2\\3\\-2\end{bmatrix*}=[(-1)(5) + 1(2) + 2(3) + 3(-2)] = [(-5) + 2 + 6 -6] = [-3]$\,,\\[.5em]
      which we interpret as the scalar $-3$\,.
  \end{enumerate}
\end{example}

\subsection{Properties of the Dot Product}
The following properties follow from the definition of the dot product.
\theorem{\label{thm:dotproperties}Let $\lvec{u}$ , $\lvec{v}$ and $\lvec{w}$ be vectors in %$\mathset{R}^2$ , $\mathset{R}^3$ or
  $\mathset{R}^n$ and $a$ be a scalar.  The following are true:
    \leqnomode
  \begin{subequations}
    \renewcommand{\theequation}{\arabic{equation}}
\begin{align}
\label{itm:dotcommutative}\lvec{u}\cdot\lvec{v} &= \lvec{v}\cdot \lvec{u} & (\text{commutative law}) \\
a(\lvec{u}\cdot \lvec{v}) &= (a \lvec{u})\cdot \lvec{v} = \lvec{u} \cdot (a \lvec{v})\\
\label{itm:dotdistributive}\lvec{u} \cdot (\lvec{v} + \lvec{w}) &= \lvec{u} \cdot \lvec{v} + \lvec{u} \cdot \lvec{w} & (\text{distributive law}) \\
\lvec{u} \cdot \lvec{0} &= 0 \\
\label{itm:dotsquarednorm}\lvec{u}\cdot \lvec{u} &= \lnorm{\lvec{u}}^2
\end{align}\end{subequations}\reqnomode}

\textbf{Proof}:\\
Selected proofs for the two-dimensional case ($n=2$) are as follows. The more general case is analogous.  Let $\lvec{u} = (u_1, u_2)$ , $\lvec{v} = (v_1, v_2)$ , $\lvec{w} = (w_1 , w_2)$ be vectors and $a$ a scalar.
\begin{description}
\item[(\ref{itm:dotcommutative}) commutative law:]
\begin{align*}
  \lvec{u} \cdot \lvec{v} &= u_1v_1 + u_2v_2 \\
  &= v_1u_1 + v_2u_2 \\
  &= \lvec{v} \cdot \lvec{u}
\end{align*}

\item[(\ref{itm:dotdistributive}) distributive law:]
\begin{align*}
  \lvec{u}\cdot (\lvec{v} + \lvec{w}) &= (u_1, u_2) \cdot (v_1+w_1 , v_2+w_2)\\
  &= u_1(v_1+w_1) + u_2(v_2+w_2)\\
  &= u_1v_1 + u_1w_1 + u_2v_2 + u_2w_2\\
  &= (u_1v_1 + u_2v_2) + (u_1w_1 + u_2w_2)\\
  &= \lvec{u} \cdot \lvec{v} + \lvec{u}\cdot \lvec{w}
\end{align*}

\item[(\ref{itm:dotsquarednorm}) $\lvec{u}\cdot \lvec{u} = \lnorm{\lvec{u}}^2$:]
\begin{align*}
  \lvec{u}\cdot \lvec{u} &= (u_1 , u_2)\cdot(u_1 , u_2)\\
  &= u_1u_1 + u_2u_2\\
  &= u_1^2 + u_2^2\\
  &= \left(\sqrt{u_1^2 + u_2^2}\right)^2\\
  &= \lnorm{\lvec{u}}^2
\end{align*}
\end{description}

The relationship between vector length and the dot product can be exploited to obtain further results.
\theorem{The lengths of the sum and difference of two vectors $\lvec{u}$ and $\lvec{v}$ satisfy
  \[\lnorm{\lvec{u}+\lvec{v}}^2 + \lnorm{\lvec{u}-\lvec{v}}^2 = 2\lnorm{\lvec{u}}^2 + 2\lnorm{\lvec{v}}^2\,.\]
}
\textbf{Proof:}
\begin{align*}
  \lnorm{\lvec{u}+\lvec{v}}^2 + \lnorm{\lvec{u}-\lvec{v}}^2
  &= (\lvec{u}+\lvec{v})\cdot (\lvec{u}+\lvec{v}) + (\lvec{u}-\lvec{v}) \cdot (\lvec{u}-\lvec{v})\\
  &= (\lvec{u}\cdot \lvec{u} + \cancel{\lvec{u}\cdot \lvec{v}} + \cancel{\lvec{v}\cdot \lvec{u}} + \lvec{v}\cdot \lvec{v}) + (\lvec{u}\cdot \lvec{u} - \cancel{\lvec{u}\cdot \lvec{v}} - \cancel{\lvec{v}\cdot \lvec{u}} + \lvec{v}\cdot \lvec{v})\\
  &= 2\lvec{u}\cdot \lvec{u} + 2\lvec{v}\cdot\lvec{v}\\
  &= 2\lnorm{\lvec{u}}^2 + 2\lnorm{\lvec{v}}^2
\end{align*}

In terms of the relationship of $\lvec{u}+\lvec{v}$ and $\lvec{u}-\lvec{v}$ to the diagonals of the parallelogram induced by vectors $\lvec{u}$ and $\lvec{v}$, the previous theorem has a geometrical interpretation in two and three dimensions.  It proves that the sum of the squares of the diagonal lengths of a parallelogram equals the sum of the squares of its side lengths, since two sides have length $\lnorm{\lvec{u}}$ and two have length $\lnorm{\lvec{v}}$\,.
\begin{center}
\includegraphics[height=1.5in]{vectors/vectorsumdifference}
\end{center}

\subsection{Angle between Vectors}

Two nonzero vectors in two or three dimensions will lie in a plane with an angle $\theta$ between them formed at the origin~$O$ between 0 and 180 degrees ($\pi$~radians).
\begin{center}
\includegraphics[height=1.5in]{vectors/angle}
\end{center}
The dot product allows us to calculate this angle and conversely the angle can be used to evaluate the dot product.

\theorem{Let $\lvec{u}$ and $\lvec{v}$ be vectors in $\mathset{R}^2 $ or $\mathset{R}^3$ and let $\theta$ be the angle between $\lvec{u}$ and $\lvec{v}$ with $0\le\theta\le\pi$. Then:
\[\lvec{u}\cdot \lvec{v} = \lnorm{\lvec{u}} \lnorm{\lvec{v}}\cos\theta\,.\]
If $\lvec{u}\neq\lvec{0}$ and $\lvec{v}\neq\lvec{0}$ then
\[\cos \theta = \frac{\lvec{u} \cdot \lvec{v}}{\lnorm{\lvec{u}} \lnorm{\lvec{v}}}\,. \]}

\textbf{Proof:}\\
The result $\lvec{u}\cdot \lvec{v} = \lnorm{\lvec{u}} \lnorm{\lvec{v}}\cos\theta$ holds trivially if either $\lvec{u}$ or $\lvec{v}$ (or both) are zero vectors, so assume neither are zero vectors. Let $OUV$ be the triangle determined by the vectors $\lvec{u}$ and $\lvec{v}$ with $U$ and $V$ being the terminal points of their respective vectors.
\begin{center}
\includegraphics[height=1.5in]{vectors/vectorangle}
\end{center}
Let $a=\lnorm{\lvec{u}}$ and $b=\lnorm{\lvec{v}}$.  If $c$ is the length of directed line segment $\overrightarrow{UV}$ then by Theorem~\ref{thm:differencequivalent} $c=\lnorm{\lvec{v}-\lvec{u}}$\,.  Applying the law of cosines one has
\[ c^2 = a^2 + b^2 - 2ab\cos\theta\,.\]
This implies
\[\lnorm{\lvec{v}-\lvec{u}}^2 = \lnorm{\lvec{u}}^2 + \lnorm{\lvec{v}}^2 - 2\lnorm{\lvec{u}}\lnorm{\lvec{v}}\cos\theta\,.\]
Expanding the square lengths using the dot product and simplifying gives:
\begin{align*}
  (\lvec{v}-\lvec{u})\cdot(\lvec{v}-\lvec{u}) &= (\lvec{u}\cdot \lvec{u})+(\lvec{v} \cdot \lvec{v}) - 2 \lnorm{\lvec{u}}\lnorm{\lvec{v}}\cos\theta\\
  \cancel{\lvec{v}\cdot \lvec{v}} - \lvec{v}\cdot\lvec{u} - \lvec{u}\cdot \lvec{v} + \cancel{\lvec{u}\cdot \lvec{u}} &= \cancel{\lvec{u}\cdot \lvec{u}} + \cancel{\lvec{v}\cdot \lvec{v}} - 2\lnorm{\lvec{u}}\lnorm{\lvec{v}}\cos\theta\\
  -\lvec{u}\cdot \lvec{v} - \lvec{u}\cdot \lvec{v} &= -2\lnorm{\lvec{u}}\lnorm{\lvec{v}}\cos\theta\\
  -2\lvec{u}\cdot\lvec{v} &= -2\lnorm{\lvec{u}}\lnorm{\lvec{v}}\cos\theta\\
  \lvec{u}\cdot\lvec{v} &= \lnorm{\lvec{u}}\lnorm{\lvec{v}}\cos\theta
\end{align*}
Since $\lvec{u}$ and $\lvec{v}$ are nonzero their lengths are nonzero and it follows that
\[\cos\theta = \frac{\lvec{u}\cdot\lvec{v}}{\lnorm{\lvec{u}}\lnorm{\lvec{v}}}\,.\]

\begin{example}
  Find the angle between each pair of vectors.
  \begin{enumerate}
  \item $\lvec{u} = (-1,2,1) \, \, , \, \, \lvec{v} = (2,1,1)$\\
    Solution:
    \begin{align*}
      \lvec{u}\cdot \lvec{v} &= (-1,2,1)\cdot (2,1,1)= (-1)2+2(1) + 1(1)= 1\\
      \lnorm{\lvec{u}} &= \sqrt{(-1)^2 + 2^2 + 1^2} = \sqrt{6}\\
      \lnorm{\lvec{v}} &= \sqrt{2^2 + 1^2 + 1^2} = \sqrt{6}
    \end{align*}
    Therefore:
    \[\cos\theta = \frac{\lvec{u}\cdot\lvec{v}}{\lnorm{\lvec{u}}\lnorm{\lvec{v}}}= \frac{1}{\sqrt{6}\cdot\sqrt{6}}= \frac{1}{6}\]
    \[\theta=\cos^{-1}(1/6)\approx 80.4^\circ=1.40\ (\text{radians})\,.\]

  \item $\lvec{u} = (2,1,-1) \, \, , \, \, \lvec{v} = (1,-1,1)$\\
    Solution:
    \[\lvec{u}\cdot \lvec{v}= (2,1,-1)\cdot(1,-1,1)= 2(1) + 1(-1) + (-1)(1)= 0\]
    Therefore:
\[\cos\theta = \frac{\lvec{u}\cdot\lvec{v}}{\lnorm{\lvec{u}}\lnorm{\lvec{v}}}
= \frac{0}{\lnorm{\lvec{u}}\lnorm{\lvec{v}}}=0\]
Since $\cos\theta=0$, we have $\displaystyle\theta=\cos^{-1}(0)=\frac{\pi}{2}$\,.
  \end{enumerate}
\end{example}

\definition{Two vectors, $\lvec{u}$ and $\lvec{v}$ in $\mathset{R}^n$ are \textbf{orthogonal} if $\lvec{u}\cdot \lvec{v}= 0$\,.}
Orthogonality can therefore happen if the angle $\theta$ between the vectors is $\pi/2$ (as in the last example) or either $\lvec{u}$ or $\lvec{v}$ is a zero vector.

\begin{example}
  The elementary vectors $\lvec{e}_i$ are all mutually orthogonal.  For example, in $\mathset{R}^3$
  \[\lvec{e}_1\cdot\lvec{e}_2=\lvec{i}\cdot\lvec{j}=(1,0,0)\cdot(0,1,0)=(1)(0)+(0)(1)+(0)(0)=0\,.\]
\end{example}

The sign of the dot product provides useful information. Since the lengths $\lnorm{u}$ and $\lnorm{v}$ are both positive for nonzero vectors, the sign of $\cos\theta$ will be determined by that of the numerator $\lvec{u}\cdot\lvec{v}$ in our formula and we have the following result.
\theorem{Let $\lvec{u}$ and $\lvec{v}$ be nonzero vectors in $\mathset{R}^2$ or $\mathset{R}^3$ and let $\theta$ be the angle between them. Then $\theta$ satisfies
\begin{enumerate}
  \item $0\le\theta<\pi/2$ ~~\,if~~ $\lvec{u}\cdot \lvec{v} > 0$ ~~~($\theta$ is 0 or acute)\,.
  \item $\theta=\pi/2$ ~~~~~~~~if~~ $\lvec{u}\cdot \lvec{v} = 0$ ~~~($\theta$ is a right angle)\,.
  \item $\pi/2<\theta\le\pi$ ~~if~~ $\lvec{u}\cdot \lvec{v} < 0$ ~~~($\theta$ is obtuse or $\pi$)\,.
\end{enumerate}}
To distinguish the two exceptional cases of $\theta=0$ (parallel vectors) or $\theta=\pi$ (antiparallel vectors) one needs to evaluate the formula for $\cos\theta$ to see if it actually is $+1$ or $-1$ respectively.

\begin{example}
  Use the dot product to determine the range of the angle formed by the given vectors.
  \begin{enumerate}
  \item $\lvec{u} = (3,2,-2) \, \, , \, \, \lvec{v} = (2,1,2)$\\[.5em]
    Solution:
    \[\lvec{u}\cdot \lvec{v} = (3)(2) + (2)(1) + (-2)(2) = 4 >0 \implies\ 0\le\theta<\frac{\pi}{2}.\]
  \item $\lvec{u} = (2,1,-1) \, \, , \, \, \lvec{v} = (1,-1,1)$\\[.5em]
    Solution:
    \[\lvec{u}\cdot \lvec{v} = (2)(1) + (1)(-1) + (-1)(1) = 0 \implies\ \theta=\frac{\pi}{2}\ \text{(right angle)}.\]
  \item $\lvec{u} =\begin{bmatrix*}[r]4\\-3\end{bmatrix*} \, \, , \, \, \lvec{v}=\begin{bmatrix}1\\2\end{bmatrix}$\\[.5em]
    Solution:
    \[\lvec{u}\cdot \lvec{v} = \lvec{u}^T\lvec{v}=\begin{bmatrix}4 & -3\end{bmatrix}\begin{bmatrix}1\\2\end{bmatrix}=(4)(1) + (-3)(2)= -2 <0 \implies\ \frac{\pi}{2}<\theta\le\pi.\]
  \end{enumerate}
\end{example}

\subsubsection{Angles in $\mathset{R}^n$}
In higher dimensions ($n>3$) we cannot resort to geometry to evaluate angles.  However we can \emph{define} the angle $\theta$ between two nonzero vectors in $\mathset{R}^n$ to be that value $0\le\theta\le\pi$ satisfying
\[\cos\theta=\frac{\lvec{u}\cdot\lvec{v}}{\lnorm{\lvec{u}}\lnorm{\lvec{v}}}\,.\]
Since cosine ranges between $-1$ and $1$ that this angle is well-defined is not obvious.  That the definition works follows from the \textbf{Cauchy-Schwarz inequality}:
\theorem{If $\lvec{u}$ and $\lvec{v}$ are vectors in $\mathset{R}^n$ then
  \[|\lvec{u}\cdot\lvec{v}|\le\lnorm{\lvec{u}}\lnorm{\lvec{v}}\,.\]}

For nonzero vectors we can divide both sides by the positive quantity $\lnorm{\lvec{u}}\lnorm{\lvec{v}}$ to get
\[\left|\frac{\lvec{u}\cdot\lvec{v}}{\lnorm{\lvec{u}}\lnorm{\lvec{v}}}\right|\le 1\,,\]
and our angle $\theta$ is well-defined. Furthermore, one can show that when $\theta=0$ the vectors are parallel ($\lvec{u}=a\lvec{v}$ for some positive scalar $a$) and when $\theta=\pi$ the vectors are antiparallel ($\lvec{u}=a\lvec{v}$ for some negative scalar $a$) as one expects.


\subsection{Projection Theorem}

We have seen that an arbitrary vector in $\mathset{R}^n$ can be written
\[\lvec{u}=(u_1,u_2,\ldots,u_n)=u_1\lvec{e}_1+u_2\lvec{e}_2+u_n\lvec{e}_n\,.\]
Here $u_1$ is the first component and $u_1\lvec{e_1}$ is the vector component directed along the first axis.  If we take the dot product of both sides with $\lvec{e}_1$ we get
\begin{align*}
  \lvec{u}\cdot\lvec{e}_1&=\left(u_1\lvec{e}_1+u_2\lvec{e}_2+\cdots+u_n\lvec{e}_n\right)\cdot\lvec{e}_1\\
  & = \left(u_1\lvec{e}_1\right)\cdot\lvec{e}_1+ \left(u_2\lvec{e}_2\right)\cdot\lvec{e}_1+\cdots+\left(u_n\lvec{e}_n\right)\cdot\lvec{e}_1\\
  & = u_1 (\lvec{e}_1\cdot\lvec{e}_1)+u_2(\lvec{e}_1\cdot\lvec{e}_2)+\cdots+u_n(\lvec{e}_1\cdot\lvec{e}_n)\\
  & = u_1\lnorm{\lvec{e}_1}^2+u_2(0)+\cdots+u_n(0)\\
  & = u_1(1) + 0 + \cdots + 0\\
  & = u_1
\end{align*}
and in general $\lvec{u}\cdot\lvec{e}_i=u_i$\,.  In other words the dot product can be used to find the $i\textsuperscript{th}$ component of the vector and it follows that the vector component along that direction is just
\[u_i\lvec{e}_i=(\lvec{u}\cdot\lvec{e}_i)\lvec{e}_i\,.\]
Moreover our above calculation (in the $i=1$ case) shows that
\[\lvec{u}=\lvec{u_1}+\lvec{u_2}\,\]
where
\[\lvec{u}_1=u_1\lvec{e}_1=(\lvec{u}\cdot\lvec{e}_1)\lvec{e}_1\]
is directed along the direction $\lvec{e_1}$ and
\[\lvec{u}_2=u_2\lvec{e}_2+\cdots+u_n\lvec{e}_n=\lvec{u}-u_1\lvec{e_1}=\lvec{u}-(\lvec{u}\cdot\lvec{e}_1)\lvec{e}_1\]
is orthogonal to it, $\lvec{u}_2\cdot\lvec{e}_1=0$\,.

We can generalize this decomposition to arbitrary directions, not simply coordinate axis directions.  We often want to decompose one vector into a sum of two other vectors such that
\[\lvec{u} = \lvec{u}_1 + \lvec{u}_2\,\]
where $\lvec{u}_1$ is in the same direction as $\lvec{a}$ (ie. $\lvec{u}_1$ is a scalar multiple of $\lvec{a}$) and $\lvec{u}_2$ is orthogonal to $\lvec{a}$.
\begin{center}
\includegraphics[height=1.5in]{vectors/projection}
\end{center}
If we define $\lvec{e}$ to be the unit vector along the direction $\lvec{a}$, so $\lvec{e}=\frac{1}{\lnorm{a}}\lvec{a}$, then our previous discussion suggests that the vector component of $\lvec{u}$ along the direction of $\lvec{a}$ should be
\[\lvec{u}_1=(\lvec{u}\cdot\lvec{e})\lvec{e}=\left(\lvec{u}\cdot\frac{1}{\lnorm{a}}\lvec{a}\right)\frac{1}{\lnorm{a}}\lvec{a}=\frac{\lvec{u} \cdot \lvec{a}}{\lnorm{\lvec{a}}^2}\lvec{a}\,.\]
This is correct and the result is summarized in the following projection theorem.

\theorem{Let $\lvec{u}$ and $\lvec{a}$ be vectors in $\mathset{R}^n$ with $\lvec{a}\neq\lvec{0}$.  Then $\lvec{u}$ has a unique decomposition into a vector projection along the direction of $\lvec{a}$ and one perpendicular to it:
  \[\lvec{u} = \lvec{u}_1 + \lvec{u}_2\,,\]
  where the vector $\lvec{u}_1$, denoted by $\vectorproj{a}{u}$, is given by
  \[\lvec{u}_1=\vectorproj{a}{u}=\frac{\lvec{u} \cdot \lvec{a}}{\lnorm{\lvec{a}}^2}\lvec{a} \]
  and is called the \textbf{vector component of $\lvec{u}$ along $\lvec{a}$} or the \textbf{orthogonal projection of $\lvec{u}$ on $\lvec{a}$} and
\[\lvec{u}_2 = \lvec{u} - \frac{\lvec{u}\cdot\lvec{a}}{\lnorm{\lvec{a}}^2}\lvec{a}\]
is the \textbf{component of \lvec{u} orthogonal to $\lvec{a}$}.}

\textbf{Proof:}
Let $\lvec{u}$, $\lvec{a}\neq\lvec{0}$ be vectors in $\mathset{R}^n$ and suppose $\lvec{u}=\lvec{u}_1+\lvec{u}_2$ where $\lvec{u}_1=c\lvec{a}$ is directed along $\lvec{a}$ and $\lvec{u}_2$ is orthogonal to it.  Then
\begin{align*}
  \lvec{u}\cdot\lvec{a} & = (\lvec{u}_1+\lvec{u}_2)\cdot\lvec{a} \\
  & = \lvec{u}_1\cdot\lvec{a}+\lvec{u}_2\cdot\lvec{a}\\
  & = c\lvec{a}\cdot\lvec{a}+0\\
  & = c\lnorm{\lvec{a}}^2
\end{align*}
Since $\lnorm{\lvec{a}}\neq0$, $\displaystyle c=\frac{\lvec{u}\cdot\lvec{a}}{\lnorm{\lvec{a}}^2}$ and $\lvec{u}_1=\vectorproj{a}{u}$\,.  Then $\lvec{u_2}=\lvec{u}-\lvec{u}_1=\lvec{u}-\vectorproj{a}{u}$.  Furthermore $\lvec{u}_2$ is orthogonal to $\lvec{a}$ since
\begin{align*}
  \lvec{u}_2\cdot\lvec{a} & = \left(\lvec{u}-\vectorproj{a}{u}\right)\cdot\lvec{a}\\
  & = \left(\lvec{u} - \frac{\lvec{u}\cdot\lvec{a}}{\lnorm{\lvec{a}}^2}\lvec{a}\right)\cdot\lvec{a} \\
  & =  \lvec{u}\cdot\lvec{a}- \frac{\lvec{u}\cdot\lvec{a}}{\lnorm{\lvec{a}}^2}(\lvec{a}\cdot\lvec{a}) \\
  & =  \lvec{u}\cdot\lvec{a}- \frac{\lvec{u}\cdot\lvec{a}}{\lnorm{\lvec{a}}^2}\lnorm{\lvec{a}}^2 \\
  & =  \lvec{u}\cdot\lvec{a}-\lvec{u}\cdot\lvec{a}\\
  & =  0
\end{align*}
Thus any such decomposition is unique.  Since clearly $\lvec{u}_1=\vectorproj{a}{u}$ and $\lvec{u}_2=\lvec{u}-\vectorproj{a}{u}$ exist as vectors the decomposition exists.

\begin{example}
  Let $\lvec{u} = (2,-1,3)$ , $\lvec{a} = (4,-1,2)$. Find the vector component ($\lvec{u_1}$) of $\lvec{u}$ along $\lvec{a}$ and the vector component ($\lvec{u_2}$) of $\lvec{u}$ orthogonal to $\lvec{a}$.
  Solution:
  \begin{align*}
    \lvec{u}\cdot \lvec{a} &= (2)(4) + (-1)(1) + (3)(2) = 15\\
    \lnorm{\lvec{a}}^2 &= 4^2 + (-1)^2 + 2^2 = 21
  \end{align*}
  Therefore:
  \begin{align*}
    \lvec{u_1} &= \vectorproj{a}{u} = \frac{\lvec{u} \cdot \lvec{a}}{\lnorm{\lvec{a}}^2}\lvec{a} = \frac{15}{21}(4,-1,2)= \frac{5}{7}(4,-1,2)\\
    \lvec{u_2} &= \lvec{u} - \vectorproj{a}{u} = (2,-1,3) - \frac{5}{7}(4,-1,2)\\
    &= \left(2- \frac{20}{7} , -1 + \frac{5}{7} , 3- \frac{10}{7}\right)\\
    &= \left(-\frac{6}{7} , -\frac{2}{7} , \frac{11}{7}\right)
  \end{align*}
\end{example}

\begin{example}
  Find the projection of $\lvec{u} = (2,0,1)$ on $\lvec{a} = (1,2,3)$\,.\\
  Solution:
  \begin{align*}
    \lvec{u}\cdot \lvec{a} &= 2(1) + (0)(2) + 1(3) = 5\\
    \lnorm{\lvec{a}}^2 &= 1^2+2^2+3^2 = 14
  \end{align*}
  Therefore
   \[\vectorproj{a}{u} = \frac{\lvec{u}\cdot\lvec{a}}{\lnorm{\lvec{a}}^2}\lvec{a}= \frac{5}{14}(1,2,3)\,.\]
\end{example}

The length of the projection of $\lvec{u}$ along $\lvec{a}$ can be written in terms of the angle between them.
\begin{center}
\includegraphics[height=1.5in]{vectors/projectionangle}
\end{center}

\theorem{
  If $\lvec{u}$ and $\lvec{a}\neq{\lvec{0}}$ are vectors in $\mathset{R}^n$ then the length of the projection of $\lvec{u}$ on $\lvec{a}$ satisfies:
  \[\lnorm{\vectorproj{a}{u}} = \lnorm{\lvec{u}} |\cos\theta|\,,\]
where $\theta$ is the angle between $\lvec{u}$ and $\lvec{a}$\,.
}

\textbf{Proof:}\\
Noting that $\displaystyle\frac{\lvec{u}\cdot \lvec{a}}{\lnorm{\lvec{a}}^2}$ is a scalar that can be pulled out of $\lnorm{\cdot}$, we have
\[\lnorm{\vectorproj{a}{u}} = \lnorm{\frac{\lvec{u}\cdot \lvec{a}}{\lnorm{\lvec{a}}^2}\lvec{a}}
= \left|\frac{\lvec{u}\cdot\lvec{a}}{||\lvec{a}||^2}\right|\,||\lvec{a}||
= \frac{|\lvec{u}\cdot\lvec{a}|}{\lnorm{\lvec{a}}^2}\,\lnorm{\lvec{a}}
= \frac{|\lvec{u}\cdot\lvec{a}|}{\lnorm{\lvec{a}}}
= \frac{\lnorm{\lvec{u}}\lnorm{\lvec{a}}|\cos\theta|}{\lnorm{\lvec{a}}}
= \lnorm{\lvec{u}}|\cos\theta|\,.\]

\section{Cross Product}

It is possible in three dimensions ($\mathset{R}^3$) to define a useful multiplication between two vectors that produces a \emph{vector}.\footnote{Unlike the dot product which is defined for all $\mathset{R}^n$ a cross product with the properties to be outlined later, cannot be defined in most dimensions.  It is possible to define a cross product in $\mathset{R}^7$.  Later we will introduce complex numbers.  These can be generalized to quaternions and octonions with four and eight real components respectively. The vector product in $\mathset{R}^7$ can be related to the vector part of octonion multiplication just as the $\mathset{R}^3$ cross product is related to the vector part of quaternion multiplication.}

\definition{Let $\lvec{u} = (u_1 , u_2 , u_3)$ and $\lvec{v} = (v_1 , v_2 , v_3)$ be vectors in $\mathset{R}^3$. The \textbf{cross product} of $\lvec{u}$ with $\lvec{v}$ is a vector in $\mathset{R}^3$ given by:
  \[\lvec{u}\times \lvec{v} = (u_2v_3 - u_3v_2,\ u_3v_1 - u_1v_3,\ u_1v_2 - u_2v_1)\,.\]}

The cross product formula is easily remembered if we formally allow unit vectors into a $3\times3$ determinant
\[\lvec{u}\times \lvec{v} = \begin{vmatrix}
\lvec{i}&\lvec{j}&\lvec{k}\\ u_1 & u_2 & u_3 \\ v_1 & v_2 & v_3
\end{vmatrix} = \begin{vmatrix}
\lvec{i}&u_1&v_1\\ \lvec{j} & u_2 & v_2 \\ \lvec{k} & u_3 & v_3
\end{vmatrix}\,,\]
and cofactor expand along the first row or column respectively. For example, expanding along the first row of the first determinant,
\begin{align*}
\lvec{u}\times \lvec{v} = \begin{vmatrix}
\lvec{i}&\lvec{j}&\lvec{k}\\ u_1 & u_2 & u_3 \\ v_1 & v_2 & v_3
\end{vmatrix}
&= \lvec{i} \begin{vmatrix}
u_2&u_3\\v_2&v_3
\end{vmatrix} - \lvec{j}\begin{vmatrix}
u_1&u_3\\v_1&v_3
\end{vmatrix} + \lvec{k}\begin{vmatrix}
u_1&u_2\\v_1&v_2
\end{vmatrix}\\
&= \lvec{i}(u_2v_3 - u_3v_2) - \lvec{j}(u_1v_3 - u_3v_1) + \lvec{k}(u_1v_2 - u_2v_1)\\
&= (u_2v_3 - u_3v_2,\ u_3v_1 - u_1v_3,\ u_1v_2 - u_2v_1)\,.
\end{align*}

\begin{example}
  Find the cross product of the given vectors.

\begin{enumerate}
\item $\lvec{u}  = (-1,2,1) \, \, , \, \, \lvec{v} = (1,1,0)$\\[.5em]
  Solution:
  \begin{align*}
    \lvec{u}\times \lvec{v} &= \begin{vmatrix*}[r]
\lvec{i}&\lvec{j}&\lvec{k}\\ -1 & 2 & 1 \\ 1 & 1 & 0
\end{vmatrix*} &\leftarrow\text{Cofactor expansion along the first row.}\\
&= \lvec{i}\begin{vmatrix}
2&1\\1&0
\end{vmatrix} - \lvec{j}\begin{vmatrix*}[r]
-1&1\\1&0
\end{vmatrix*} + \lvec{k}\begin{vmatrix*}[r]
-1&2\\1&1
\end{vmatrix*}\\
&= \lvec{i}(0-1) - \lvec{j}(0-1) + \lvec{k}(-1-2)\\
&= -\lvec{i} + \lvec{j} - 3 \lvec{k}\\
&= (-1, 1, -3)
  \end{align*}
\item $\lvec{u} =\begin{bmatrix*}[r]3\\ -4\\ 1\end{bmatrix*} \, \, , \, \, \lvec{v} = \begin{bmatrix*}[r]-1\\1\\1\end{bmatrix*}$\\[.5em]
  Solution:
  \begin{align*}
      \lvec{u}\times \lvec{v} &= \begin{vmatrix*}[r]
\lvec{i}&3&-1\\ \lvec{j} & -4 & 1 \\ \lvec{k} & 1 & 1
\end{vmatrix*}&\leftarrow\text{Cofactor expansion along the first column.}\\
&= \lvec{i}\begin{vmatrix*}[r]
-4&1\\1&1
\end{vmatrix*} - \lvec{j}\begin{vmatrix*}[r]
3&-1\\1&1
\end{vmatrix*} + \lvec{k}\begin{vmatrix*}[r]
3&-1\\-4&1
\end{vmatrix*}\\
&= \lvec{i}(-4-1)- \lvec{j}(3+1) + \lvec{k}(3-4)\\
&= -5 \lvec{i} - 4 \lvec{j} - \lvec{k}\\
&= (-5,-4,-1)
  \end{align*}
\end{enumerate}

\end{example}

\begin{example}
  Given $\lvec{u} = (2,-1,1)$ and $\lvec{v} = (3,2,1)$, evaluate the following, if possible.

  \begin{enumerate}
  \item $\lvec{u} \times (\lvec{u}\cdot \lvec{v})$\\[.5em]
    Solution:\\
    The dot product $\lvec{u}\cdot\lvec{v}$ is a scalar but the cross product acts on two vectors so $\lvec{u} \times (\lvec{u}\cdot \lvec{v})$ is not defined.
  \item $\lvec{u}\cdot (\lvec{u}\times \lvec{v})$\\[.5em]
    Solution:
    \begin{align*}
      \lvec{u}\times \lvec{v} &= \begin{vmatrix*}[r]
        \lvec{i}&\lvec{j}&\lvec{k}\\ 2 & -1 & 1 \\ 3 & 2 & 1
      \end{vmatrix*}\\
      &= \lvec{i}\begin{vmatrix*}[r]
        -1&1\\2&1
      \end{vmatrix*} - \lvec{j} \begin{vmatrix*}[r]
        2&1\\3&1
      \end{vmatrix*} + \lvec{k}\begin{vmatrix*}[r]
        2&-1\\3&2
      \end{vmatrix*}\\
      &= -3 \lvec{i} + \lvec{j} + 7 \lvec{k}\\
      &= (-3,1,7)
    \end{align*}
    Therefore:
    \[\lvec{u} \cdot (\lvec{u}\times \lvec{v})= (2,-1,1) \cdot (-3,1,7)= -6-1+7= 0\,.\]
  \end{enumerate}
\end{example}

In the last example $\lvec{u}\times\lvec{v}$ was found to be orthogonal to $\lvec{u}$.  This is true in general.
\theorem{The vector $\lvec{u}\times \lvec{v}$ is orthogonal to both $\lvec{u}$ and $\lvec{v}$.}

\textbf{Proof:}\\
Let $\lvec{u} = (u_1 , u_2 , u_3)$ and $\lvec{v} = (v_1, v_2, v_3)$. Then $\lvec{u}\times \lvec{v} = \begin{vmatrix}
\lvec{i}&\lvec{j}&\lvec{k}\\ u_1 & u_2 & u_3 \\ v_1 & v_2 & v_3
\end{vmatrix}$ and
\begin{align*}
  \lvec{u}\cdot (\lvec{u}\times \lvec{v}) &= (u_1,u_2,u_3)\cdot (u_2v_3 - u_3v_2,u_3v_1-u_1v_3,u_1v_3-u_3v_1)\\
  & =u_1(u_2v_3 - u_3v_2) + u_2(u_3v_1 - u_1v_3) + u_3(u_1v_2 - u_2v_1)\\
  & =u_1u_2v_3 - u_1u_3v_2 + u_2u_3v_1 - u_2u_1v_3+ u_3u_1v_2 - u_3u_2v_1\\
  & = 0
\end{align*}
Similarly one can show that $\lvec{v}\cdot(\lvec{u}\times\lvec{v})=0$\,.

\begin{example}
  Find a vector $\lvec{w}$ that is orthogonal to both vectors.
  \begin{enumerate}
  \item $\lvec{u} = (0,1,-2) \, \, , \, \, \lvec{v} = (1,-1,3)$\\[.5em]
    Solution:
    \begin{align*}
      \lvec{w} &= \lvec{u}\times \lvec{v}\\
      &= \begin{vmatrix*}[r]
\lvec{i}&\lvec{j}&\lvec{k}\\ 0 & 1 & -2 \\ 1 & -1 & 3
\end{vmatrix*}\\
&= \lvec{i} \begin{vmatrix*}[r]
1&-2\\-1&3
\end{vmatrix*} - \lvec{j} \begin{vmatrix*}[r]
0&-2\\1&3
\end{vmatrix*} + \lvec{k} \begin{vmatrix*}[r]
0&1\\1&-1
\end{vmatrix*}\\
&= \lvec{i} -2 \lvec{j} - \lvec{k}\\
&= (1,-2,-1)
    \end{align*}
    $\lvec{w}=(1,-2,-1)$ is orthogonal to both $\lvec{u}$ and $\lvec{v}$.

  Check:
  \begin{align*}
    \lvec{u}\cdot \lvec{w} &= 0(1) + 1(-2) -2(-1)\\
    &= 0-2+2 = 0\\
    \lvec{v}\cdot \lvec{w} &= 1(1) + (-1)(-2) + 3(-1)\\
    &= 1+2-3 = 0\\
  \end{align*}
  % Switched this to vertical vectors.  Left the original in case this
  % considered a bad idea.
\begin{comment}
\item $\lvec{u} = (-2,5,-1) \, \, , \, \, \lvec{v} = (-3,0,1)$
  \begin{align*}
     \lvec{w} &= \lvec{u}\times \lvec{v}\\
      &= \begin{vmatrix*}[r]
\lvec{i}&\lvec{j}&\lvec{k}\\ -2 & 5 & -1 \\ -3 & 0 & 1
\end{vmatrix*}\\
&= \lvec{i}\begin{vmatrix*}[r]
5&-1\\0&1
\end{vmatrix*} - \lvec{j}\begin{vmatrix*}[r]
-2&-1\\-3&1
\end{vmatrix*} + \lvec{k}\begin{vmatrix*}[r]
-2&5\\-3&0
\end{vmatrix*}\\
&= 5 \lvec{i} + 5 \lvec{j} + 15 \lvec{k}\\
&= (5,5,15)
  \end{align*}
\end{comment}
\item $\lvec{u} = \begin{bmatrix*}[r]-2\\5\\-1\end{bmatrix*} \, \, , \, \, \lvec{v} = \begin{bmatrix*}[r] -3\\0\\1\end{bmatrix*}$\\[.5em]
    Solution:
\[\lvec{w} = \lvec{u}\times \lvec{v} = \begin{vmatrix*}[r]
\lvec{i}&-2&-3\\ \lvec{j} & 5 & 0 \\ \lvec{k} & -1& 1
\end{vmatrix*}= \lvec{i}(5-0)-\lvec{j}(-2-3) + \lvec{k}(0+15)= 5 \lvec{i} + 5 \lvec{j} + 15 \lvec{k}=\begin{bmatrix*}[r]5\\5\\15\end{bmatrix*}\]
  \end{enumerate}
\end{example}

\subsection{Right-Hand Rule}
Since $\lvec{u}\times\lvec{v}$ is orthogonal to both $\lvec{u}$ and $\lvec{v}$ it is directed out of the plane determined by those two vectors and it is natural to ask in which of the two possible directions this is.  One can readily verify that the unit vectors in $\mathset{R}^3$ satisfy
\begin{align*}
  \lvec{i}\times\lvec{j}&=\lvec{k} & \lvec{j}\times\lvec{k}&=\lvec{i} & \lvec{k}\times\lvec{i}&=\lvec{j}\,.
\end{align*}
Assume we choose, as has been done so far in this text, a coordinate system that is \textbf{right-handed}.  This means that if you straighten your right hand and point it in the $x$ direction $\lvec{i}$ and then curl your fingers in the $y$ direction $\lvec{j}$, your thumb will point in the $z$ direction $\lvec{k}$.  Provided such a coordinate system is used then the direction of the cross product is similarly determined by the \textbf{right-hand rule}. Directing your straightened right hand along the direction of $\lvec{u}$ and curling your fingers in the direction~$\lvec{v}$, the cross product $\lvec{u}\times\lvec{v}$ points in the direction of your thumb.
\begin{center}
\includegraphics[height=1.5in]{vectors/righthandrule1}\hspace{8em}\includegraphics[height=1.5in]{vectors/righthandrule2}
\end{center}
If left-handed coordinate systems are used then cross products will follow a left-hand rule, but such coordinate systems will be avoided in this text.\footnote{It may be wondered how the cross product, in our formulation, can represent physical quantities if its direction depends on the choice of a right-handed or left-handed coordinate system.  In fact the cross product is known as a \textbf{pseudovector} or \textbf{axial vector}.  If one tries to avoid appealing to coordinates by \emph{defining} the cross product in terms of the right-hand rule the cross product still behaves unvector-like under improper rotations such as reflections, where it flips sign (direction) when $\lvec{u}$ and $\lvec{v}$ are reflected across a plane.  This said, the cross product is invariant under proper rotations and finds many useful physical applications with angular momentum and torque being among them.}

\subsection{Properties of the Cross Product}

\theorem{\label{thm:crossproperties}Let $\lvec{u}$, $\lvec{v}$, and $\lvec{w}$ be vectors in $\mathset{R}^3$ and let $a$ be a scalar. The following are true:
    \leqnomode
  \begin{subequations}
    \renewcommand{\theequation}{\arabic{equation}}
\begin{align}
\label{itm:crossanticommute}\lvec{u}\times \lvec{v} & = -\lvec{v}\times \lvec{u} & (\text{anticommutative law})\\
\lvec{u}\times(\lvec{v}+\lvec{w}) & = \lvec{u}\times \lvec{v} + \lvec{u}\times \lvec{w} & (\text{left distributive law})\\
(\lvec{u}+\lvec{v})\times \lvec{w} & = \lvec{u}\times \lvec{w} + \lvec{v}\times \lvec{w} & (\text{right distributive law})\\
a(\lvec{u}\times \lvec{v}) & = (a \lvec{u})\times \lvec{v} = \lvec{u}\times (a \lvec{v})\\
\label{itm:crossselfzero}\lvec{u} \times \lvec{0} & = \lvec{0}\times \lvec{u} = \lvec{0}\\
\lvec{u}\times \lvec{u} & = \lvec{0}\\[-.6em]
\label{itm:crosslength}\lnorm{\lvec{u}\times \lvec{v}} & = \lnorm{\lvec{u}} \lnorm{\lvec{v}}\sin\theta = \sqrt{\lnorm{\lvec{u}}^2 \lnorm{\lvec{v}}^2 - (\lvec{u}\cdot\lvec{v})^2} & (\text{cross product length})
\end{align}\end{subequations}\reqnomode
Here $\theta$ is the angle determined by $\lvec{u}$ and $\lvec{v}$, $0\le\theta\le \pi$\,.
}

\textbf{Proof}:\\
Let $\lvec{u} = (u_1, u_2, u_3)$, $\lvec{v} = (v_1, v_2, v_3)$ , and $\lvec{w} = (w_1 , w_2, w_3)$ be vectors in $\mathset{R}^3$ and $a$ a scalar. Selected proofs of the properties follow below.

\begin{description}
  \item[(\ref{itm:crossanticommute})anticommutative law:]

\begin{align*}
  \lvec{u}\times \lvec{v} &= \begin{vmatrix}
  \lvec{i}&\lvec{j}&\lvec{k}\\u_1&u_2&u_3\\v_1&v_2&v_3
  \end{vmatrix}\\
  &= (u_2v_3 - u_3v_2, u_3v_1 - u_1v_3, u_1v_2 - u_2v_1)\\
  &= -1(v_2u_3- v_3u_2, v_3u_1- v_1u_3, v_1u_2- v_2u_1)\\
  & =  -\begin{vmatrix}
  \lvec{i}&\lvec{j}&\lvec{k}\\v_1&v_2&v_3\\u_1&u_2&u_3
  \end{vmatrix}\\
  &= -\lvec{v}\times \lvec{u}
\end{align*}
(Exchanging rows in the determinant flips its sign as expected.)

\item{(\ref{itm:crossselfzero}) $\lvec{u}\times\lvec{u}=\lvec{0}$:}
\begin{align*}
  \lvec{u}\times \lvec{u} &= \begin{vmatrix}
  \lvec{i} & \lvec{j} & \lvec{k} \\ u_1&u_2&u_3 \\ u_1&u_2 & u_3
  \end{vmatrix}\\
  &= (u_2u_3 - u_3u_2 , u_3u_1 - u_1u_3, u_1u_2 - u_2u_1)\\
  &= (0,0,0)\\
  &= \lvec{0}
\end{align*}
(Determinant of matrix with two equal rows vanishes as expected.)

\item[(\ref{itm:crosslength}) cross product length:]
\begin{align*}
  \lnorm{\lvec{u}\times \lvec{v}}^2 &= \lnorm{(u_2v_3 - u_3v_2 , u_3v_1 - u_1v_3 , u_1v_2 - u_2v_1)}^2\\
  &= (u_2v_3 - u_3v_2)^2 + (u_3v_1 - u_1v_3)^2 + (u_1v_2 - u_2v_1)^2\\
  &= u_2^2v_3^2 - 2u_2u_3v_2v_3 + u_3^2v_2^2 + u_3^2v_1^2  - 2u_1u_3v_1v_3 + u_1^2v_3^2\\
  &~~~+ u_1^2v_3^2 + u_1^2v_2^2 - 2u_1u_2v_1v_2 + u_2^2v_1^2\\
  \lnorm{\lvec{u}}^2\lnorm{\lvec{v}}^2 - (\lvec{u}\cdot \lvec{v})^2 &= (u_1^2 + u_2^2 + u_3^2)(v_1^2 + v_2^2 + v_3^2) - (u_1v_1 + u_2v_2 + u_3v_3)^2\\
  & = \cancel{u_1^2v_1^2}+u_1^2v_2^2+u_1^2v_3^2+u_2^2v_1^2+\cancel{u_2^2v_2^2}+u_2^2v_3^2+u_3^2v_1^2+u_3^2v_2^2+\cancel{u_3^2v_3^2}\\
  & ~~~-\cancel{u_1^2v_1^2}-\cancel{u_2^2v_2^2}-\cancel{u_3^2v_3^2} -2u_1v_1u_2v_2-2u_1v_1u_3v_3-2u_2v_2u_3v_3\\
  &= u_2^2v_3^2 - 2u_2u_3v_2v_3 + u_3^2v_2^2 + u_3^2v_2^2 + u_3^2v_1^2 - 2u_1u_3v_1v_3 + u_1^2v_3^2\\
  &~~~+ u_1^2v_2^2 - 2u_1u_2v_1v_2 + u_2^2v_1^2
\end{align*}
Therefore
\[\lnorm{\lvec{u}\times \lvec{v}}^2 = \lnorm{\lvec{u}}^2\lnorm{\lvec{v}}^2 - (\lvec{u}\cdot \lvec{v})^2\,.\]

Furthermore,
\begin{align*}
  \lnorm{\lvec{u}}^2\lnorm{\lvec{v}}^2 - (\lvec{u}\cdot \lvec{v})^2 &= \lnorm{\lvec{u}}^2\lnorm{\lvec{v}}^2 - (\lnorm{\lvec{u}}\lnorm{\lvec{v}}\cos\theta)^2\\
  &= \lnorm{\lvec{u}}^2 \lnorm{\lvec{v}}^2 -\lnorm{\lvec{u}}^2 \lnorm{\lvec{v}}^2 \cos^2\theta\\
  &= \lnorm{\lvec{u}}^2 \lnorm{\lvec{v}}^2 (1-\cos^2\theta)\\
  &= \lnorm{\lvec{u}}^2 \lnorm{\lvec{v}}^2 \sin^2\theta
\end{align*}
Thus
\begin{align*}
  \sqrt{\lnorm{\lvec{u}\times \lvec{v}}^2} &= \sqrt{\lnorm{\lvec{u}}^2\lnorm{\lvec{v}}^2 - (\lvec{u}\cdot \lvec{v})^2}=\sqrt{\lnorm{\lvec{u}}^2 \lnorm{\lvec{v}}^2 \sin^2\theta}\\
  \lnorm{\lvec{u}\times \lvec{v}} &=\sqrt{\lnorm{\lvec{u}}^2\lnorm{\lvec{v}}^2 - (\lvec{u}\cdot \lvec{v})^2}= \lnorm{\lvec{u}} \lnorm{\lvec{v}} \sin\theta
\end{align*}
Note here that $\sqrt{\sin^2\theta}=|\sin\theta|=\sin\theta$ since $0\le\theta\le\pi$\,.
\end{description}


\subsection{Area of a Parallelogram}
The area of a parallelogram equals its base times its height.  If one considers the parallelogram determined by $\lvec{u}$ and $\lvec{v}$, one has a convenient interpretation of the length of the cross product as the area of the parallelogram.
\begin{center}
\includegraphics[height=1.5in]{vectors/parallelogramarea}
\end{center}
If $\theta$ is the angle between $\lvec{u}$ and $\lvec{v}$ the height of the parallelogram shown is $\lnorm{\lvec{v}}\sin\theta$ and we have that parallelogram area equals its base times its height,
\[\boxed{\text{Area Parallelogram} = \lnorm{\lvec{u}} \lnorm{\lvec{v}} \sin\theta = \lnorm{\lvec{u}\times \lvec{v}}}\,,\]
where the last equality follows by Theorem~\ref{thm:crossproperties}\,.

\begin{example}
  Find the area of the parallelogram determined by the vectors $\lvec{u} = (1,4,4)$ and $\lvec{v} = (0,3,2)$.\\
  Solution:\\
  \begin{align*}
    \lvec{u}\times \lvec{v} &= \begin{vmatrix}
    \lvec{i} & \lvec{j} & \lvec{k} \\ 1&4&4\\0&3&2
    \end{vmatrix}\\
    &= (8-12 , 0-2 , 3-0)\\
    &= (-4 , -2 , 3)\\
    A=||\lvec{u}\times \lvec{v}|| &= \sqrt{(-4)^2 + (-2)^2 + (3)^2}\\
    &= \sqrt{29}
  \end{align*}
  The area of the parallelogram is $\sqrt{29}$ square units.
\end{example}

\subsection{Area of a Triangle}
The triangle determined by the terminal points of $\lvec{u}$ and $\lvec{v}$ and the origin $O$ is just half the parallelogram determined by $\lvec{u}$ and $\lvec{v}$.
\begin{center}
\includegraphics[height=1.5in]{vectors/trianglearea}
\end{center}
Therefore the area of the triangle determined by $\lvec{u}$ and $\lvec{v}$ is given by
\[\boxed{\text{Area Triangle}=\frac{1}{2}\lnorm{\lvec{u}\times\lvec{v}}}\,.\]

\begin{example}
  Find the area of the triangle determined by the points $P_1(2,2,0)$, $P_2(-1,0,2)$, and $P_3(0,4,3)$.\\
  Solution:\\
  %consider including a diagram of the triangle given by the 3 points as well
  %as the vectors u and v.
  Let $\lvec{p}_1$, $\lvec{p}_2$ and $\lvec{p}_3$ have terminal points $P_1$, $P_2$ and $P_3$ respectively.  Then $\overrightarrow{P_1P_2}$ is equivalent to
  \[\lvec{u}=\lvec{p}_2-\lvec{p}_1 = (-1,0,2) - (2,2,0) = (-3,-2,2)\,,\]
  and $\overrightarrow{P_1P_3}$ is equivalent to
  \[\lvec{v}=\lvec{p}_3-\lvec{p}_2 = (0,4,3) - (2,2,0) = (-2,2,3)\,.\]

  The triangle determined by $P_1$, $P_2$, and $P_3$ is symmetric to that determined by $\lvec{u}$ and $\lvec{v}$ at the origin.  Their cross product is
\begin{align*}
  \lvec{u}\times\lvec{v} &= \begin{vmatrix*}[r]
  \lvec{i}&\lvec{j}&\lvec{k}\\-3&-2&2\\-2&2&3
  \end{vmatrix*}\\
  &= (-6-4 , -4+9 , -6-4)\\
  &= (-10, 5 , -10)\,.
\end{align*}
So the area of the symmetric triangles equal
\begin{align*}
  \text{Area Triangle} & = \frac{1}{2}\lnorm{\lvec{u}\times\lvec{v}} \\
  &= \frac{1}{2}\sqrt{(-10)^2 + 5^2 + (-10)^2}\\
  &= \frac{1}{2}\sqrt{225}\\
  &= \frac{1}{2}(15)\\
  &= \frac{15}{2}\ \text{square units}.
\end{align*}
\end{example}

\section{Scalar Triple Product}
A scalar can be formed from three vectors as follows.\footnote{Technically the scalar triple product is a pseudoscalar since the presence of the cross product in its definition causes it to change sign under improper transformations such as reflections.}
\definition{If $\lvec{u}$, $\lvec{v}$, and $\lvec{w}$ are vectors in $\mathset{R}^3$, then $\lvec{u}\cdot (\lvec{v}\times \lvec{w})$ is called the \textbf{scalar triple product} of~$\lvec{u}, \lvec{v}$ and $\lvec{w}$.}

\theorem{The scalar triple product satisfies
\[\lvec{u}\cdot (\lvec{v}\times \lvec{w}) = \begin{vmatrix}
u_1&v_1&w_1\\u_2&v_2&w_2\\u_3&v_3&w_3
\end{vmatrix}\,.\]}

From this determinant formula for the scalar triple product it follows that
\[\lvec{u}\cdot (\lvec{v}\times \lvec{w})=\lvec{v}\cdot (\lvec{w}\times \lvec{u})=\lvec{w}\cdot (\lvec{u}\times \lvec{v})\,,\]
since these require two column exchanges to accomplish.

\begin{example}\label{exam:scalartriple}%
  Calculate the scalar triple product of $\lvec{u} = (3, -2, -5)$, $\lvec{v} = (1, 4, -4)$, and $\lvec{w} = (0, 3, 2)$\,.\\[.5em]
  Solution:
  Using the determinant formula evaluated along the last row gives
  \begin{align*}
    \lvec{u}\cdot (\lvec{v}\times \lvec{w}) &= \begin{vmatrix*}[r]
    3&1&0\\-2&4&3\\-5&-4&2
    \end{vmatrix*}\\
    &=3(+1)(8-(-12))+(1)(-1)(-4-(-15)) \\
    &=3(20)-(1)(11)\\
    &=60-11\\
    &=49
  \end{align*}
\end{example}

\subsection{Volume of a Parallelepiped}
The scalar triple product has a useful geometrical application.  Three vectors $\lvec{u}$, $\lvec{v}$, and $\lvec{w}$ in $\mathset{R}^3$ that are not coplanar will determine a \textbf{parallelepiped}.
\begin{center}
\includegraphics[height=1.5in]{vectors/parallelepiped}
\end{center}
The volume will be the area of the parallelogram of its base, $\lnorm{\lvec{u}\times\lvec{v}}$, times its height.  Since the vector $\lvec{u}\times\lvec{v}$ is orthogonal to the plane of the parallelogram the height is just the absolute value of the projection of $\lvec{w}$ onto $\lvec{u}\times\lvec{v}$, namely
\[\lnorm{\lvec{w}}|\cos\theta|\,,\]
where $\theta$ is the angle between $\lvec{w}$ and $\lvec{u}\times\lvec{v}$.  The volume is therefore
\[(\text{height})(\text{base area})=\lnorm{\lvec{w}}|\cos\theta|\lnorm{\lvec{u}\times\lvec{v}}=|\lnorm{\lvec{w}}\lnorm{\lvec{u}\times\lvec{v}}\cos\theta|\,\]
with the result that the volume of is just the absolute value of one of the forms of the scalar triple product of the three vectors, $|\lvec{w}\cdot(\lvec{u}\times \lvec{v})|$.  Using the form of the scalar triple product we originally introduced gives the formula: 
\[\boxed{\text{Volume Parallelepiped}= |\lvec{u}\cdot(\lvec{v}\times \lvec{w})|}\,.\]
One notes that the three formulas for the scalar triple product reflect the fact that any one of the three sides can be considered the base of the parallelepiped.
\begin{example}
  Find the volume of the parallelepiped generated by the vectors $\lvec{u} = (3, -2, -5)$, $\lvec{v} = (1, 4, -4)$, and $\lvec{w} = (0, 3, 2)$\,.\\[.5em]
  Solution:\\
  Using the result from Example~\ref{exam:scalartriple} we have
  \[\text{Volume}= |\lvec{u}\cdot(\lvec{v}\times \lvec{w})|=|49|=49\ (\text{units}^3)\,.\]
\end{example}
% TODO
% We should ensure properties proven about dot products and norms are those
% required when one defines a norm on a space.
%
% Make figures use \lvec command rather than hardcoding \bm and put the making
% of figs into latexmk like asymptote.  Also have only one copy for slides
% as well (need to use same files).
%
% Some of my vectors are in blue and some are in blue2.  Be consistent with
% blue use.  See parallelogram diagram.
%
% Discussion of pseudo vectors may be misleading.  Perhaps we should insist
% on right hand rule for our definition of the cross product.
%
% Add proof of determinant theorem for scalar triple product.
%
