# Continuous probability; find the probability density function

Let $X$ and $Y$ be random variables and let $Z = \frac{(X+Y)}{2}$. Suppose you randomly choose two numbers $X,Y \in [1,3]$. Find the probability density function of $Z$ and the expected value $E(Z)$.

Does anybody have hint to tackle this problem?

1. The probability density function is determined by convolution: \begin{align} f_Z(z) & = \int_\Bbb R f_X(x)f_Y(2z-x)\operatorname d x \\[1ex] & = \tfrac 1 4\int_\Bbb R \mathbf 1_{x\in[1;3]}\mathbf 1_{2z-x\in[1;3]}\operatorname d x \\[1ex] & = \mathbf 1_{z\in[1;3]}\int_\Bbb R \mathbf 1_{x\in\big[\max(1,\underline{\quad});\min(3,\underline{\quad})\big]}\operatorname d x \\[1ex] & = (\underline{\qquad})\mathbf 1_{z\in[1;\underline{\quad})}+ (\underline{\qquad})\mathbf 1_{z\in[\underline{\quad};3]} \end{align}

2. The expectation is the integral $\mathsf E(Z) = \int_\Bbb R z\,f_Z(z)\operatorname d z \\ = \int_1^{\Box} z(\underline{\qquad})\operatorname d z+\int_{\Box}^3 z(\underline{\qquad})\operatorname d z \\ = \underline{\qquad}$

Fill in the blanks

NB: $\mathbf 1_{\cdots}$ is an indicator function: $\mathbf 1_{x\in A} \mathop{:=} \begin{cases} 1 & : x\in A \\ 0 : \textsf{otherwise}\end{cases}$

HINTS

1. So $Z$ is the average of 2 uniforms over $[1,3]$. What is the possible range of $Z$, say $[a,b]$?
2. Fix some small $z \in [a,b]$. To compute $$F_Z(z) = \mathbb{P}[Z \le z] = \mathbb{P}[X+Y \le 2z],$$ condition this on the value of $X$, say.
3. Clearly, $Z$ is a continuous r.v., so the pdf is given by $$f_Z(z) = F'_Z(z).$$
4. Compute $$\mathbb{E}[Z] = \int_a^b z f_Z(z) dz$$