This is from Casella and Berger's Statistical Inference, although it is more of a probability question than a stats question.
Theorem 2.1.8 Let $X$ have pdf $f_{X}$, let $Y = g(X)$. Define the sample space $$\mathcal{X} = \{x:f_{X}(x) > 0\}\text{.}$$ Suppose there exists a partition $A_0, A_1, \dots, A_k$ of $\mathcal{X}$ such that $\mathbb{P}\left(X \in A_0\right) = 0$ and $f_{X}$ is continuous on each $A_i$. Furthermore, suppose there exist functions $g_1, \dots, g_k$ defined on $A_1, \dots, A_k$, respectively, satisfying:
- $g(x) = g_i(x)$, for $x \in A_i$,
- $g_i$ is monotone on $A_i$,
- the set $\mathcal{Y} = \{y:y = g_i(x)\text{ for some }x \in A_i\}$ is the same for each $i = 1, \dots, k$, and
- $g_i^{-1}$ has a continuous derivative on $\mathcal{Y}$, for each $i, \dots, k$.
Then, $$f_{Y}(y) = \begin{cases} \sum_{i=1}^{k}f_{X}\left(g^{-1}_{i}(y)\right)\left|\dfrac{\text{d}}{\text{d}y}g_i^{-1}(y)\right|\text{, } & y \in \mathcal{Y} \\ 0\text{, } & \text{otherwise.} \end{cases}$$
Problem 2.7(a) in this book is the following:
Let $X$ have pdf $f_{X}(x) = \dfrac{2}{9}(x+1)$, $-1 \leq x \leq 2$. Find the pdf of $Y = X^2$. Note that Theorem 2.1.8 is not directly applicable to this problem.
Why isn't Theorem 2.1.8 applicable? Take $A_0 = \{0\}$, $A_1 = [-1, 0)$, and $A_2 = (0, 2]$. The transformation $Y = X^2$ is monotone over $A_1$ and $A_2$, so I don't see why this doesn't work.
And then Problem 2.7(b) is even more confusing:
Show that Theorem 2.1.8 remains valid if the sets $A_0, A_1, \dots, A_k$ contain $\mathcal{X}$, and apply the extension to solve part (a) using $A_0 = \varnothing$, $A_1 = (-1, 1)$, and $A_2 = (1, 2)$.
This doesn't make sense to me since $X^2$ is not monotone over $A_1$, although the extension does make some sense.
As Did points out in the comments, your definitions of $A_1$ and $A_2$ do not satisfy the third condition.
You're correct that $g$ is not monotone on 2.7(b)'s $A_1 = (-1,1)$, nor is the third condition $g_1(A_1) = g_2(A_2)$ satisfied. This seems to be an error in your edition of the book. In the second edition, the sets $A_i$ are given as $A_0 = \emptyset$, $A_1 = (-2,0)$, $A_2 = (0,2)$. Now the image $\mathcal{Y}$ is $(0,4)$ on both intervals, and both $g_1$ and $g_2$ are monotone.
Note that we still cannot exactly apply Theorem 2.1.8's conclusion $f_Y(y) = \sum_{i=1}^{k}f_X(g_i^{-1}(y))|\frac{d}{dy}g_i^{-1}(y)|$ because we have elements in $g_1^{-1}(\mathcal{Y})$ not in the given domain of $f_X$. We need to define
$$f_X(x) = \begin{cases} \frac{2}{9}(x + 1) & x \in (-1, 2)\\ 0 & x \in (-2, -1) \end{cases}$$
and now after applying the theorem, we likewise end up with a piecewise definition of $f_Y(y)$
$$f_Y(y) = \begin{cases} \frac{2}{9}y^{-1/2} & y \in (0,1) \\ \frac{1}{9}(1 + y^{-1/2}) & y \in (1,4) \end{cases} $$
EDIT: Taking a little closer look, we can perhaps see how the error in your edition arose. Notice that $g^{-1}((0,1)) = (-1,1)$ and $g^{-1}((1,4)) = (1,2)\cup(-2,-1)$. So, if we knew the piecewise definition of $f_Y(y)$ and worked backwards, we might mistakenly think that our partition of $\mathcal{X}$ would correspond to these same intervals.
This unfortunately isn't the case. We partition the augmented domain $\mathcal{X_1} = (-2,-1)\cup\mathcal{X}$ based on where $g$ is monotone, whereas we choose our intervals for the piecewise definition of $f_Y$ based on the image $g((-2,-1))$, ie, the difference between our original domain $\mathcal{X}$ and new domain $\mathcal{X_1}$.