Simple expected value and variance exercise

The question is to find the expected value and variance of $$X - Y$$ where $$X, Y$$ are independent random variables distributed in $$[0,1]$$

My Attempt:

The expected value is simple enough, where $$E(X-Y) = E(X) - E(Y) = \frac{1}{2} - \frac{1}{2} = 0$$.

The variance is where I'm running into issues,

$$\mathrm{Var}(X-Y) = \mathrm{Var}(X) - \mathrm{Var}(Y) = \frac{1}{12} - \frac{1}{12} = 0$$.

I don't know if the variance is set up correctly. Is there a step I am missing?

• In addition to not having the variance equation correct, you did not establish that you were dealing with Uniformly distributed random variables. – Graham Kemp Apr 29 at 10:23

You have forgot to square the factors in front of the variables. For independent random variables $$X,Y$$ we have that $$\text{Var}(aX+bY)=a^2\text{Var}(X)+b^2\text{Var}(Y)$$ where you can use $$a=1$$ and $$b=-1$$ in your case.
$$Var(X-Y)=Var(X)+Var(Y)-2Cov(X,Y)$$. When are X and Y independent then $$Cov(X,Y)=0$$.