\section{Point-Parallel Form of a Line}

Consider a vector $\lvec{v}\neq\lvec{0}$\,. %in $\mathset{R}^2$ or $\mathset{R}^3$.
The terminal points of the scalar multiples of $\lvec{v}$, given by $t\lvec{v}$ for $t$ any scalar, will be collinear, by Theorem~\ref{thm:scalarvectormult}.  Since $t=0$ implies $\lvec{0}$ is one of these points, the line goes through the origin~$O$.
\begin{center}
  \includegraphics[height=1in]{linesandplanes/pointparallelline}
\end{center}
An arbitrary line going through a point $P$ with direction $\lvec{v}$ can be formed by adding the vector $t\lvec{v}$ to the vector $\lvec{p}$ with terminal point $P$.
\begin{center}
  \includegraphics[height=2in]{linesandplanes/pointparallellinegeneral}
\end{center}
We summarize these observations with the following definition.
\definition{
  The equation of a line %in $\mathset{R}^2$ or $\mathset{R}^3$
  that passes through a given point $P$ and is parallel to a given vector $\lvec{v}\neq\lvec{0}$ is given by:
  \[\boxed{\lvec{x}(t) = \lvec{p} + t \lvec{v}}\,,\]
  where $t$ is a scalar parameter. Here $P$ is the terminal point of vector $\lvec{p}$.  This is called the \textbf{point-parallel form} of a line.}

\begin{example}
  Find a point-parallel form for the line in $\mathset{R}^3$ that passes through the point $P(2,1,-3)$ and is parallel to the vector $\lvec{v} = (1,2,2)$.\\[.5em]
  Solution:\\
  Letting $\lvec{p}=(2,1,-3)$ be the vector with terminal point $P$ we have by the previous formula. 
  \[\lvec{x}(t) = \lvec{p} + t \lvec{v} = (2,1,-3) + t(1,2,2)\,,\]
  where $t$ is a scalar.
\end{example}

We note that while the point-parallel form of a line can be visualized in two and three dimensions, the formula can be used to characterize lines more generally in $\mathset{R}^n$.

\subsection{Parametric Equations of a Line}

Consider the vector equation $\lvec{x}(t)=\lvec{p}+t\lvec{v}$.  In $\mathset{R}^3$ we can write $\lvec{x} = (x,y,z) $, $\lvec{p} = (x_0, y_0, z_0)$, and $\lvec{v} = (v_1, v_2, v_3)$. Then:
\begin{align*}
  \lvec{x}(t) &= \lvec{p} + t \lvec{v}\\
  (x,y,z) &= (x_0, y_0, z_0) + t(v_1, v_2, v_3)\\
  &\Rightarrow\begin{cases}
    x &= x_0 + tv_1\\
    y &= y_0 + tv_2\\
    z &= z_0 + tv_3\\
  \end{cases}
\end{align*}
These are called \textbf{parametric equations} for the line.\\
Parametric equations for a line in $\mathset{R}^2$ are similarly
$\begin{cases}
  x = x_0 + tv_1\\
  y = y_0 + tv_2\\
\end{cases}$\,.


\begin{example}
  Find parametric equations for the line passing through the point $P(2,1,-1)$ that is parallel to the vector $\lvec{v} = (-1,1,3)$ and determine if the point $Q(0,5,5)$ is on the line.\\[.5em]
  Solution:\\
  \begin{align*}
    \lvec{x}(t) &= \lvec{p} + t \lvec{v}\\
    (x,y,z) &= (2,1,-1) + t(-1,1,3)\\
    (x,y,z) &= (2-t, 1+t, -1+3t)
  \end{align*}
  Parametric equations for the line are therefore
  \[\begin{cases}
      x &= 2-t\\
      y &= 1+t\\
      z &= -1+3t
    \end{cases}\,.
  \]
  The point $Q(1,5,5)$ is on the line if the overdetermined linear system
  \begin{align*}
      0 &= 2-t\\
      5 &= 1+t\\
      5 &= -1+3t
    \end{align*}
  has a solution for $t$.  The first equation implies $t=2$ but while this satisfies the third equation it fails to satisfy the second.  Therefore the point $Q$ is not on the line.
\end{example}


\section{Two-Point Form of a Line}

Let $P$ and $Q$ be distinct points. % in $\mathset{R}^2$ or $\mathset{R}^3$.
If vectors $\lvec{p}$ and $\lvec{q}$ have these terminal points then the vector $\lvec{v}=\lvec{q}-\lvec{p}$ will be parallel to the line determined by the points.  Inserting this into the point-parallel equation $\lvec{x}(t)=\lvec{p}+t\lvec{v}$ gives the following.

\definition{The \textbf{two-point form} of a line determined by points $P$ and $Q$ is:
  \[\boxed{\lvec{x}(t) = (1-t)\lvec{p} + t\lvec{q}}\,,\]
  where $P$ and $Q$ are terminal points of vectors $\lvec{p}$ and $\lvec{q}$ and $t$ is a scalar parameter.} 

