Degeneracy of energy levels for a "particle in a rectangular three-dimensional box" In class we studied the degeneracy of energy level for a particle in various "boxes", including a rectangular three-dimensional one. Whenever we tried to quantify the degeneracy of the various energy levels, we did so "manually", by counting the amount of ways one could reach said energy level through different combinations. My question is whether there is a formula available (in this case for a rectangular three-dimensional box), that would obviate the need for manual counting?
 A: Not really.  The energies of a particle in a box of side lengths $L \times \alpha L \times \beta L$ are
$$
E = \frac{h^2}{8 m L^2} \left( n_x^2 + \frac{n_y^2}{\alpha^2} + \frac{n_z^2}{\beta^2}\right).
$$
The question of the degeneracy is then really a question of number theory: Under what circumstances are two distinct triplets $(n_x, n_y, n_z)$ and $(m_x, m_y, m_z)$ such that
$$
n_x^2 + \frac{n_y^2}{\alpha^2} + \frac{n_z^2}{\beta^2} = m_x^2 + \frac{m_y^2}{\alpha^2} + \frac{m_z^2}{\beta^2}?
$$
This is a hard problem and I'm not sure that there is a universal answer to it.  We can note, however, the following:

*

*If the squared side lengths of the box are not rational multiples of each other (i.e., $\alpha^2,\beta^2 \not\in \mathbb{Q}$ and $\alpha^2/\beta^2 \not \in \mathbb{Q}$), then (I think) there cannot be any distinct solutions.  The proof is pretty straightforward for a 2-D box, and I would be shocked if it doesn't carry over to 3-D, but I will admit I don't see a simple argument for it.

*In the case where $\alpha = \beta = 1$, this reduces to the question of how many ways there are to write a given integer as the sum of three (non-zero) squares.  Some discussion and useful links on this topic can be found over on Math.SE:  Determining the number of ways a number can be written as the sum of three squares. In addition, we are always guaranteed at least three-fold degeneracy of any levels for which $n_x = n_y \neq n_z$, and at least six-fold degeneracy of any levels for which all three $n$'s are distinct.

A: 
My question is whether there is a formula available (in this case for
a rectangular three-dimensional box), that would obviate the need for
manual counting?

The enery levels for such a box are given by:
$$E_{n_x,n_y,n_z} = \dfrac{h^{2}}{8m}\left(\dfrac{n_{x}^{2}}{L_x^{2}} + \dfrac{n_{y}^{2}}{L_y^{2}} + \dfrac{n_{z}^{2}}{L_z^{2}}\right)$$
where $n_x$, $n_y$ and $n_z$ are the quantum numbers.
From there the degeneracy can be easily gleaned.
Sroll down in the link for degeneracy in a 3D cube and for $L_x \neq L_y \neq L_z$.
