Question: The degeneracy for an $p$-dimensional quantum harmonic oscillator is given by [[1](http://aapt.scitation.org/doi/pdf/10.1119/1.18185)] as

> 
> $$g(n,p) = \frac{(n+p-1)!}{n!(p-1)!}$$ 
> 
> 
> 

The $g$ is the number of degenerate states. Where of course we have that $n = n\_1 + n\_2 + \dots + n\_p$ and that the eigenvalues of the energy are given by 

$$E\_n = E\_{n\_1,n\_2,\dots,n\_p} = \hbar \omega\left(n + \frac{p}{2}\right)$$

How can I derive this formula? In the paper as reference I just didn't understand what he used to show that relation. If this question has an answer that is too big for this format then I'll accept a hint to show that, for $p = 3$ we have that $$g\_n = \frac{1}{2}(n+1)(n+2) \, .$$ Can this can be deduced in a counting way?

Answer: 
The formula can be written as
$$g= \binom{n+p-1}{p-1}$$
it corresponds to the number of [weak compositions](https://en.wikipedia.org/wiki/Composition_(combinatorics)) of the integer $n$ into $p$ integers. It is typically derived using the method of [stars and bars](https://en.wikipedia.org/wiki/Stars_and_bars_(combinatorics)):

You want to find the number of ways to write $n= n\_1 + \cdots + n\_p$ with $n\_j \in \mathbb{N}\_0.$ In order to find this, you imagine to have $n$ stars ($\star$) and $p-1$ bars ($|$). Each composition then corresponds to a way of placing the $p-1$ bars between the $n$ stars. The number $n\_j$ corresponds then to the number of stars in the $j$-th `compartement' (separated by the bars). 

For example ($p=3, n=6)$:

$$ \star \star | \star \star \star | \star \quad \Rightarrow \quad n\_1=2,n\_2=3, n\_3=1$$
$$ \star| \star \star \star \star \star| \quad \Rightarrow \quad n\_1=1,n\_2=5, n\_3=0.$$

Now it is well known that choosing the position of $p-1$ bars among the $n+(p-1)$ objects (stars and bars) corresponds to the binomial coefficient given above.
In general, the basis states of a $p$-dimensional harmonic oscillator containing a total 
$$
n\_1+n\_2+\ldots n\_p=N
$$ 
bosons of a single type is simply $\vert n\_1n\_2\ldots n\_p\rangle$. 

Since the number-preserving operators 
$\{C\_{ij}=a\_i^\dagger a\_j; i,j=1,\ldots,p\}$ span the Lie algebra $u(p)$, all states with $n\_1+n\_2+\ldots n\_p=N$ are in the same $u(n)$ irrep, and the dimension is precisely 
the numbers of ways you can break up $N$ in $p$ non-negative pieces. These irreps are denoted by $(N,0,0,...0\_{p-2})$ in the standard mathematical literature. @Fabian provided a closed form expression for the dimension of type of irrep in his answer. 

An interesting situation occurs if you allow for more than one type of bosons. For instance, one can use two types of bosons and construct (as done [in this paper](https://arxiv.org/pdf/math-ph/9811012.pdf)), $su(3)$ irreps of the type $(\lambda,\mu)$, with the second index non-zero, with $N=\lambda+2\mu$ total excitations. The dimensionality of $(\lambda,\mu)=\frac{1}{2!}(\lambda+1)(\mu+1)(\lambda+\mu+2)$. 

In $su(4)$, general irreps are of the type $(\lambda,\mu,\sigma)$ and the dimension of such an irrep - which requires three types of bosons to construct - is 
$$
\hbox{dim}(\lambda,\mu,\sigma)=\frac{1}{12}(1 + \lambda) (1 + \mu) (1 + \sigma) (2 + \lambda + \mu) (2 + \mu + 
 \sigma) (3 + \lambda + \sigma + \mu)$$.  

Of course this collapses to the expected $(p+3)(p+2)(p+1)/6$ when $\mu=\sigma=0$.

A good place to look up this sort of stuff is the review paper by Richard Slansky, [Group Theory for unified model building](https://cds.cern.ch/record/134739/files/198109187.pdf), where all kinds of dimensionalities are given.