One observes that $\lvec{x}=\lvec{p}$ when $t=0$ (so point $P$) and $\lvec{x}=\lvec{q}$ when $t=1$ (so point $Q$) with this parameterization of the line.

\begin{example}
  Describe the line that passes through the points $P(1,-1,3)$ and $Q(1,2,-4)$ in both two-point form and parametric form.

  \begin{align*}
    \lvec{x}(t) &= (1-t)\lvec{p} + \lvec{q}\\
    \lvec{x}(t) &= (1-t)(1,-1,3) + t(1,2,-4) & (\text{two-point form)}
  \end{align*}
  Expanding gives the parametric form:
  \begin{align*}
    (x,y,z) &= (1-t, -1+t, 3-3t) + (t, 2t, -4t)\\
    &= (1, -1+3t, 3-7t)\\
    &\Rightarrow \begin{cases}
      x = 1\\
      y = -1 + 3t\\
      z = 3 - 7t\\
    \end{cases} & (\text{parametric form})
  \end{align*}
\end{example}

\section{Point-Normal Form of a Line}

If we consider two-dimensional space $\mathset{R}^2$ a \textbf{normal vector} $\lvec{n}$ to a line in $\mathset{R}^2$ is a nonzero vector that is perpendicular to the direction $\lvec{v}$ of the line, $\lvec{n}\cdot\lvec{v}=0$.
Assuming a point-parallel description of a line $\lvec{x}=\lvec{p}+t\lvec{v}$ it follows that $\lvec{x}-\lvec{p}=t\lvec{v}$ and we have
\[\lvec{n}\cdot(\lvec{x}-\lvec{p})=\lvec{n}\cdot(t\lvec{v})=t(\lvec{n}\cdot\lvec{v})=t(0)=0\,,\]
for any point $X$ on the line.
\begin{center}
  \includegraphics[height=2in]{linesandplanes/pointnormal}
\end{center}
This suggests the following alternate description of a line in $\mathset{R}^2$ in terms of a normal vector.
\definition{The \textbf{point-normal form} of a line in $\mathset{R}^2$ passing through a given point $P(x_0,y_0)$ that is normal (perpendicular) to a given vector $\lvec{n}=(a,b)$ is given by the equation
  \[\boxed{\lvec{n} \cdot (\lvec{x}-\lvec{p}) = 0}\,,\]
  where $X(x,y)$ is any point on the line. Here $P$ and $X$ are the terminal points of vectors $\lvec{p}$ and $\lvec{x}$ respectively.}

\begin{example}
  Find the equation of a line passing through $P(1,-1)$ with normal $\lvec{n} = (2,-1)$\,.\\[.5em]
Solution:\\
Since we are given a point and normal for the line we use the point-normal form recipe with $\lvec{x}=(x,y)$ and $\lvec{p}=(1,-1)$ to get:
\begin{align*}
  \lvec{n}\cdot (\lvec{x}-\lvec{p}) &= 0\\
  (2,-1) \cdot (x-1 , y+1) &= 0\\
  2(x-1) - (y+1) &= 0 & (\text{point-normal form})
\end{align*}
Further expansion gives the standard form:
\begin{align*}
  2x - 2 - y -1 &= 0\\
  2x - y &= 3 & (\text{standard form})
\end{align*}
\end{example}

\textbook{\newpage}
If we expand the point-normal equation in terms of the vector components we can recover the standard form of the line as follows.
\begin{align*}
  \lvec{n} \cdot (\lvec{x} - \lvec{p}) &= 0\\
  (a,b) \cdot [(x,y)-(x_0,y_0)] &= 0\\
  (a,b) \cdot (x-x_0, y-y_0) &= 0\\
  a(x-x_0)+b(y-y_0) & = 0 \\
  ax - ax_0 + by - by_0 &= 0\\
  ax + by &= \underbrace{ax_0 + by_0}_{=c}
\end{align*}
Consideration of the last line shows that the coefficients of $x$ and $y$ in the standard form of a line in $\mathset{R}^2$ have the geometrical interpretation as the components $(a,b)$ of a normal $\lvec{n}$ to the line.  If one desires a vector $\lvec{v}$ that is parallel to the line one observes that
\[(a,b)\cdot(b,-a)=ab-ba=0,\]
which shows $\boxed{\lvec{v}=(b,-a)}$ will be a nonzero vector perpendicular to $\lvec{n}$ which in two dimensions implies it is parallel to the line.  Finally a point $P$ on the line can be found by choosing an arbitrary value of $x$ and solving for $y$ (or vice versa if coefficient $b=0$).

\begin{example}
  Find a point-parallel form for the line in $\mathset{R}^2$ given by the equation $2x+3y = 1$\,.\\[.5em]
  Solution:\\
  We are given the standard form ($ax+by=c$) of $2x + 3y = 1$\,.  We need to find a point on the line and a vector parallel to it.

When $x = 0$:
  \begin{align*}
    2x + 3y &= 1\\
    2(0) + 3y &= 1\\
    y &= \frac{1}{3}\,.
  \end{align*}
  Therefore the point $P\left(0,\frac{1}{3}\right)$ is on the line.
  
