Non-IID Uniform Distribution $A$ is uniform (0, 2) and $B$ is uniform(1, 3). Find the Cov$(W, Z)$, where $W=\min(A,B)$ and $Z=\max(A,B).$
Since $WX = AB,$ then by independence of $A$ and $B$,  $E(WZ) = E(A)E(B),$ so that
$$Cov(WZ) = E(A) E (B) - E (W) E (Z) = (1)(2) - E (W) E (Z)$$
It suffices to find E(W) and E(Z) which I have
\begin{align*}
F_{W}(w) = P(W\le w)  = 1- [(1-P(A< w) )(1-P(B< w ))] 
= 1- \left[ \left( 1 - \frac{w}{2}\right) \left( 1 - \frac{w-1}{2}\right) \right] 
= 1 - \left[ \left( \frac{2-w}{2}\right) \left(\frac{3-w}{2}\right) \right].
\end{align*}
Then $f_W(w) = -\frac{2w}{4} - \frac{5}{4}$ which is negative violating nonnegativity of PDF. Where did I go wrong with the computations?
\begin{align*}
E[W] = E_W (A\le B) + E_W (A> B) = \int_0^1\int_u^3 \times PDF(W) da \ db +\int_0^1\int_1^u PDF(W) db \ da
\end{align*}
Assuming we found a correct PDF how to proceed with the expectation? More especially the bounds on the integration?


\begin{align*}
F_{W}(w) = P(W\le w)  = 1- [(1-P(A< w) )(1-P(B< w ))] 
= 1- \left[ \left( 1 - \frac{w}{2}\right) \left( 1 - \frac{w-1}{2}\right) \right] 
= 1 - \left[ \left( \frac{2-u}{2}\right) \left(\frac{3-u}{2}\right) \right].
\end{align*}

Why does the notation $w$ change to $u$?
And the PDF should be
$$
1 - F_W(w) = P(A > w, B > w) = 
\begin{cases}
\frac{2 - w}{2}, & 0 < w < 1\\
\frac{2-w}2\frac{3-w}{2}, & 1 \le w < 2 \\
\end{cases}
$$
For any non negative random variable Y,
$$
EY = \int_0^\infty (1 - F_Y(y)) dy 
$$
Supposing the PDF of $W$ I calculated is correct,
$$
EW = \int_0^1 \frac{2-w}{2} dw + \int_1^2 \frac{(2-w)(3-w)}{4} dw = \frac{23}{24}
$$
Note that $W + Z = A + B$, $EZ = EA + EB - EW = \frac{49}{24}$.

update:
The support of $W = \min(A, B)$ can be easily derived by noting that $W \le A$ and $W \le B$. (try thinking about the support of $Z$)
As for the PDF of $W$,
$$
1 - F_W(w) = P(W > w) = P(A > w) P(B > w)
$$
