Issue with textbook exercise on vectors the following is a question from my textbook on vectors:

EDIT: Added text, so that the post is self-contained even without
the picture.
The points $A$ and $B$ have position vectors
$\begin{pmatrix}2\\9\\t\end{pmatrix}$ and
$\begin{pmatrix}2t\\5\\3t\end{pmatrix}$ respectively.
a. Find $\vec{AB}$.
b. Find, in terms of $t$, $|\vec{AB}|$.
c. Find the value of $t$ which makes $|\vec{AB}|$ a minimum.
d. Find the minimum value of $|\vec{AB}|$.
My issue is with part C. I accept the textbook's solution, as mine gives an incorrect answer but do not understand why their method is acceptable. Since the exercise is to find the value of t that makes vector AB a minimum, why is it acceptable to square vector AB and then differentiate, rather than just differentiating vector AB as it is, using the chain rule? I see how this leads to the problem of two t values, rather than one, but I didn't feel that it would be acceptable to just ignore one by squaring, and changing the original formula. What am I misunderstanding here?

EDIT: Added text.
(a) $\vec{AB}=\mathbf{b}-\mathbf{a}=\begin{pmatrix}2\\9\\t\end{pmatrix}-\begin{pmatrix}2t\\5\\3t\end{pmatrix}
=\begin{pmatrix}2-2t\\-4\\2t\end{pmatrix}$
(b) $\begin{align}|\vec{AB}|&=\sqrt{(2-2t)^2+(-4)^2+{2t}^2}\\
&=\sqrt{4t^2-8t+4+16+4t^2}\\
&=\sqrt{8t^2-8t+20}
\end{align}$
(c) Let $|\vec{AB}|^2=p$, then $p=8t^2-8t+20$ and $\frac{\mathrm{d}p}{\mathrm{d}t}=16t-8$
Thanks!
 A: It's acceptable to square and then differentiate because squaring is a monotone function on positive arguments (that is, $0\lt a\lt b$ if and only if $0\lt a^2\lt b^2$), so a value of $t$ maximizes the original if and only if it maximizes the square. 
It's good to square because it's easier to differentiate the square than it is to differentiate the original. 
A: It is true that squaring is easier. But one does not have to do it (I don't see how you get two solutions if you do not square it). Having $$|\vec{AB}|= \sqrt{8 t^2 -8 t +20},$$ we obtain using the chain rule
$$\frac{d}{dt} |\vec{AB}| = \frac{16 t -8}{2\sqrt{8 t^2 -8 t +20}}.$$
The denominator is always positive, as $8 t^2 -8 t +20$ assumes its minimum $18$ for $t=\frac{1}{2}$. The derivative is therefore only zero for 
$$16 t = 8$$
which is the same condition you will obtain by first squaring the equation.
A: The OP is, of course, bound by what his textbook tells him to do. However, it also looks like part b of the problem is just leading up to part c, which is what whoever wrote the textbook really wanted to ask. IMHO it is more interesting to solve this type of a problem with algebra/geometry alone, i.e. without resorting to methods from calculus such as differentiation. If we can, that is :-)
Below I will switch to row vector notation in the interest of saving space (not to mention making the typesetting easier). 
After solving part a, we want to find a value of the variable $t$ that minimizes the length of the vector $r=(x,y,z)=(2t-2,-4,2t)=(-2,-4,0)+t(2,0,2)$. When we vary $t$ these points move along the line $L$ going thru the point $(-2,-4,0)$ and in the direction given by the vector $s=(2,0,2)$. We are to find the point $r$ of $L$ that is as close to the origin as possible. If you draw a picture, it is clear that minimal distance occurs, when $r$ is perpendicular to the vector $s$. Thus we get the equation
$$
r\cdot s=0\Leftrightarrow 2(2t-2)+2(2t)=0\Leftrightarrow 8t-4=0,
$$
as two (non-zero) vectors are perpendicular to each other, if and only if their dot product vanishes. From this we can solve $t=2$, and proceed as above.
Note: Also the derivative of $p=r\cdot r$ with respect to the parameter $t$ equals 
$$dp/dt=r\cdot\frac{dr}{dt}+\frac{dr}{dt}\cdot r=2s\cdot r,$$
because $dr/dt=s$. Therefore the two solutions are equivalent.