The vector $\lvec{n} = (a,b)=(2,3)$ is normal to the line.  Then $\lvec{v}=(b,-a)=(3,-2)$ is therefore orthogonal to it. Using the point-parallel form recipe gives
\begin{align*}
  \lvec{x}(t) &= \lvec{p} + t \lvec{v}\\
  \lvec{x}(t) &= \left(0, \frac{1}{3}\right) + t(3,-2) & (\text{point-parallel form})
\end{align*}
\end{example}

\section{Point-Normal Form of a Plane}
In three dimensions a plane may be determined by a point $P$ through which it passes and a normal vector $\lvec{n}$ which is perpendicular to the plane.  We want to find the equation of the plane passing through a given point $P(x_0, y_0 , z_0)$ and perpendicular to a given vector $\lvec{n} = (a, b, c)$\,.
\begin{center}
  \includegraphics[height=2in]{linesandplanes/pointnormalplane}
\end{center}
Let $X(x,y,z)$ be any other point on the plane. $P$ and $X$ determine a line in the plane. The directed line segment $\overrightarrow{PX}$ is equivalent to the vector $\lvec{x}-\lvec{p}$ which must therefore be orthogonal to $\lvec{n}$\,:
\[\boxed{\lvec{n} \cdot (\lvec{x}-\lvec{p}) = 0}\,,\]
where as usual $X$ and $P$ are the terminal points of $\lvec{x}$ and $\lvec{p}$ respectively.   Any point $X$ on the plane has to satisfy this equation.
With $\lvec{n} = (a,b,c)$ and $\lvec{x} - \lvec{p} = (x-x_0, y-y_0, z-z_0)$, then the equation of the plane becomes:
\[\boxed{a(x-x_0) + b(y-y_0) + c(z-z_0) = 0}\,.\]
These equations are the \textbf{point-normal form} for the plane.

We can rewrite the point-normal form as follows:
\begin{align*}
  \lvec{n}\cdot(\lvec{x}-\lvec{p}) & = 0\\
  \lvec{n}\cdot\lvec{x}-\lvec{n}\cdot\lvec{p}&=0 \\
  \lvec{n}\cdot\lvec{x}&=\lvec{n}\cdot\lvec{p}
\end{align*}
With $\lvec{n}=(a,b,c)$ and setting the constant $d=\lvec{n}\cdot\lvec{p}=ax_0+by_0+cz_0$ this becomes
\[\boxed{ax + by + cz = d}\,.\]
This is called the \textbf{standard form} of the equation of the plane.  In other words a linear equation in three dimensions written in this form will represent a plane with normal $\lvec{n}=(a,b,c)$ provided one of $a$, $b$, or $c$ is nonzero. This is analogous to the normal to a line appearing in the standard form of a linear equation in $\mathset{R}^2$\,.  Note that the standard form of a plane is not unique since one can multiply the equation by a nonzero scalar to get an equivalent equation.  Geometrically this is just scaling the normal vector by that amount to produce a new normal to the plane.

\textbook{\newpage}
\begin{example}
  Find a point-normal and standard form of the equation of the plane that passes through the given point $P$ which is perpendicular to the given vector $\lvec{n}$\,.
  \begin{enumerate}
  \item $P(1,3,-2)\,, \lvec{n} = (-2,1,-1)$\\[.5em]
Solution:\\    
Let $X(x,y,z)$ be any other point on the plane, then $\overrightarrow{PX}$ in the plane is equivalent to the vector $\lvec{x}-\lvec{p}= (x-1,y-3,z+2)$ and a point normal form for the plane is
\begin{align*}
  \lvec{n} \cdot (\lvec{x} - \lvec{p}) & = 0 \\
  (-2,1,-1) \cdot (x-1 , y-3 , z+2) &= 0\\
  -2(x-1) + 1(y-3) + (-1)(z+2) &= 0 & (\text{point-normal form})
\end{align*}
Expanding gives the standard form:
\begin{align*}
  -2x + 2 + y - 3 - z - 2 &= 0\\
  -2x + y - z &= 3 & (\text{standard form})
\end{align*}

\item $P(1,1,4)\,,\lvec{n} = (1,9,8)$\\[.5em]
  Solution:\\
  Let $X(x,y,z)$ be any other point on the plane, then $\overrightarrow{PX}$ in the plane is equivalent to the vector $\lvec{x}-\lvec{p} =(x-1,y-1,z-4)$ and the point-normal form of the plane is
\begin{align*}
  \lvec{n}\cdot(\lvec{x}-\lvec{p}) & = 0 \\
  (1,9,8) \cdot (x-1 , y-1 , z-4) & = 0\\
  1(x-1) + 9(y-1) + 8(z-4) &= 0  & (\text{point-normal form})
\end{align*}
Expanding gives:
\begin{align*}
  x-1 + 9y-9  + 8z-32 &= 0\\
  x + 9y + 8z &= 42 & (\text{standard form})
