I have a variable $X$ that is uniformly distributed on the set $\{1, 2, 3, 4, 5\}$, and a variable $Y$ that is uniformly distributed on $\{1, 2, ..., X\}$. I am asked to calculate the joint p.m.f of $X$ and $Y$. I am also asked to calculate the conditional p.m.f of $X$ given $Y$.
What I did so far: For the joint p.m.f., I reasoned it this way. We are trying to find $P(X = x, Y = y)$. First, $P(X = x) = 1/5$. Then, $P(Y = y|X = x) = \frac{1}{x}\mathbf{1}_{y \leq x}$, since given some $x$, if $y$ lies under or at $x$, then the probability that $Y = y$ is just $1/x$, otherwise 0. Using this information, I found the joint p.m.f. to be $$P(X = x, Y = y) = P(Y = y|X = x)P(X = x) = \frac{1}{5x}\mathbf{1}_{y \leq x}$$
For the conditional p.m.f., I tried finding $P(Y = y)$, then we can divide $P(X = x, Y = y)$ by $P(Y = y)$ to obtain $P(X = x|Y = y)$. To compute $P(Y = y)$, I observed that we can sum the joint distribution, fixing $Y = y$. This gives $$P(Y = y) = \frac{1}{5}\sum_{k = y}^{5} \frac{1}{k}$$ Using this to compute $P(X = x|Y = y)$ gives me a very nasty expression, am I doing this the right way?
Lastly, I am supposed to calculate $E[Y|X]$ and use the result to determine $E[Y]$. I determined $$E[Y|X] = \sum_{y} y*P_{Y|X}(y|x) = \frac{1}{x}\sum_{i = 1}^{5} i*\mathbf{1}_{i \leq x}$$ And through this I determined (by using $E[E[Y|X]] = E[Y]$) $$E[Y] = \frac{1}{5} \sum_{x} \frac{1}{x}\sum_{i = 1}^{5} i*\mathbf{1}_{i \leq x} = 1 + \frac{3}{2} + \frac{6}{3} + \frac{10}{4} + \frac{15}{5} = \frac{10}{5} = 2$$ Did I solve this correctly? It seems like a reasonable expected value based on the problem specs. Would appreciate any comments on anything incorrect and/or more efficient ways to solve this problem). Thanks!
Yes, indeed, it does not have a nice closed form, so avoid trying to evaluate it as much as possible. Leaving it as a series should be acceptable.
That method will work. Also since you already have $\mathsf P(X=x,Y=y)=\tfrac 1{5x}\mathbf 1_{(x,y)\in\Bbb N^2, 1\leqslant y\leqslant x\leqslant 5}$, you could just jump to it:
$$\mathsf E(Y)~{=\sum_{x=1}^5\sum_{y=1}^x y~\mathsf P(X=x,Y=y)\\ = \sum_{x=1}^5\sum_{y=1}^x \frac y{5x}\\ = \sum_{x=1}^5\frac 1{5x}\frac{x(x+1)}{2} \\ = 2}$$
For the same result. So it did work. $\ddot\smile$
Since the expectation of a uniform discrete distribution over $[a;b]\cap\Bbb N$ is well known to be $\tfrac {b+a} 2$, you could have completely avoided the series evaluations.
$$\mathsf E(Y)~{=\mathsf E(\mathsf E(Y\mid X)) \\= \mathsf E((X+1)/2) \\= (\mathsf E(X)+1)/2 \\= (((5+1)/2)+1)/2 \\= 2}$$
Sure. Still, if you see a calculation shortcut, and can explain why you take it, there is no reason not to.
But anyhow. The answer is $2$ and your working was correct.