Degeneracies in 2D Infinite square well In quantum mechanics, a particle of mass $m$ in a 2D infinite square well has an energy spectrum of 
$$E_{n_x,n_y} = \frac{n_x^2 \hbar^2 \pi^2}{2 m L_x^2} + \frac{n_y^2 \hbar^2 \pi^2}{2 m L_y^2}$$
where $n_x$ and $n_y$ are positive integers, and $L_x$ is the width of the well in the $x$ direction, while $L_y$ is the width of the well in the $y$ direction.
If $(L_x / L_y)^2$ is irrational, it is straightforward to show that there are no states with degenerate energy levels by assuming that one exists, and showing that $(L_x / L_y)^2$ can then be written as a ratio of integers, arriving at a contradiction. 
If $L_x / L_y = p/q$ is rational, then choosing $n_x = Np$ and $n_y = q$ gives the same energy as $n_x' = p$ and $n_y' = Nq$ (with integer $N$), and so there do exist degenerate states.
I haven't been able to figure out what happens if $L_x / L_y$ is irrational, but $(L_x / L_y)^2$ is rational. Are degenerate states possible in such a case?
 A: I don't know if you need to find a general rule, but here is a specific example showing that degeneracy is possible: If $L_x/L_y = \sqrt{2}$, then $\{n_x = 2, n_y = 5\}$ is degenerate with  $\{n_x = 6, n_y = 3\}$.
A: Ok, so knowing that degeneracies can exist (thanks Paul G!), I managed to cook up the following.
Let $(L_x / L_y)^2 = p/q$ be rational. Then $L_x / L_y = \sqrt{p/q} = \sqrt{pq} / q \equiv \sqrt{p'} / q$. Or alternatively, we can just write $L_x = L_y \sqrt{p} / q$ by letting $p' \rightarrow p$.
The task is then to find integers $n_x, n_y, n_x', n_y'$ that satisfy
$$
q^2 n_x^2 + p n_y^2 = q^2 n_x'^2 + p n_y'^2.
$$
We can always scale out the $q$ by letting $n_y = N_y q$ and $n_y' = N_y' q$ for integers $N_y$ and $N_y'$, so we are looking for solutions to
$$
n_x^2 + p N_y^2 = n_x'^2 + p N_y'^2.
$$
This can be rearranged to form
$$
n_x^2 - n_x'^2 = p (N_y'^2 - N_y^2)
\\
(n_x + n_x')(n_x - n_x') = p (N_y' + N_y)(N_y' - N_y).
$$
Without loss of generality, choose $n_x > n_x'$ and $N_y' > N_y$, so that all factors here are positive integers. Letting $a = n_x + n_x'$, $b = n_x - n_x'$, $c = N_y' + N_y$ and $d = N_y' - N_y$, we are then looking for solutions to
$$
ab = p cd.
$$
We can always let $a = pA$, so that we are left with solving the system $Ab = cd$. This can always be solved by choosing an $A$ and a $b$ such that at least one of $A$ and $b$ is composite, and constructing $c$ and $d$ by interchanging factors. In order to get $n_x$ etc to be integers, we also need $A$ and $b$ to be both odd or both even. (For further details on these types of systems, see http://www.inference.eng.cam.ac.uk/mackay/abstracts/sumsquares.html.)
The equation $ab = cd$ also arises in the case that $L_x = L_y$ (simply choosing $p = q = 1$), and describes "accidental degeneracies". Hence, for $(L_x / L_y)^2$ rational, accidental degeneracies will also always arise.
So, to summarize:


*

*$L_x / L_y$ rational: degeneracies from both symmetry and accidental degeneracies

*$(L_x / L_y)^2$ rational, $L_x / L_y$ irrational: accidental degeneracies only

*$(L_x / L_y)^2$ irrational: no degeneracies possible