\end{align*}
  \end{enumerate}
\end{example}

\begin{example}
  Find the point of intersection of the line $\lvec{x}(t) = (2,1,1) + t(-1,0,4)$ and the plane $x-3y-z = 1$.\\[.5em]
  Solution:\\
  The point on the line will be determined by the value of $t$ in the point-parallel form of the line.  The parametric form of the line is given by:
  \begin{align*}
    \lvec{x}(t) &= (2,1,1) + t(-1,0,4)\\
    \lvec{x}(t) &= (2-t, 1, 1+4t)\\
   &\Rightarrow \begin{cases}
      x = 2-t\\
      y = 1\\
      z = 1+4t
    \end{cases}
  \end{align*}
  To also sit on the plane $(x,y,z)$ must additionally satisfy the planar equation.  Inserting the parametric form into that equation gives:
  \begin{align*}
    x- 3y - z &= 1\\
    (2-t) - 3(1) - (1+4t) &= 1\\
    2-t-3-1-4t &= 1\\
    -5t &= 3\\
    t &= -\frac{3}{5}
  \end{align*}
  The point of intersection has coordinates:
  \begin{align*}
    x &= 2-\left(-\frac{3}{5}\right) = \frac{13}{5}\\
    y &= 1\\
    z &= 1 + 4\left(-\frac{3}{5}\right) = -\frac{7}{5}
    \end{align*}
Therefore the point is $P\left(\frac{13}{5}, 1, -\frac{7}{5}\right)$\,.
\end{example}

The standard form of a plane in $\mathset{R}^3$ is just a linear equation.  Thus a linear system of $m$ equations in three unknowns has the geometrical interpretation of the intersection of these $m$ planes.  We require planar intersection because a solution to the linear system must satisfy all its equations.

\begin{example}
  The equations given below represent planes in $\mathset{R}^3$. Describe geometrically the given solution set of these equations
\begin{enumerate}
\item \[\begin{aligned}[c]
  x+y+z &= -4\\
  x+2y &= 1\\
  2y+3z &= -2
  \end{aligned}
  \hspace{1cm},\hspace{1cm}
  \begin{aligned}[c]
    \begin{bmatrix}
      x\\y\\z
    \end{bmatrix} &= \begin{bmatrix*}[r]
      -\frac{21}{5}\\[.3em]
      \frac{13}{5}\\[.3em]
      -\frac{12}{5}\\[.2em]
    \end{bmatrix*}
  \end{aligned}
  \]
  Solution:\\[.5em]
The solution represents the single intersection point $P\left(-\frac{21}{5},\frac{13}{5},-\frac{12}{5}\right)$ of the 3 planes.

\item \[\begin{aligned}[c]
x-y+z &= 0\\
y-2z &= 1\\
2x-y &= 1
\end{aligned}
\hspace{1cm},\hspace{1cm}
\begin{aligned}[c]
\begin{bmatrix}
  x\\y\\z
\end{bmatrix} &= \begin{bmatrix}
1+t\\
1+2t\\
t
\end{bmatrix}
\end{aligned}
\]
Solution:\\[.5em]
Since
\[\begin{bmatrix}
  x\\y\\z
\end{bmatrix} = \begin{bmatrix}
1\\
1\\
0
\end{bmatrix}+t\begin{bmatrix}
1\\
2\\
1
\end{bmatrix}\,,
\]
this is a line that passes through $P(1,1,0)$ and is parallel to the vector $\lvec{v} =(1,2,1)$\,.

\textbook{\newpage}
\item \[\begin{aligned}[c]
x+4y-5z &= 0\\
2x-y+8z &= 9
\end{aligned}
\hspace{1cm},\hspace{1cm}
\begin{aligned}[c]
\begin{bmatrix}
  x\\y\\z
\end{bmatrix} &= \begin{bmatrix}
4-3t\\
-1+2t\\
t
\end{bmatrix}
\end{aligned}
\]
Solution:\\[.5em]
Since
\[\begin{bmatrix}
  x\\y\\z
\end{bmatrix} = \begin{bmatrix*}[r]
4\\
-1\\
0
\end{bmatrix*}
+t\begin{bmatrix*}[r]
-3\\
2\\
1
\end{bmatrix*}\,,
\]
this is a line that passes through $P(4,-1,0)$ and is parallel to the vector $\lvec{v} = (-3,2,1)$\,.
\end{enumerate}
\end{example}

\section{Plane through Three Points}
Three noncollinear points in $\mathset{R}^3$ will determine a plane. To find the equation of the plane that passes through the three noncollinear points $P$, $Q$, $R$ we consider the directed line segments $\overrightarrow{PQ}$ and $\overrightarrow{PR}$. These lie in the plane and are equivalent to the vectors $\lvec{q}-\lvec{p}$ and $\lvec{r}-\lvec{p}$ respectively.  Recall the cross product of two vectors is orthogonal to both vectors. Therefore a normal vector $\lvec{n}$ to the plane is given by
\[\boxed{\lvec{n} = (\lvec{q}-\lvec{p}) \times (\lvec{r}-\lvec{p})}\,,\]
which can then be inserted into the point-normal equation,
\[\lvec{n}\cdot (\lvec{x}- \lvec{p}) = 0\,,\]
to find an equation for the plane.
\begin{center}
  \includegraphics[height=2in]{linesandplanes/threepointplane}
