Please help

Let X and Y be independent random variables, with X uniformly distributed on [0,1] and y uniformly distributed on [0,2]. Find the PDF f_z(z) of Z = max{X,Y}.

For z < 0 or z > 2:
f_z(z)=
unanswered

For 0<=z<=1:
f_z (z)=

unanswered

For 1<=z<=2 :
f_z (z)=

For z < 0 or z > 2:

f_z(z) = 0

For 0 <= z <= 1:
Let's find the CDF of Z first:
P(Z ≤ z) = P(max{X, Y} ≤ z)
= P(X ≤ z, Y ≤ z)
Since X and Y are independent:
= P(X ≤ z) * P(Y ≤ z)
= z * z/2 = z^2 / 2

Taking the derivative with respect to z to find the PDF:
f_z(z) = d/dz (z^2 / 2) = z / 2

For 1 <= z <= 2:
Similarly, we can find:
P(Z ≤ z) = P(X ≤ z, Y ≤ z)
= P(X ≤ z) * P(Y ≤ z)
= z * y = z/2

Taking the derivative with respect to z to find the PDF:
f_z(z) = d/dz (z/2) = 1/2

Therefore,
For 0 <= z <= 1:
f_z(z) = z / 2

For 1 <= z <= 2:
f_z(z) = 1/2