The ultraviolet catastrophe results from the equipartition theorem of classical statistical mechanics which states that all harmonic oscillator modes (degrees of freedom) of a system at equilibrium have an average energy of (1/2) kT.
************************************
Whoa!
I’ve been watching too many Feynman lectures. I don’t pretend to fully understand it, and certainly can’t do the math, but he makes it pretty accessible.