Why using a sum instead of an integral solves the Ultraviolet catastrophe? Im reading about how using a sum instead of an integral when deriving the Rayleigh-Jeans law (in the equipartion part) solves the ultraviolet catastrophe. basically doing the following replacement:
$$\dfrac{\int \varepsilon e^{-\beta \varepsilon }}{\int e^{-\beta \varepsilon }} \rightarrow \dfrac{\sum \varepsilon _{n}e^{-\beta \varepsilon _{n}}}{\sum e^{-\beta \varepsilon _{n}}}$$
I understand how the two give rise to different expressions which in turn solve our problem. What im looking for is intuition for why this solves our problam.
From my understanding the only problem with Rayleigh-Jeans first derivation is that light with different frequency has different amounts of energy. i.e. $\epsilon = hf$. If this is the case, why does using a sum instead of an integral respect (for lack of a better word) that idea?
 A: You need to work out the integral and the sum
(using $\beta=\frac{1}{kT}$)
to get the average energy of an oscillator mode (with frequency $\nu$).
With the classical theory (with $\varepsilon$ continuous) you get
$$\bar{\varepsilon}_\text{classical}(\nu)
= \frac{\int_0^\infty \varepsilon e^{-\beta\varepsilon}d\varepsilon} 
        {\int_0^\infty e^{-\beta\varepsilon} d\varepsilon}
=\frac{1}{\beta} \tag{1}.$$
So here you found, the average energy is independent of the frequency $\nu$.
With the quantum theory (with Planck's quantization $\varepsilon_n=nh\nu$) you get
$$\bar{\varepsilon}_\text{quantum}(\nu)
=\frac{\sum_{n=0}^\infty \varepsilon_n e^{-\beta\varepsilon_n}} 
      {\sum_{n=0}^\infty e^{-\beta\varepsilon_n}}
=\frac{\sum_{n=0}^\infty nh\nu e^{-\beta nh\nu}} 
      {\sum_{n=0}^\infty e^{-\beta nh\nu}}
=\frac{h\nu}{e^{\beta h\nu}-1} \tag{2}.$$
So here you found, the average energy is approximately
$\frac{1}{\beta}$ for small frequencies $\nu$
(i.e. the same as from the classical theory).
But for large frequencies $\nu$ the average energy
quickly approaches zero.

The next step is to calculate the total energy per volume ($E$) of all oscillator
modes by integrating the frequency-specific average energy from (1) or (2)
over all possible frequencies $\nu$ (from $0$ to $\infty$).
Using the number of modes per frequency range and per volume,
$g(\nu)=\frac{8\pi\nu^2}{c^3}$ (according to Blackbody radiation)
you get the following results.
With the classical average energy from (1):
$$E_\text{classical} = \int_0^\infty g(\nu) \bar\varepsilon_\text{classical}(\nu)\ d\nu
= \int_0^\infty  \frac{8\pi\nu^2}{c^3} \frac{1}{\beta}\ d\nu
= \infty \tag{3}$$
You immediately see, the integral diverges because of the
contribution at large (i.e. ultraviolet) frequencies,
in gross contradiction with the experimentally observed reality.
This is the well-known failure of classical theory,
known as the "ultraviolet catastrophe".
With the quantum average energy from (2) :
$$\begin{align}
E_\text{quantum} &= \int_0^\infty g(\nu) \bar\varepsilon_\text{quantum}(\nu)\ d\nu
= \int_0^\infty  \frac{8\pi\nu^2}{c^3} \frac{h\nu}{e^{\beta h\nu}-1}\ d\nu \\
&= \frac{8\pi}{c^3h^3\beta^4} \underbrace{\int_0^\infty\frac{x^3}{e^x-1}dx}_{=\pi^4/15}
\end{align} \tag{4}$$
Here you see, the integral stays finite, because the integrand
quickly approaches $0$ at large frequencies $\nu$.
By evaluating the integral you arrived at the Stefan-Boltzmann law, in accordance with experimentally observed reality.
A: Planck essential introduced a cutoff, so that the result does not diverges.
Spectral radiance in Rayleigh-Jeans law is:
$$
B_\lambda(T)=\frac{2ck_BT}{\lambda^4},
$$
which becomes infinite as $\lambda\rightarrow 0$ - this is what one calls ultraviolet catastrophe, since we are talking about shorter wavelengths (ultraviolet, in respect to the visible spectrum).
Planck's law is
$$
B_\lambda(T)=\frac{2hc^2}{\lambda^5}\frac{1}{e^{hc/(\lambda k_B c)}-1},
$$
which at small wave-lengths behaves as
$$
B_\lambda(T)=\frac{2hc^2}{\lambda^5}e^{-hc/(\lambda k_B c)}
$$
(Wien's law.)
The exponent vanishes faster than $\lambda^5$ in the denominator, and the result remains finite.
Note that for $hc/\lambda\ll 1$ the Planck's equation reduces to the Rayleigh-Jeans' one.
Planck could have postulate simply that the wave length cannot be smaller than specific smallest wavelength, $\lambda>\lambda_0=hc$, and thus obtain finite results. His approach was initially just a bit more mathematically sophisticated way of introducing the cutoff. Now of course, introducing cutoffs has become a science, known as renormalization group.
A: This is mostly a question about math and less about physics. In essence, it is the difference between discrete count and a continuous count:
For simplification, let’s consider just the linear part of the numerator. The discrete count is
$\sum_{n=0}^\varepsilon n=\frac{\varepsilon(\varepsilon+1)}{2}=\frac{\varepsilon^2}{2}+\frac{\varepsilon}{2} \tag{1}$
Using Gauss summation formula. The smooth (continuous) count is
$\int_{0}^{\varepsilon} x \mathrm{d}x=\frac{\varepsilon^2}{2} \tag{2}$
The discrete count includes an extra linear element that is missing in the continuous count. This extra term comes from the excess “area” atop of the distribution function (check the image below).

Discrete counting includes an additional term of $x$. PS: This is just an example. To calculate the actual results one must use the corresponding distribution formulas.
A discrete sum includes an excess “error” that the differentiation process eliminates by making the size of the package ($\Delta x$) infinitesimally small. In the end a different result is achieved when comparing integration and summation. The important part here is that both, the sum and the integral converge or diverge together. Meaning that there is a sum associated to an integral even though they may be different. In the current case, the integral is
$$\frac{\int_0^\infty \varepsilon e^{-\beta\varepsilon}d\varepsilon} 
        {\int_0^\infty e^{-\beta\varepsilon} d\varepsilon}
=\frac{1}{\beta} \tag{3}.$$
And the sum is
$$\frac{\sum_{n=0}^\infty n e^{-\beta n}} 
      {\sum_{n=0}^\infty e^{-\beta n}}
=\frac{1}{e^{\beta}-1} \tag{4}.$$
So, the same setup has 2 valid mathematical solutions. However, experimentally we get a set of data points that are better fitted with  $(4)$ and we are oriented to take that choice. An important physical consequence from this choice (which is obvious from the counting name) is that energy must be made up of discrete packages or quantum.
