Giving a closed form combinatorial solution to finding the larger of two balls drawn from an urn I understand how to solve the following problem by listing out the sample space; however, I would like to know how to derive a combinatorial solution to the problem (that is, I would like to give a closed form solution to n(X=0), n(X=1), etc.)
An urn contains 4 balls numbered 0 to 3. If two balls are drawn with replacement, define the random variable X to be the larger of the two balls drawn. Find P(X=0), P(X=1), P(X=2), and P(X=3).
 A: Here is a proof without words:

A: Note that
$$|\{(a,b):(a=k\quad\text{and} \quad b \leq a) \quad \text{or} \quad(b=k\quad\text{and} \quad a \leq b) \}|=2(k+1)-1=2k+1$$
for 
$
0\leq k\leq 3.
$
A: Case 0: $X=0$
The only way that the largest ball drawn is $0$ is if we pick $0$ both times, so
$$n(X=0) = \boxed{1}$$
Case 1: $X=1$
We can either have both draws be $1$, or one draw be $0$ and the other $1$. There are two ways to draw $0$ and $1$, one for each order, so we get
$$n(X=1) = 1+2 = \boxed{3}$$
Case 2: $X=2$
Once again, we can have both draws be $2$, or one draw be $2$ and the other be $0$ or $1$. This time there are $4$ ways to have only one of the draws be $2$, which gives
$$n(X=2) = 1+2+2 = \boxed{5}$$
Case 3: $X=3$
Both draws could be $3$, or one draw could be $3$ and the other be $0$, $1$, or $2$. This time there are $6$ ways to have only one of the draws be $3$, so we get
$$n(X=3) = 1+2+2+2 = \boxed{7}$$

As a check, notice that $n(X=0)+n(X=1)+n(X=2)+n(X=3) = 16$, which is the size of the sample space.
You can also compactly write this (bof wrote something similar in the comments):
$$n(X=k) = 2k+1$$
