PDF of $Y - (X - 1)^2$ for $(X, Y)$ uniform on $[0, 2] \times [0, 1]$ I am trying to find the p.d.f (but will calculate the c.d.f first) of $Z = Y - {(X - 1)}^2$ knowing that $(X, Y)$ is distributed uniformly on $[0, 2] \times [0, 1]$. So,
$$f_{X, Y}(x, y) = \begin{cases}\frac{1}{2} & (x, y) \in [0, 2] \times [0, 1] \\ 0 & \text{otherwise} \end{cases}$$
$$F_Z(z) = P_{X, Y}(\left\{(x, y): y - {(x - 1)}^2 \leq z\right\})$$
I understand that $z$ changes in: $z \leq - 1$, $- 1 < z \leq 0$, $0 < z \leq 1$ and $z > 1$
When $z \leq - 1$: $F_Z(z) = 0$ and when $z > 1$: $F_Z(z) = 1$. My question is regarding $- 1 < z \leq 0$ and $0 < z \leq 1$. This is what I got:
$$F_Z(z) = \begin{cases}2 \cdot (\int\limits_0^{1 - \sqrt{-z}} \int\limits_0^{z + {(x - 1)}^2} \frac{1}{2}\,\mathrm{d}y\,\mathrm{d}x) & - 1 < z \leq 0 \\ \int\limits_{1 - \sqrt{1 - z}}^{1 + \sqrt{1 - z}} \int\limits_{z + {(x - 1)}^2}^1 \frac{1}{2}\,\mathrm{d}y\,\mathrm{d}x & 0 < z \leq 1 \end{cases}$$
Do you agree with the definition of the c.d.f? I am asking because finding the integrals (especially the integration limits) was a bit tricky.
Finally, assuming that the c.d.f is correct, I did the derivative and got the following p.d.f:
$$f_Z(z) = \begin{cases}1 - \sqrt{-z} & - 1 < z \leq 0 \\ \sqrt{-(z - 1)} & 0 < z \leq 1 \\ 0 & \text{otherwise} \end{cases}$$

Given:  the joint pdf of $(X,Y)$ is $f(x,y)$:

(source: tri.org.au)
Some neat solutions have been posted showing all the manual steps which involve some work. Alternatively (or just to check your work), most of this can be automated which makes solving it really quite easy. Basically, it is a one-liner:
The cdf of $Z = Y-(X-1)^2$ is $P(Z<z)$:

(source: tri.org.au)
where Prob is a function from the mathStatica add-on to Mathematica (I am one of the authors of the former).
The pdf of $Z$ is, of course, just the derivative of the cdf:

(source: tri.org.au)
All done.
