# How to find the probability of a random variable being greater then another

So I have two independent random variables $$X$$ and $$Y$$, $$Y$$ ~ $$U[0, 3]$$ and the density function of $$X$$ is as follows:

$$f(x) = 1/3$$ if $$0\le x \le 1$$

$$f(x) = 2/3$$ if $$1\le x \le 2$$

$$f(x) = 0$$ otherwise

I calculated the joint density of this function by multiplying them, since they are independent. And now I'm trying to find $$P(Y\gt X)$$

The support is the rectangle $$\mathcal{R}=[0,3]\times[0,2]$$, and for $$P(X>Y)$$, you'll integrate the area under $$Y=X$$ line: $$\int_{\mathcal R} f_{X,Y}(x,y)dydx=\int_{0}^1\int_0^x \frac{1}{9} dy dx+\int_1^2\int_0^x\frac{2}{9} dydx$$