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?
 A: We first observe that 
$$f : \mathbb R \to \{0,1\}$$ and $$g : \mathbb R \to [-2,2].$$  That is to say, the image of $\mathbb R$ under $f$ is the set $\{0,1\}$ (which is fairly obvious) and the image of $\mathbb R$ under $g$ is the closed interval $[-2,2]$, since we can see that for $-2 \le x \le 2$, $-2 \le 2-x^2 \le 2$.  So the first idea is to find the maximal subset $S$ of $\mathbb R$ such that the image of $S$ under $g$ is the interval $[-1,1]$, since it is this interval that will map to $1$ under $f$.
In other words, what is the preimage of $[-1,1]$ under $g$?  Well, $2-x^2 = -1$ implies $x = \pm \sqrt{3}$, and $2-x^2 = 1$ implies $x = \pm 1$.  So if $-\sqrt{3} \le x \le -1$ or $1 \le x \le \sqrt{3}$, then $g(x) \in [-1,1]$.  Otherwise, $g(x) \not\in [-1,1]$ and consequently $f(g(x)) = 0$.  It immediately follows that $$h(x) = f(g(x)) = 1$$ if $1 \le |x| \le \sqrt{3}$, and $0$ otherwise.
A: $$
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$.
A: Well, thinking that the only possible values of  you have $f(x)=1\Leftrightarrow |x|\le1$.
Thus $\tag{1}f(g(x))=1\Leftrightarrow|g(x)|\le1$
The case $|x|>2$ is omitted since then $g(x)=2$. The condition in  $(1)$ isn't satisfied.
Thus we must have $|x|\le 1$. In this case, $g(x)=2-x^2$. Thus you should solve: $$\begin{cases}
|x|\le1\\
|2-x^2|\le1
\end{cases}$$
