# Computing Expect Value of Two Random Variables

Problem:

Suppose that we are given a random variables $x$ that is uniformly distributed on the interval $[-1,1]$. We are also given $y$ that is uniformly distributed on $[-1,3]$. Find the expected value of $E(\frac{x}{y})$ assuming that $x$ and $y$ are independent.

The distribution functions for $x$ and $y$ is: \begin{eqnarray*} f_x(x) &=& \frac{1}{2} \\ f_y(y) &=& \frac{1}{4} \\ \end{eqnarray*} Now for the expected value. \begin{eqnarray*} E(\frac{x}{y}) &=& \int_{-1}^{1} \int_{-1}^{3} { \frac{x}{8y} } dy dx = \int_{-1}^{1} \frac{x}{8} \ln{|y|} \Big|_{y = -1}^{ y = 3} dx \\ E(\frac{x}{y}) &=& \int_{-1}^{1} \frac{(\ln3)x}{8} dx \\ E(\frac{x}{y}) &=& 0 \\ \end{eqnarray*}

Is my solution correct? I am concerned that I have a problem because the function I am integrating is dividing by $0$ when $y = 0$.

Bob

• $\mathsf E(X/Y) = \iint \frac x y f_X(x) f_Y(y) \operatorname d(x,y) = \int_{-1}^1\int_{-1}^3 \frac{x}{8y}\operatorname d y \operatorname dx$ – Graham Kemp Sep 6 '16 at 21:06
• Unfortunately, $E\left(\frac{X}Y\right)$ exists if and only if $E\left(\left|\frac{X}Y\right|\right)$ is finite, and in any case $E\left(\left|\frac{X}Y\right|\right)=E(|X|)\cdot E\left(\frac{1}{|Y|}\right)$ by independence, so one must first check that the two last expectations are finite before embarking on senseless computations. Now, $$E\left(\frac{1}{|Y|}\right)=\frac14\int_{-1}^3\frac1{|y|}dy$$ diverges hence $E\left(\frac{X}Y\right)$ does not exist. – Did Sep 6 '16 at 21:43

$f_X(x)= \tfrac 1 2~\mathbf 1_{-1\leq x\leq 1}$

$f_Y(y)= \tfrac 1 4~\mathbf 1_{-1\leq x\leq 3}$

$\mathsf E(X)=\int_{-1}^1\int_{-1}^3 \frac{x}{8y}\operatorname d y\operatorname dx$

But otherwise okay.

However, as your suspected, that one point does cause problems.   As Did points out, the existence of any $\mathsf E(Z)$ requires $\mathsf E(\lvert{Z}\rvert)$ to be finite.   So even though the above integral is zero, it is not the actual solution.

• This is wrong. Actually, $E\left(\frac{X}Y\right)$ does not exist. – Did Sep 6 '16 at 21:44
• Is the sum of the two integrals 0 because you are subtracting infinity from infinity? – Bob Sep 6 '16 at 21:53
• Did, can you explain or prove your position that the expected value of $E(\frac{X}{Y})$ does not exist? – Bob Sep 6 '16 at 21:55
• The integral is not zero but instead diverges. – Stefan Hansen Sep 7 '16 at 9:37
• @Bob Not "my position", but a fact, explained at length in a comment on main posted one hour before you asked for an explanation. – Did Sep 7 '16 at 11:48

Your distribution functions are incorrect. Using your function, if we plug in $0$ to $f_x(x)$ we get $0$. This would imply that the probability of $x$ being less than $0$ is $0$, but with a uniform distribution on $[-1,1]$, it should be $1$, since "half" the values possible are below $0$.

You should instead get functions constant over the intervals where the random variables can hold values. See if you can figure them out. If not, comment and I will add something.

Also, I realize I didn't read the other parts of your answer very carefully. As Did points out you do not have a well-defined expected value. Unfortunately the manner in which you calculate the integral uses Fubini's theorem which does not apply, as he says, when the integral of the absolute value of each of the positive and negative parts of your function are infinite (which in this case, they are).