A theorem in dynamical systems of importance in celestial mechanics and statistical mechanics. The KAM theorem (named after the Russian mathematicians A. N. Kolmogorov and V. I Arnold and the German mathematician J. Moser) states that a non-negligible fraction of orbits in the phase space of a dynamical system remain indefinitely in a specific region of phase space, even in the presence of small perturbations in the system. This result is a step towards resolving the unsolved problem of the stability of motion of planets. The KAM theorem is also of interest to ergodicity in statistical mechanics, since the majority of orbits lead to ergodic motion going through all available phase space. As the number of degrees of freedom of the system increases, the dominance of ergodicity over stable orbits becomes more pronounced.