\documentclass{article}
\usepackage{amsmath}
\usepackage{web}
\usepackage[solutionsafter]{exerquiz}

% Formatting macros for exercises
\renewcommand\exlabel{Problem}
\renewcommand\exlabelformat{\textbf{\theeqexno.}}
\makeatletter
\renewcommand\exrtnlabelformat{$\square$}
\makeatother

\parindent0pt

\begin{document}
\thispagestyle{empty}
Calculus III \hfill Quiz \#1 \hfill D. P. Story\\
Fall 2001 \hfill 8/31/2001


\begin{exercise}
Find the distance between  $A(-3,1,2)$ and $B(-1,3,6)$.
\begin{solution}
Use the distance formula:
\begin{align*}
    |AB| &= \sqrt{(-3+1)^2+(1-3)^2+(2-6)^2} \\&
          = \sqrt{2^2 + 2^2 + 4^2}   \\&
          = \sqrt{4+4+16} \\&
          = \sqrt{24} \\&
          = \boxed{2\sqrt{6}}
\end{align*}
\end{solution}
\end{exercise}

\begin{exercise}
Find the equation of the sphere with center at $C(-1,2,-3)$ and radius $2$.
\begin{solution}
We apply the center-radius form for the equation of a sphere:
\begin{align*}
        (x - (-1))^2 + (y - 2)^2 + (z - (-3))^2 &= 2^2 \\
        ( x + 1 )^2 + (y - 2)^2 + (z+3)^2 & = 4.
\end{align*}
Thus, the answer is
\begin{equation*}
        \boxed{( x + 1 )^2 + (y - 2)^2 + (z+3)^2  = 4}
\end{equation*}
in center-radius form, and in general form it is
\begin{equation*}
        \boxed{x^2 + y^2 + z^2 + 2x -4y + 9z + 10  = 0}
\end{equation*}

\end{solution}
\end{exercise}

\begin{exercise}
Find the center and radius of the sphere
$x^2 + y^2 + z^2 + 2x + 8y -4z = 28$
\begin{solution}
We complete the square:
\begin{align*}
    x^2 + y^2 + z^2 + 2x + 8y -4z &= 28 \\
    (x^2 + 2x + \phantom{1}) + (y^2 + 8y+ \phantom{16})+(z^2-4z+\phantom{4}) &=28 \\
    (x^2 + 2x + 1) + (y^2 + 8y+ 16)+(z^2-4z+ 4) &=28 + 1 + 16 + 4 \\
    (x+1)^2 + (y+4)^2 + (x-2)^2 &= 49
\end{align*}
From the last equation, we see that we indeed have a sphere, its center is at
$C(-1,-4,2)$ and has a radius of $r=9$.
\begin{equation*}
\boxed{C(-1,-4,2) \text{ and } r=7}
\end{equation*}
\end{solution}
\end{exercise}


\end{document}
