Let $(X, Y )$ be a random point in the triangle $\{(x, y) : 0 ≤ x ≤ y ≤ 1,x+y≤1\}$. Let $Z = \text{max}(X, Y )$ be the larger of the two values. Compute the density function for $Z$.
My work:
$$\text{CDF}=\text{max}(P(x\leq z,y\leq z)=F_{x,y}(z,z) $$
which is the probability that $Z$ is less than or equal to $z$. Since $Z$ is the maximum of $X$ and $Y$, also equal to the probability that both $X$ and $Y$ are less than or equal to $z$.
I think the area $z^2$ under the $(z,z)$ point can equal to the probability of $x$ and $y$ less than $z$, and after derivative the pdf would be $2z$. But I'm not confident with it. Can anyone offer some advice?

The triangle is $\triangle(0,0)(1,0)(0,1)$ , which has an area of $1/2$. So the joint probability density function will equal $2$ over this support. $$f_{X,Y}(x,y) = 2\,\mathbf 1_{0\leq x\leq 1-y\leq 1}$$
Further, the intersection of $\max\{X,Y\}{\,\leq\,}z$ and that triangle, is not always a square.
Notably, when $1/2\leq z\leq 1$ the CDF of $Z$ will be over a truncated square.