Probability that $x>y$ if $x$ is random in $(0,a)$ and $y$ is random in $(0,b)$, with $aLet $x$ and $y$ be real numbers such such that 
$0 \leq x \leq a$,
$0 \leq y \leq b,$
$a < b$
If we simultaneously pick both an $x$ and a $y$, what is the probability that $x > y$.
My room mate asked me for help with this question, it came up in his physics class. I was no help. Any advice?
 A: When dealing with relationships between two random variables, drawing a diagram and applying simple geometry sometimes helps.
Assuming $x$ and $y$ are picked uniformly, the table of possibilities looks like this:
x^
 |
a+---------+
 | 1 /     |
 |  /      | 
 | /   2   |
 |/        |
0+---------+->
 0         b y

Region 1 is the part of the state space where $x>y$. The probability that $x>y$ is thus the proportion of the state space occupied by region 1, or
$$\frac{\frac12a^2}{ab}=\frac a{2b}$$
A: You have not specified a probability distribution...
Assuming $x$ is drawn uniformly from $[0,a]$, and $y$ is drawn uniformly from $[0,b]$, then probabilities of events can be interpreted by looking at the rectangle in the plane with opposite vertices $(0,0)$ and $(a,b)$.
The event $\{x>y\}$ corresponds to the area of the rectangle obtained by drawing the line $y=x$ and taking the area below the line: the area is $a^2/2$. Dividing by the total area of the rectangle $ab$ gives $\frac{a}{2b}$.

More generally if you have independent distributions for $x$ and $y$, you want the integral of the densities over this region.
$$\int_0^a \int_x^b p_X(x) p_Y(y) \mathop{dy} \mathop{dx}.$$
The uniform case treated above uses the uniform densities $p_X(x)=\frac{1}{a}$ on $[0,a]$ and $p_Y(y) = \frac{1}{b}$ on $[0,b]$, in which case the integral is just the ratio of areas described above.

One last comment: your guess in the comment is not quite correct: it should be
$$\begin{cases}\frac{a-y}{a} & y<a \\ 0 & \text{otherwise}\end{cases}$$
Multiplying this by $1/b$ (the density $f_Y(y)$) and integrating this over $y \in [0,a]$ gives $\int_0^a \frac{a-y}{ab}\mathop{dy} = \frac{a}{b}-\frac{a}{2b} = \frac{a}{2b}$, which matches our above approach.
A: In the $xy$-plane, draw a rectangle whose vertices are at $(0, 0), (a, 0), (0, b), (a, b)$. This area represents our sample space.
Now draw the diagonal line $y = x$ (from $(0, 0)$ to $(a, a)$). Shade the triangle below this line. If a random point lands in this triangle, we succeed; otherwise, we fail. What's the probability that our point lands here? Well we just divide the areas:
$$
\Pr[x > y] = \frac{\frac{1}{2}a^2}{ab} = \frac{a}{2b}
$$
