Distribution of the Sum of Uniform Random Variable and Another Random Variable This could have been asked somewhere else, but I couldn't find it anywhere. Assume $X$ and $Y$ are random variables which take values in $\mathbb{Z}_n$ - i.e., $\{0, 1, 2, ..., n-1\}$. Also assume that $X$ is uniformly distributed. What is the distribution $X+Y$?
My approach: Let $Z$ be a random variable defined by $X+Y$. Then, since the maximum value that $X$ and $Y$ can take is $n-1$, $Z$ can take a maximum number of $2(n-1) = 2n -2$, which means that $Z$ takes values in $\mathbb{Z}_{2n-1}$. Now to get the probability mass function of $Z$, we have that
\begin{align*}
P(Z = z) &= P(X+Y = z)\\
&= P(X= x, Y = z -x) \\
&= P(X=x) P(Y = z-x) \\
&= \frac{1}{n} P(Y = z - x)
\end{align*}
which shows that $Z$ has the same distribution as $Y$ and it takes values in $\mathbb{Z}_{2n-1}$. Is my logic correct? If not, how else can I find the distribution of $X+Y$? I would appreciate any help on this!
 A: Your own calculations are almost correct however as suggested in my comment you fail to consider all values that $X$ can take. The formula for the probability mass function of $Z=X+Y$ is therefore
$$P(Z=z) = P(X+Y=z) = \frac{1}{n} \sum_{x=0}^{n-1}P(Y=z-x),$$
It should however be noted, that some of the terms on the right hand side will probably be $0$, since $P(Y = z-x)=0$, when $z-x \notin \{0,\dots,n-1\}$ or equivalently, when $z \notin \{x ,\dots,x+n-1\}$.
Let us consider a concrete example, where $X$ and $Y$ are both uniform on $\{0,1,2\}$, then by our derived formula
\begin{align*}
P(X+Y = 0) &= \frac{1}{3}(P(Y=0)+P(Y=-1)+P(Y=-2)) \\ &= \frac{1}{3}P(Y=0) =\frac19
\end{align*}
and
\begin{align*}
P(X+Y = 1) &= \frac{1}{3}(P(Y=1)+P(Y=0)+P(Y=-1)) \\ &= \frac{1}{3}(P(Y=1)+P(Y=0)) =\frac29
\end{align*}
and by continuing the calculations you should get a distribution, which looks like this

A: Taken almost verbatim from here:

If $X$ and $Y$ are two independent integer-valued random variables with distribution functions $m_{1}(x)$ and $m_{2}(x)$, respectively.
The convolution of $m_{1}(x)$ and $m_{2}(x)$ is the distribution $m_{3}(x) = m_{1}(x) * m_{2}(x)$ given by
$$
m_{3}(j) = \sum_{k} m_{1}(k) \cdot m_{2}(j-k).
$$
The function $m_{3}(x)$ is the distribution function of the random variable $Z = X + Y$.

I think your issue comes from your third equality, since you have to remember that
$$
P(A,B) = P(A|B) P(B),
$$
where $P(A|B)$ will equal $P(A)$ only if $A$ and $B$ are independent.
In your case, the probability that $Y=z-x$ is not going to be independent from the probability that $X=x$.
The linked chapter from which I copied the quote about convolution has many more details and examples which may be of interest to you.
