We study a two-dimensional isotropic harmonic oscillator with a hard-wall confining potential in the form of a circular cavity defined by the radial coordinate ρ0. When
one can normalise the wave function by obtaining polynomial solutions and, in this way, the discrete energy spectrum of the system in an analytical closed form. On the other hand, for
, the radial coordinate becomes defined in the range 0 < ρ < ρ0 and the energy spectrum can only be numerically obtained. The thermodynamics of the system can nevertheless be computed and the results compared to the well-studied free oscillator. For instance, the specific heat of the confined oscillator presents a peak and the corresponding limiting value at high temperatures deviates from the expected Dulong–Petit law value. In addition, there is a particular limiting case where a discrete spectrum of energy of the confined oscillator can be obtained in an analytical form. In this case, not only the energy spectrum but also its thermodynamics are comparable to the exact results, even for rather large values of the cavity size.