Apostol (3.8.22): Finding $f \circ g (x)$ $$
f(x)=
\begin{cases}
1 &\text{if} & |x|\leq 1,\\
0 &\text{if} & |x|>1,\\
\end{cases}
\qquad
g(x)=
\begin{cases}
2-x^2 &\text{if} & |x|\leq 2,\\
2 &\text{if} & |x|>2.
\end{cases}
$$
I need to find the composition $h(x)$ of $f(x)$ and $g(x)$ such that $h(x)=f(g(x))$. My answer to this question is $h(x)=f(x)$ since the values of $f$ are constants. But the answer of Apostol is 
$$
h(x)=
\begin{cases}
1 &\text{if} & 1\leq|x|\leq\sqrt{3},\\
0 &{} &\text{otherwise}.
\end{cases}
$$
How can this be?

$$
f(g(x)) = \begin{cases} 1 & \left|g(x)\right| \leq 1 \\
0 & \left|g(x)\right| > 1
\end{cases}
$$
So you need to find those cases:
First, it's clear that when $|x| > 2$, $g(x) = 2 > 1$ and thus when $|x| > 2$, $f(g(x)) = 0$.  So now we need to investigate when $|x| \leq 2$ and $g(x) = 2 - x^2$.  It might help to right down $\left|g(x)\right|$:
$$
\left|2 - x^2\right| = \begin{cases}
2 - x^2 & 2 - x^2 \geq 0 \\
x^2 - 2 & 2 - x^2 < 0
\end{cases}
$$
So lets solve the following:
\begin{align}
2 - x^2 \geq 0 \\
(\sqrt{2} - x)(\sqrt{2} + x) \geq 0 \\
\sqrt{2} - x \geq 0 \wedge \sqrt{2} + x \geq 0 \rightarrow x \leq \sqrt{2} \wedge x \geq -\sqrt{2} \rightarrow -\sqrt{2} \leq x \leq \sqrt{2} \\
\textit{or}\\
\sqrt{2} - x < 0 \wedge \sqrt{2} + x < 0 \rightarrow x > \sqrt{2} \wedge x < -\sqrt{2} \rightarrow False
\end{align}
Therefore we can now write down the absolute value of $g(x)$ as follows:
$$
\left|g(x)\right| = \begin{cases}
2 - x^2 & |x| \leq \sqrt{2} \\
x^2 - 2 & |x| > \sqrt{2}
\end{cases}
$$
(which should be obvious even without the above rigmarole).
Now let's look at the two cases:
1) $|x| \leq \sqrt{2}$: $\left|g(x)\right| = 2 - x^2$
Find when $\left|g(x)\right| \leq 1$:
\begin{align}
2 - x^2 \leq 1 \rightarrow 1 - x^2 \leq 0 \rightarrow (1 - x)(1 + x) \leq 0 \\
1 - x \leq 0 \wedge 1 + x \geq 0 \rightarrow x \geq 1 \wedge x \geq -1 \rightarrow x \geq 1 \\
1 - x \geq 0 \wedge 1 + x \leq 0 \rightarrow x \leq 1 \wedge x \leq -1 \rightarrow x \leq -1
\end{align}
Combined this is the constraint that $|x| \geq 1$.  This along with the original constraint that $\left|x\right| \leq \sqrt{2}$ gives $1 \leq |x| \leq \sqrt{2}$.
2) $|x| > \sqrt{2}$: $\left|g(x)\right| = x^2 - 2$.
Again, find when $\left|g(x)\right| \leq 1$:
\begin{align}
x^2 - 2 \leq 1 \rightarrow x^2 - 3 \leq 0 \rightarrow (x - \sqrt{3})(x + \sqrt{3} \leq 0 \\
x - \sqrt{3} \leq 0 \wedge x + \sqrt{3} \geq 0 \rightarrow x \leq \sqrt{3} \wedge x \geq -\sqrt{3} \rightarrow -\sqrt{3} \leq x \leq \sqrt{3} \\
x - \sqrt{3} \geq 0 \wedge x + \sqrt{3} \leq 0 \rightarrow x \geq \sqrt{3} \wedge x \leq -\sqrt{3} \rightarrow False
\end{align}
Combined with the original assumption that $|x| > \sqrt{2}$ then $\left|g(x)\right| \leq 1$ when $\sqrt{2} < |x| \leq \sqrt{3}$ and $\left|g(x)\right| > 1$ otherwise.
We can naively combine all of this:
$$
f(g(x)) = \begin{cases}
\begin{cases}
1 &  1 \leq |x| \leq \sqrt{2} \\
0 & |x| <1
\end{cases} & |x| \leq \sqrt{2} \\
\begin{cases}
1 & \sqrt{2} < |x| \leq \sqrt{3} \\
0 & |x| > \sqrt{3}
\end{cases} & |x| > \sqrt{2}
\end{cases}
$$
You should be able to see that the two cases when $f(g(x)) = 1$ combine to create the interval $1 \leq |x| \leq \sqrt{3}$ such that:
$$
f(g(x)) = \begin{cases}
1 & 1 \leq |x| \leq \sqrt{3} \\
0 & |x| < 1 \vee |x| > \sqrt{3}
\end{cases}
$$
or simply:
$$
f(g(x)) = \begin{cases}
1 & 1 \leq |x| \leq \sqrt{3} \\
0 & \text{otherwise}
\end{cases}
$$
Note: I was sloppy and started to write $g(x)$ as if it was always $g(x) = 2 - x^2$.  I never explicitly combined the fact that $g(x) = 2$ when $|x| > 2$.  However, since $2 > \sqrt{3}$ and $f(2) = 0$, the above is indeed correct, but we should be careful to note that $|x| > 2$ gives $f(x) = 0$ (by the definition of $f(x)$) and that this agrees with the above formulation since we say that $f(x) = 0$ when $|x| > \sqrt{3}$ which includes when $|x| > 2$.
