# Depending on variable to calculate joint distribution

I have a simple misconception in probability: there are balls arranged in a triangle as such: 1 ball on row 1, 2 balls on row 2, .., n balls on row n. a ball is chosen and I need to find $P(X=i, Y=j)$ where $X$ is the row of the chosen ball, and $Y$ is the index in that row (starting from 1).

I go about it like this: $$P(X=i, Y=j) = P(Y=j \mid X=i) \cdot P(X=i) = \frac{1}{i\cdot n}$$

But it is incorrect, what is the reason?

-
Rows aren't equally likely to be chosen. – David Mitra Feb 22 '12 at 22:21
Now that you mention it, of course they're not! Thanks. – daniel.jackson Feb 22 '12 at 22:31

If you choose a ball at random from amongst all the balls (rather than choosing a row first and then choosing a ball), then the probability that row $i$ was chosen is $P[X=i]={i\over N}$, where $N={n(n+1)\over2}$ is the total number of balls.
So if $j\le i$ $$P[X=i,Y=j]= P[X=i]\cdot P[Y=j\,|\,X=i]={i\over N}\cdot {1\over i}={1\over N}.$$
If $j>i$, then $P[X=i,Y=j]$ is of course 0.
Note this is (maybe) intuitively clear, since $P[X=i,Y=j]$ is the probability of picking a particular ball from the total of $N$ balls.