\end{center}
\begin{example}
  Find a point-normal form and standard form for the plane passing through the points $P(-1,1,3)$, $Q(0,3,1)$, and $R(2,1,-1)$\,.\\[0.5em]
  Solution:\\
  First find a normal $\lvec{n}$. $\overrightarrow{PQ}$ and $\overrightarrow{PR}$ are equivalent to $\lvec{q}- \lvec{p}$ and $\lvec{r}-\lvec{p}$ where
  \begin{align*}
    \lvec{q}- \lvec{p} & = (0,3,1) - (-1,1,3) = (1,2,-2)\\
    \lvec{r}-\lvec{p} & = (2,1,-1) - (-1,1,3) = (3,0,-4)
  \end{align*}
  Taking the cross product gives
  \begin{align*}
    \lvec{n} &= (\lvec{q}-\lvec{p}) \times (\lvec{r}-\lvec{p}) = \begin{vmatrix*}[r]
    \lvec{i} & \lvec{j} & \lvec{k}\\ 1&2&-2\\3&0&-4
    \end{vmatrix*}\\
    &= (-8+0, -6+4, 0-6)\\
    &= (-8,-2,-6)
  \end{align*}
  Substitute into the point-normal equation:
  \begin{align*}
    \lvec{n} \cdot (\lvec{x}-\lvec{p}) &= 0\\
    (-8,-2,-6)\cdot (x+1, y-1, z-3) &= 0\\
    -8(x+1) + (-2)(y-1) + (-6)(z-3) &= 0 & (\text{point-normal form})
  \end{align*}
Expanding gives the standard form:
\begin{align*}
  -8x - 8 -2y + 2 - 6z + 18 &= 0\\
  -8x -2y -6z +12 &= 0\\
  -8x - 2y - 6z &= -12\\
  4x+y+3z &= 6 & \text{(standard form)}
\end{align*}
Here we simplified the equation by dividing both sides by -2\,.
\end{example}

\section{Point-Parallel Form of a Plane}
If $P(x_0, y_0, z_0)$ is a point and $\lvec{u}=(u_1,u_2,u_3)$ and $\lvec{v}=(v_1,v_2,v_3)$ are nonzero, noncollinear vectors then the lines $\lvec{x}(s)=\lvec{p}+s\lvec{u}$ and $\lvec{x}(t)=\lvec{p}+t\lvec{v}$ with parameters $s$ and $t$ will intersect at $P$ and will determine a plane.

% Petry: I may have coined the following but it seems consistent.
\definition{The \textbf{point-parallel form} of a plane in $\mathset{R}^3$ through point $P$ that is parallel to noncollinear vectors $\lvec{u}\neq\lvec{0}$ and $\lvec{v}\neq\lvec{0}$ is given by
  \[\boxed{\lvec{x}(s,t) = \lvec{p} + s\lvec{u} + t\lvec{v}}\,,\]
  where $s$ and $t$ are scalar parameters and $P$ is the terminal point of vector $\lvec{p}$.}

\begin{center}
  \includegraphics[height=2.5in]{linesandplanes/pointparallelplane}
\end{center}
That the lines $\lvec{x}(s)=\lvec{p}+s\lvec{u}$ and $\lvec{x}(t)=\lvec{p}+t\lvec{v}$ lie in the surface generated by $\lvec{x}(s,t)=\lvec{p}+s\lvec{u}+t\lvec{v}$ is clear by setting $t=0$ or $s=0$ respectively in the latter equation.  
To see that the points $X$ given by $\lvec{x}(s,t)$ really do lie on a plane, note that a normal to the plane, orthogonal to both $\lvec{u}$ and $\lvec{v}$, is $\lvec{n}=\lvec{u}\times\lvec{v}$ and we have
\begin{align*}
  \lvec{n}\cdot(\lvec{x}-\lvec{p}) & = \lvec{n}\cdot( \lvec{p} + s \lvec{u} + t \lvec{v}-\lvec{p})\\
  &= \lvec{n}\cdot(s\lvec{u} + t\lvec{v})\\
  &= \lvec{n}\cdot(s\lvec{u})+\lvec{n}\cdot(t\lvec{v})\\
  &= s\lvec{n}\cdot\lvec{u}+t\lvec{n}\cdot\lvec{v}\\
  &= s(0)+t(0) \\
  &= 0
\end{align*}
as required.

