TITLE: Distribution of the sum of a multinomial distribution
QUESTION [7 upvotes]: I have distilled an error analysis problem into the following:
I have a multinomial distribution, $X$, consisting of $n$ independent trials where each trial takes on the values $\{0,1,\ldots,k-1\}$ with uniform probability of $\frac{1}{k}$.
Now I am interested in finding the distribution of the sum of all the outcomes in the $n$ trials, but not sure how to approach the problem. I suspect it has something to do with partition functions. Would be glad if the relevant probability distribution function in MATLAB could also be pointed out.

REPLY [5 votes]: Since you mentioned in a comment that $n=4$ in your case, here's a way to derive the distribution for small values of $n$.
The number of ways of writing $m$ as a sum of $n$ values from $0$ to $k-1$ is the coefficient of $x^m$ in 
$$
(1+x+\dotso+x^{k-1})^n=\left(\frac{1-x^k}{1-x}\right)^n=(1+x+x^2+\dotso)^n\sum_{j=0}^n\binom nj(-x^k)^j\;.
$$
Thus you just have to place the binomial coefficients in a sequence at distances of $k$ and then sum the sequence $n$ times; e.g. for $n=4$ and $k=3$:
$$
\begin{array}{rrrrrrrrr}
1&0&0&-4&0&0&6&0&0&-4&0&0&1\\
1&1&1&-3&-3&-3&3&3&3&-1&-1&-1\\
1&2&3&0&-3&-6&-3&0&3&2&1\\
1&3&6&6&3&-3&-6&-6&-3&-1\\
1&4&10&16&19&16&10&4&1
\end{array}
$$
Then dividing through by the total number $k^n=81$ of possibilities gives you the probabilities for the values of the sum.