Here is the question:
Let X and Y be the Cartesian coordinates of a randomly chosen point (according to an uniform PDF) in the triangle with vertices at (0,1), (0,-1), and (1,0). Find the PDF of |X-Y|. (Problem 4.6 of Introduction to Probability, 2nd edition, by Dimitri P. Bertsekas and John N. Tsitsilis)
According to my understanding of this question, I drew up a plot of the area to be calculated:
I came up with a very strange answer for half of the area (the lower area): 5z^2/2+z-3/2... (obviously wrong).
While the correct answer is very simple (z/2 +(z^2)/4)+(1/4-((1-z)^2)/4)=z
What have I done wrong, and is there a easier way to find the total of the area for |X-Y|?


In your picture, there are three triangles with side lengths in the ratio $1:1:2$.
There is the largest triangle with longest edge having endpoints $(0,1)$ and $(0,-1)$. It has area $1$.
There is a medium triangle with longest edge having endpoints $(0,1)$ and $(0, -z)$. By similarity, it has area $\left(\frac{1+z}{2}\right)^2$.
There is the smallest triangle with longest edge having endpoints $(0,1)$ and $(0, z)$. By similarity, it has area $\left(\frac{1-z}{2}\right)^2$.
The desired region is the medium triangle minus the small triangle, which has area $\left(\frac{1+z}{2}\right)^2 - \left(\frac{1-z}{2}\right)^2 = \frac{1}{4} \cdot 2 \cdot 2z = z$.