\subsection{Parametric Equations of a Plane}
Writing out the vector equation $\lvec{x}= \lvec{p} + s\lvec{u} + t\lvec{v}$ in terms of components with $\lvec{x}=(x,y,z)$, $\lvec{p}=(x_0,y_0,z_0)$, $\lvec{u}=(u_1,u_2,u_3)$, and $\lvec{v}=(v_1,v_2,v_3)$ we get
\begin{align*}
  \lvec{x} &= \lvec{p} + s \lvec{u} + t \lvec{v}\\
  (x,y,z) &= (x_0, y_0, z_0) + s(u_1, u_2, u_3) + t(v_1, v_2, v_3)\\
  (x,y,z) &= (x_0 + su_1 + tv_1, y_0 + su_2 + tv_2, z_0 + su_3 + tv_3)
\end{align*}
Therefore
\[\begin{cases}
  x &= x_0 + su_1 + tv_1\\
  y &= y_0 + su_2 + tv_2\\
  z &= z_0 + su_3 + tv_3
\end{cases}\,.\]
These are called \textbf{parametric equations} for the plane.

\begin{example}
  Find the point-parallel form and parametric equations of the plane passing through the point $P(-2,1,3)$ and parallel to the vectors $\lvec{u}=(1,1,-1)$ and $\lvec{v}=(-1,2,0)$.\\[.5em]
  Solution:
  \begin{align*}
    \lvec{x} &= \lvec{p} + s \lvec{u} + t \lvec{v}\\
    (x,y,z) &= (-2,1,3) + s(1,1,-1) + t(-1,2,0) & (\text{point-parallel form})\\
    (x,y,z) &= (-2+s-t, 1+s+2t, 3-s)\\
      &\Rightarrow \begin{cases}
    x = -2+s-t\\
    y = 1+s+2t\\
    z = 3-s
  \end{cases} & (\text{parametric equations})
  \end{align*}

\end{example}

\begin{example}
  Given the plane in standard form
  \[2x+2y-4z=10\,,\]
  find a point-parallel form and parametric equations for the plane.

  Solution:\\
  To find the point-parallel form we solve the linear system containing the single equation
  \[2x+2y-4z=10\,.\]
  The corresponding augmented matrix is reduced to RREF:
  \[\begin{bmatrix}[rrr|r] 2 & 2 & -4 & 10\end{bmatrix}\ \Rightarrow\
  \rowopmatrix{\rowop{R_1}{\frac{1}{2}R_1}}{\begin{bmatrix}[rrr|r]
      \circled{1} & 1 & -2 & 5\end{bmatrix}}\ \Leftrightarrow\ x+y-2z=5\,.\]
    Assign the free (independent) variables $y$ and $z$ to parameters so that $\boxed{y=s}$ and
    $\boxed{z=t}$\,.  Solving for the leading (dependent) variable $x$ gives
    \begin{itemize}
    \item $x+y-2z=5 \implies x+s-2t=5 \implies \boxed{x=5-s+2t}$\,.
    \end{itemize}
    Writing the solution in terms of vectors gives
    \[\lvec{x}(s,t)=\begin{bmatrix}x\\y\\z\end{bmatrix}=\begin{bmatrix}5-s+2t\\s\\t\end{bmatrix}=\underbrace{\begin{bmatrix*}[r]5\\0\\0\end{bmatrix*}}_{\lvec{p}}+s\underbrace{\begin{bmatrix*}[r]-1\\1\\0\end{bmatrix*}}_{\lvec{u}}+t\underbrace{\begin{bmatrix*}[r]2\\0\\1\end{bmatrix*}}_{\lvec{v}}\,.~~~~~~~(\text{point-parallel form})\]
    One sees that the particular solution here is geometrically a point $\lvec{p}$ on the plane, while the homogeneous solution, $s\lvec{u}+t\lvec{v}$,  gives the offset vector from that point.

    The first vector equation implies
    \[\hspace{15em}\begin{cases}
    x = 5-s+2t\\
    y = s\\
    z = t
  \end{cases}\,.\hspace{5em}(\text{parametric equations})\]
    \textbook{\vspace*{-1em}}%To prevent unwanted blank page following
\end{example}


\section{Distance to Lines and Planes}

A common geometrical problem is to find the distance $d$ between a line (in $\mathset{R}^2$ or $\mathset{R}^3$) or plane (in $\mathset{R}^3$) and a point $P$ off the line or plane.  The problem may be solved by finding the closest point $Q$ on the line or plane to $P$.  The distance is then $\lnorm{\lvec{q}-\lvec{p}}$. Summary of our general approach is as follows:
\begin{enumerate}
\item Find a point-parallel equation for a line on which $Q$ lies.
\item Substitute $\lvec{q}(t)$ into a geometrical constraint equation to get an equation involving only parameter~$t$.
\item Solve this for $t$ to find $\lvec{q}$ (and hence $Q$).
\item Calculate the distance $d=d(\lvec{p},\lvec{q})=\lnorm{\lvec{q}-\lvec{p}}$.
\end{enumerate}

