# Let $X\sim\mathrm{Exp}(1)$, and $Y\sim\mathrm{Exp}(2)$ be independent random variables. Let $Z = \max(X, Y)$. calculate $E(Z)$

Here's a question I'm trying to solve:

Let $$X\sim\mathrm{Exp}(1)$$, and $$Y\sim\mathrm{Exp}(2)$$ be independent random variables.

Let $$Z = \max(X, Y)$$. calculate $$E(Z)$$

I'm can't understand how to deal with the $$\max(X, Y)$$ notations.

Final answer is $$\frac{7}{6}$$ , but I need explanation

• Can you find the CDF of $Z$? Mar 23 '15 at 13:27

\begin{align*}E[Z]&=\int_{0}^{+\infty}\int_{0}^{+\infty}\max\{X,Y\}f_{X,Y}(x,y)dxdy\\&=\int_{0}^{\infty}\int_{0}^{y}yf_X(x)f_Y(y)dxdy+\int_{0}^{\infty}\int_{y}^{\infty}xf_X(x)f_Y(y)dxdy\\&=\int_{0}^{\infty}yf_Y(y)\left(\int_{0}^{y}f_X(x)dx\right)dy+\int_{0}^{\infty}f_Y(y)\left(\int_{y}^{\infty}xf_X(x)dx\right)dy\\&=\int_{0}^{\infty}y2e^{-2y}(1-e^{-y})dy+\int_{0}^{\infty}2e^{-2y}e^{-y}(y+1)dy\\&=\int_{0}^{\infty}2ye^{-2y}dy+2\int_{0}^{\infty}e^{-3y}dy=^{(*)}\\&=\frac{1}{2}+\frac{2}{3}=\frac{3}{6}+\frac{4}{6}=\frac{7}{6}\end{align*}

The first integral in $(*)$ is the expected valued of $\exp(2)$ (thus equal to 1/2) and the second if multiplied by $3/3$ is the integral of the pdf of $\exp(3)$ over it's whole domain and therefore equal to 1.

Let $Z=max(X,Y)$. Then by independence we have $$P(Z\le z)=P(X\le z)\times P(Y\le z)$$ Therefore we have $$f_{Z}(z)=f_{X}(z)F_{y}(z)+f_{Y}(z)F_{x}(z)=e^{-z}(1-e^{-2z})+2e^{-2z}(1-e^{-z})$$ Integrate we have $$E(Z)=\int_{0}^{\infty}zf_{Z}(z)dz=\frac{7}{6}$$ as desired.

$$P\left\{ Z\leq z\right\} =P\left\{ X\leq z\wedge Y\leq z\right\} =P\left\{ X\leq z\right\} P\left\{ Y\leq z\right\} =\left(1-e^{-z}\right)\left(1-e^{-2z}\right)=$$$$1-e^{-z}-e^{-2z}+e^{-3z}$$

You can find the PDF of $Z$ by taking the derivative of this and then find $\mathbb EZ$ with $\mathbb EZ=\int_{0}^{\infty}zf\left(z\right)dz$

Alternatively for the nonnegative random variable $Z$ we can apply:

$$\mathbb{E}Z=\int_{0}^{\infty}P\left\{ Z>z\right\} dz=\int_{0}^{\infty}e^{-z}+e^{-2z}-e^{-3z}dz=\left[-e^{-z}-\frac{1}{2}e^{-2z}+\frac{1}{3}e^{-3z}\right]_{0}^{\infty}=$$$$1+\frac{1}{2}-\frac{1}{3}=\frac{7}{6}$$