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:

[math]E(z|x)=\frac{(x-a)^2}{2(b-a)}[/math]

[math]E(z)=\frac{b-a}{6}[/math]

[math]var(z|x)=\frac{(x-a)^3}{3(b-a)}-\frac{(x-a)^4}{4(b-a)^2}[/math]

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