\subsection{Point-Parallel Line}
As an example, suppose one wishes to find the closest point and distance from $P$ to a line, in either $\mathset{R}^2$ or $\mathset{R}^3$, where the line is described by the point-parallel form $\lvec{x}(t)=\lvec{p}_0+t\lvec{v}$.  Then $Q$ clearly lies on this line and thus satisfies
\[\boxed{\lvec{q}(t)=\lvec{p}_0+t\lvec{v}}\]
for some particular value of the parameter $t$ to be determined.  The directed line segment $\overrightarrow{PQ}$ must be perpendicular to the line and it follows that the constraint required to find $t$ is just
\[\boxed{(\lvec{q}-\lvec{p})\cdot\lvec{v}=0}\,,\]
into which we substitute $\lvec{q}(t)$ from above and solve.
\begin{center}
  \includegraphics[height=2.5in]{linesandplanes/distanceparallel}
\end{center}
\begin{example}
  Find the distance between the point $P(2,5)$ and the line $\lvec{x}(t)=(6,3)+t(4,3)$.  Also find the closest point $Q$ on the line.

  Solution:\\
  The point $Q$, the tip of vector $\lvec{q}$, must lie on the line so we have
  \[\lvec{q}=(6,3)+t(4,3)\]
  for some \emph{particular} value of $t$ which we must find.  Now $\overrightarrow{PQ}$, which is equivalent to $\lvec{q}-\lvec{p}$ where
  \[\lvec{q}-\lvec{p}=(6,3)+t(4,3)-(2,5)=(6+4t-2,3+3t-5)=(4+4t,-2+3t)\,,\]
  must be orthogonal to the direction of the line, $\lvec{v}=(4,3)$.  This gives the necessary constraint to find $t$:
  \begin{align*}
    (\lvec{q}-\lvec{p})\cdot\lvec{v}&=0\\
    (4+4t,-2+3t)\cdot(4,3)&=0\\
    (4+4t)(4)+(-2+3t)(3) &=0\\
    16+16t-6+9t &=0\\
    25t&=-10\\
    t&=-\frac{10}{25}=-\frac{2}{5}
  \end{align*}

This implies
\begin{align*}\lvec{q}&=(6,3)+\left(-\frac{2}{5}\right)(4,3)\\
  &=(6,3)-\left(\frac{8}{5},\frac{6}{5}\right) \\
  &=\left(6-\frac{8}{5},3-\frac{6}{5}\right)\\
  &=\left(\frac{30-8}{5},\frac{15-6}{5}\right)\\
  &=\left(\frac{22}{5},\frac{9}{5}\right)\,,
\end{align*}
so the closest point on the line is $Q=(22/5,9/5)$\,.  The distance from the line to $P$ is therefore the length of
\[\lvec{q}-\lvec{p} = \left(\frac{22}{5},\frac{9}{5}\right)-(2,5)=\left(\frac{22}{5}-\frac{10}{5},\frac{9}{5}-\frac{25}{5}\right)=\left(\frac{12}{5},-\frac{16}{5}\right)=\frac{1}{5}(12,-16)\]
which is
\[d=\lnorm{\lvec{q}-\lvec{p}}=\lnorm{\frac{1}{5}(12,-16)}=\frac{1}{5}\lnorm{(12,-16)}=\frac{1}{5}\sqrt{(12)^2+(-16)^2}=\frac{1}{5}\sqrt{400}=\frac{20}{5}\,.\]
\end{example}

\subsection{Distance Given Normal}
If an equation of a line in $\mathset{R}^2$ or a plane in $\mathset{R}^3$ is given in the standard form 
\[ax+by=c\ \ \ \text{or}\ \ \ ax+by+c=d\]
respectively, then the normal direction to the line $\lvec{n}=(a,b)$ or to the plane $\lvec{n}=(a,b,c)$ is known.  A point-normal equation similarly gives the normal $\lvec{n}$.  If we want the point $Q$ that lies on the line or plane that is closest to the point $P$ off of it, then $Q$ must sit on the line through $P$ that in the direction of the normal, namely the line $\lvec{x}(t)=\lvec{p}+t\lvec{n}$\,. So for some particular value of $t$ we have
\[\boxed{\lvec{q}(t)=\lvec{p}+t\lvec{n}}\,.\]
Setting $\lvec{q}=(x,y,z)$ one has parametric equations for $x(t)$, $y(t)$, and $z(t)$ which can then be inserted into the original line or plane equation to find $t$, since $Q$ is constrained to lie there.
\begin{center}
  \includegraphics[height=2.5in]{linesandplanes/distancenormal}
\end{center}

