Boltzmann postulated the existence of a relationship between the total entropy of a thermodynamic system and the total number of microstates $(\Omega)$ in which the system can be found.

\begin{equation} S=kln\Omega \label{ec17} \end{equation}

Since $\Omega=\sum_{j}W_{j}\approx{W_{max}}$, where $W_{max} $ represents the most probable macrostate, which for simplicity we will represent by $W$. Thus, the Boltzmann Postulate leaves us with:

\begin{equation} S=klnW \label{ec18} \end{equation}

where $k$ is the Boltzmann constant $k=1.38\cdot10^{-27}J /K$ and $W$ is the macrostate with the largest number of microstates.

For a system with degeneracy, the number of microstates of the most probable macrostate is given by:

\begin{equation} lnW=NlnN+\sum_{i}N_{ i}lng_{i}-\sum_{i}N_{i}lnN_{i} \label{ec19} \end{equation}

Substituting (~\ref{ec19})into (~\ref{ec18})

\begin{equation} S=kNlnN+k\sum_{i}N_{i}lng_{i}-k\sum_{i}N_{i}lnN_{i} \label{ec20} \end{equation}

Taking natural logarithms in Boltzmann's Law (~\ref{ec16})

\begin{equation} lnN_{i}=lnN-lnq+lng_{i}-\beta\epsilon_{i} \label{ec21} \end{equation}

Substituting into (~\ref{ec20})

\begin{equation} S=kNlnN+k\sum_{i}N_{i}lng_{i}-k\sum_{i}\left(N_{i}lnN-N_{i }lnq+N_{i}lng_{i}-N_{i}\beta\epsilon_{i}\right) \label{ec22} \end{equation}

Splitting the sum:

\begin{equation} S=kNlnN+k \sum_{i}N_{i}lng_{i}-kNlnN+kNlnq+k\sum_{i}N_{i}lng_{i}+k\ beta\sum_{i}N_{i}\epsilon_{i} \label{ec23} \end{equation}

Simplifying gives an equation for entropy

\begin{equation} S=kNlnq+k\beta{E} \label {ec24} \end{equation}

Differentiating S:

\begin{equation} dS=kN\frac{dq}{q}+kEd\beta+k\beta{dE} \label{ec25} \end{equation}

As $ q=\sum_{i}e^{-\beta{\epsilon_{i}}}$ deriving:

\begin{equation} dq=\sum_{i}{-\beta{e^{-\beta{\epsilon_ {i}}}d\epsilon_{i}}}-\sum_{i}\epsilon_{i}e^{-\beta{\epsilon_{i}}}d\beta \label{ec26} \end{equation}

Substituting (~\ref{ec26}) into (~\ref{ec25}):

\begin{equation} dS=-kN\frac{\beta\sum_{i}{e^{-\beta{\epsilon_{ i}}}{d\epsilon_{i}}}}{q}-kN\frac{d\beta\sum_{i}\epsilon_{i}e^{-\beta{\epsilon_{i}}}} {q}+kEd\beta+k\beta\sum_{i}\epsilon_{i}dN_{i}+k\beta\sum_{i}N_{i}d\epsilon_{i} \label{ec27} \end{equation}

In the equation (~\ref{ec27}) the first and last terms are equal, as are the second and third terms. Simplifying:

\begin{equation} dS=k\beta\sum_{i}\epsilon_{i}dN_{i} \label{ec28} \end{equation}

From the point of view of classical thermodynamics $dE=TdS- PdV$. In statistical mechanics $dE=\sum_{i}\epsilon_{i}dN_{i}+\sum_{i}N_{i}d\epsilon_{i}$. Equating the first terms of both equations:

\begin{equation} TdS=\sum_{i}\epsilon_{i}dN_{i} \label{ec29} \end{equation}

Comparing the equation (~\ref{ec28}) and (~\ref{ec29}), it follows that $k\beta=\frac{1}{T}$, solving for $\beta$

\begin{equation} \beta=\frac{1}{kT} \label{ec30} \end{equation}