# Finding joint and marginal distributions

Here's a question I got for homework:

A student purchases books for $K$ class hours, where $K$ is a random variable with a uniform distribution between $1$ to $3$. The number of books the students purchases is also a random variable defined by $P(N=n|K=k) = 1/k$, $n = 1,\dots,k$.

What is the joint distribution, what is the marginal probability function of N?

So, first I wrote down $P(K=k): 1/3$, $k=1,2,3$

Now, $P(N=n|K=k) = P(N=n \text{ and } K=k)/P(K=k) = 1/k$, and from that I got $P(N=n\text{ and }K=k) = (1/k)P(K=k)$. When I write down the table of joint distribution the disjoints events didn't sum up to $1$. For example:

\begin{align*} P(N=1|K=1) &= 1 \\ P(N=1|K=2) &= 1/6 \\ P(N=1|K=3) &= 1/9 \\ \end{align*}

You'll notice that I get P(N=n) = 11/18 for n=1,2,3 And that's what I mean when I say it didn't sum up to 1.

There's obviously something I don't understand, a hint would be great. Where is my mistake? Thanks!

-
Those are conditional probabilities you are adding, not joint dist. values. You want to find, for example, $P[N=1, K=1]$, $P[N=1, K=2]$, $P[N=1, K=3]$. The sum of these is the marginal distribution of $N$ evaluated at $1$ (and need not be 1). The sum of all $P[N=i, K=j]$ would be 1. – David Mitra Dec 12 '11 at 10:46
I know what's your saying is right but the sum I get is 11/6. Is there any way to draw a table here? – yotamoo Dec 12 '11 at 10:52