variance of a function of random variables

Hi all,

I'm trying to calculate the variance of a function of two continuous random variables and could do with a nudge in the right direction seeing as its been a good few years since I did any probability theory work. You may also notice that my latex is a little ropey too...

Specifically I need to calculate var(z):

[math]z = x-y, x>y[/math]
[math]z= 0, x<y[/math]

where x and y are both iid uniform(a,b)

If it helps:

Is the law of total variance relevant? Any help greatly appreciated


TS Contributor
Without investigating any good tricks to solve this problem, you can always refer back to the fundamental definition:

[math] Var[Z] = E[Z^2] - E[Z]^2 [/math]

[math] = \int_a^b \int_y^b \frac {(x - y)^2} {(b - a)^2} dxdy
- E[Z]^2[/math]

provided that you already calculated [math] E[Z] [/math]