I'm working on a probability problem where I need to calculate the area of a triangle between the square $ \left[ (1,1),\,(1, -1),\,(-1, 1),\,(-1,-1) \right] $ and the inequality $ x + y \leqslant z $. To keep things simple, let's focus just on the bottom part of the square, between $x = -1$, $y = -1$, and $y \leqslant =-x$.
The geometric approach boils down to this: Given the boundary $ x + y = z $ calculate the distance from the intersections with the sides of the square $x = -1$ and $y = -1$ as a function of $z$ calculating the distance those two points to the point $(-1,-1)$. The first of those is $P = (z+1, -1)$ and the second $Q=(-1, z+1)$. Calculating the euclidian distance $d_{PO} = \sqrt{ (z+2)^2} = d_{QO}$ where $O = (-1, -1)$.
With these distances, we have that the area of the triangle is $ \frac{(z+2)^2}{2}$.
Here is a picture to help with this argument:
And now here is the integration argument, which should match the above calculation, but doesn't, and I can't figure out where my mistake is.
Using the following picture to guide the creation of the independent intervals to apply Fubini's theorem:
Integrating first with respect to $y$
$$ \begin{align} \int_{-1}^{1}\int_{-1}^{z - x} \,dy\,dx &= \\ \int_{-1}^{1} \left( z - x + 1 \right) \, dx &= \\ zx - x^2 + x \biggr\rvert^{1}_{x = -1} &= \\ &2z + 2 \end{align} $$
Which is clearly wrong. What am I getting wrong?


For $\bf z\leq 0$, the line $x+y=z$ intercepts the boundary for the square at points $(-1, z+1)$ and $(z+1, -1)$ .
You already used this fact to measure the sides of the triangle, so likewise use it to identify the bounds for the integration domain.
$$\lVert\triangle(-1,-1)(-1,z+1)(z+1,-1)\rVert =\int_{-1}^{z+1}\int_{-1}^{z-x}\mathrm d y\,\mathrm d x $$