<s>[INST] Puzzled by how to determine when a function takes on its maximum (or minimum) I apologize for the specificity of the my question, but I'm concerned that I'm having trouble grasping an important concept.
I'm puzzled by the answer provided for exercise 1.(v) in chapter 7 of Spivak's Calculus (4E, p.129):
For $a>-1$  and
$$f(x) =\begin{cases}
 x^{2}, & x ≤ a \\
 a+2, & x>a
\end{cases},\qquad x\in(-a-1,a+1),$$
where where does $f(x)$ take on its maximum and minimum?
I get
$$\begin{array}{cc}

Range & Max & Min\\
-1<a<-\frac{1}{2} & a+2 & a+2 \\
-\frac{1}{2}≤a<0 & a+2 & a^{2} \\
0≤a≤\frac{\sqrt{5}-1}{2} & a+2 & 0 \\
\frac{\sqrt{5}-1}{2}<a & - & 0 \\
\end{array}$$
but the answer key has $a^{2}$ as a minimum only for $-\frac{1}{2}<a\lt 0$.
What am I missing?
 [/INST] I have the 2nd Spanish edition (Editorial Reverté, S.A.), translated from the second English edition. The problem is the same, but did not include the condition $a\gt -1$ until the answer key. But the answer key there reads (translated):

It is bounded above and below. It is understood that $a\gt -1$ (so that $-a-1\lt a+1$). If $-1\lt a\leq -\frac{1}{2}$, then $a\lt -a-1$, so $f(x)=a+2$ for all $x\in (-a-1,a+1)$, so $a+2$ is the maximum and the minimum. If $-\frac{1}{2}\lt a\leq 0$, then $f$ has minimum $a^2$, and if $a\geq 0$, then it has minimum $0$. Since $a+2\gt (a+1)^2$ only for $\frac{-1-\sqrt{5}}{2}\lt a \lt \frac {1+\sqrt{5}}{2}$, when $a\geq -\frac{1}{2}$ the function $f$ has a maximum only for $a\leq \frac{1+\sqrt{5}}{2}$ (when this maximum is $a+2$).

So it looks like your answer matches exactly with this one.
Added. Oh, I see; the problem is what happens when $a=-\frac{1}{2}$. 
If $a=-\frac{1}{2}$, then the function is
$$f(x) = \left\{\begin{array}{ll}x^2 & \text{if }x\leq -\frac{1}{2}\\
\frac{3}{2} &\text{if }x\gt -\frac{1}{2}
\end{array}\right.\qquad x\in\left(-\left(-\frac{1}{2}\right)-1,-\frac{1}{2}+1\right).$$
What you seem to be missing is that since the domain is $(-\frac{1}{2},\frac{1}{2})$, the first case never occurs, so you are always in the second case. 
</s>