A class of n students takes a test in which each student gets an A with probability p, a B with probability q, and a grade below B with probability 1 − p − q, independently of any other student. If X and Y are the numbers of students that get an A and a B respectively, calculate the joint PMF pX,Y .
I found this answer online:
Let r = 1 − p − q
Then,
Prob( X = i, Y = j) = n!/(i!j!(n-i-j)!)(q^j)(r^(n-i-…....so on)
for j=0,1,2..., j=0,1, 2..., 0<=i+j<=n
However I'm not able to figure out how to get to this answer. Any help is appreciated!