\begin{example}\label{exam:pointtoplane}%
  Find the distance between the point $P(5,1,15)$ and the plane $2x-3y+6z=-1$\,.  Also find the closest point $Q$ in the plane.

  Solution:\\
  The plane equation gives the normal to the plane to be
  \[\lvec{n}=(a,b,c)=(2,-3,6)\,.\]
  The point $Q$, tip of the vector $\lvec{q}=(x,y,z)$, lies on the line through $P$ with direction $\lvec{n}$ and so
  \begin{align*}\lvec{q}&=\lvec{p}+t\lvec{n}\\
    \begin{bmatrix*}x\\y\\z\end{bmatrix*}&=\begin{bmatrix*}[r]5 \\ 1 \\ 15 \end{bmatrix*}+t\begin{bmatrix*}[r]2\\-3\\6\end{bmatrix*}
  \end{align*}
  for some value of the parameter $t$ to be determined.  The parametric equations are
  \[\begin{cases}x=5+2t\\y=1-3t\\z=15+6t\end{cases}\,.\]
  The constraint to find $t$ comes from the fact that $\lvec{q}$ must lie on the plane and hence satisfy the plane equation.  Inserting the parametric equations into the latter gives:
  \begin{align*}
    2x-3y+6z&=-1\\
    2(5+2t)-3(1-3t)+6(15+6t)&=-1\\
    10+4t-3+9t+90+36t&=-1\\
    49t&=-98\\
    t&=-2
  \end{align*}
  The closest point in the plane is therefore given by 
  \[\lvec{q}=\begin{bmatrix*}[r]5 \\ 1 \\ 15 \end{bmatrix*}+(-2)\begin{bmatrix*}[r]2\\-3\\6\end{bmatrix*}=\begin{bmatrix*}[c]5-4 \\ 1+6 \\ 15-12 \end{bmatrix*}=\begin{bmatrix*}[r] 1 \\ 7 \\ 3 \end{bmatrix*}\,,\]
    so $Q(1,7,3)$, and the distance between $P$ and the plane is the length of
  \[\lvec{q}-\lvec{p}=\begin{bmatrix*}[r]1 \\ 7 \\ 3 \end{bmatrix*}-\begin{bmatrix*}[r]5\\1\\15\end{bmatrix*}=\begin{bmatrix*}[r]-4 \\ 6 \\-12 \end{bmatrix*}\]
  which is
  \[d=\lnorm{\lvec{q}-\lvec{p}}=\lnorm{(-4,6,-12)}=\sqrt{(-4)^2+6^2+(-12)^2}=\sqrt{196}=14\,.\]
\end{example}

The approach can be used to solve, once and for all for the distance between $P$ and the line or plane and one has the following theorems.

\theorem{In $\mathset{R}^2$ the distance $d$ between the point $P(x_0, y_0)$ and the line $ax + by = c$ is given by
\[d = \frac{|ax_0 + by_0 - c|}{\sqrt{a^2 + b^2}}\,.\]}


\theorem{In $\mathset{R}^3$ the distance $d$ between the point $P(x_0, y_0, z_0)$ and the plane $ax + by + cz = d$ is given by
\[d = \frac{|ax_0 + by_0 + cz_0 - d|}{\sqrt{a^2 + b^2 + c^2}}\,.\]}

\begin{example}
  Find the distance between the point $P(5,1,15)$ and the plane $2x - 3y + 6z = -1$ using the distance formula.\\[.5em]
  Solution:
  \begin{align*}
    d &= \frac{|ax_0 + by_0 + cz_0 - d|}{\sqrt{a^2+b^2+c^2}}\\
    &= \frac{|2(5)-3(1) + 6(15) -(-1)|}{\sqrt{(2)^2+(-3)^2+6^2}}\\
    &= \frac{|98|}{\sqrt{49}}\\
    &= \frac{98}{7}\\
    &= 14
  \end{align*}
  This is the same as we found in Example~\ref{exam:pointtoplane}\,.
\end{example}

In three dimensions two planes will intersect (distance between them $d=0$) unless they are parallel.  If they are parallel we can find the distance between them by finding a point on one of the planes and then calculating the distance from that point to the other plane.

\begin{example}
  Find the distance between the two planes $x + 2y - 2z = 3$ and $2x + 4y - 4z = 7$.\\[.5em]
  Solution:\\
  The normal of $x + 2y - 2z = 3$ is $\lvec{n_1} = (1,2,-2)$\,.\\
  The normal of $2x + 4y - 4z = 7$ is $\lvec{n_2} = (2,4,-4) = 2(1,2,-2) = 2\lvec{n_1}$\,.\\
 So $\lvec{n_1}$ is parallel to $\lvec{n_2}$ and therefore the planes are parallel. To find a point in the first plane set $y=z=0$ to get $x=3$ so $P(3,0,0)$ lies on the first plane.  Now find the distance between $P(3,0,0)$ and the plane $2x+4y-4z = 7$ using the distance formula:
  \begin{align*}
    d &= \frac{|ax_0 + by_0 + cz_0 - d|}{\sqrt{a^2 + b^2 + c^2}}\\
    &= \frac{|2(3)+0+0-7|}{\sqrt{2^2 + 4^2 + (-4)^2}}\\
    &= \frac{|-1|}{\sqrt{36}}\\
    &= \frac{1}{6}
  \end{align*}
\end{example}

%TODO:
% Include proofs for distance formulae at end or include that in problems?
%
% Maybe I should use tilde symbol for equivalence so I could write that
% directed line segment PQ was equivalent to p-q etc. in diagrams.
% 
% Add calculus solution to finding distance in problems by minimizing
% d^2=\lnorm{\lvec{q}-\lvec{p}} as a function of t.
