# Variables of the Canonical Ensemble

The Canonical Ensemble partition function depends on variables including the composition (N), volume (V) and temperature (T) of a given system, where the above partition function equation is still valid with $Q_{N,V,T}=Q(N,V,T)$.
The partition function of the canonical ensemble is defined as the sum over all states of a particular system involving each states respective energies, and represented by the following equation,
$Q=\sum _{j}\exp \left({\frac {-E_{j}}{k_{B}T}}\right)$
In this equation, $k_{B}$ represents the Boltzmann Constant with a value of $k_{B}=1.3806503\times 10^{-23}JK^{-1}$, T represents the temperature in kelvin and $E_{j}$ is the energy at state j.

## Internal Energy

The partition function can also be related to all state functions from classical thermodynamics, such as U, A, G and S. The ensemble average of the internal energy in a given system is the thermodynamic equivalent to internal energy, as stated by the Gibbs postulate, and defined by,
$U=\langle E\rangle ={\frac {\sum _{j}E_{j}\exp \left({\frac {-E_{j}}{k_{B}T}}\right)}{Q}}$
Where the variable Q here represents the partition function term. For a canonical ensemble, the internal energy can be derived from the above equation by considering the derivative of Q with respect to T,
    ${\begin{alignedat}{7}{\frac {\partial}{\partial {T}}}Q={\frac {\partial}{\partial {T}}}\sum _{j}\exp \left({\frac {-E_{j}}{k_{B}T}}\right)&\\=\sum _{j}{\frac {\partial}{\partial {T}}}\exp \left({\frac {-E_{j}}{k_{B}T}}\right)&\\=\sum _{j}\exp \left({\frac {-E_{j}}{k_{B}T}}\right){\frac {\partial}{\partial {T}}}\left({\frac {-E_{j}}{k_{B}T}}\right)&\\={\frac {E_{j}}{k_{B}}}{\frac {1}{T^{2}}}\exp \left({\frac {-E_{j}}{k_{B}T}}\right)&\\\end{alignedat}}$
    ${\begin{alignedat}{7}{\frac {\partial}{\partial {T}}}Q=\sum _{j}{\frac {E_{j}}{k_{B}}}{\frac {1}{T^{2}}}\exp \left({\frac {-E_{j}}{k_{B}T}}\right)={\frac {1}{k_{B}T^{2}}}\sum _{j}E_{j}\exp \left({\frac {-E_{j}}{k_{B}T}}\right)&\\={\frac {Q}{Q}}{\frac {1}{k_{B}T^{2}}}\sum _{j}E_{j}\exp \left({\frac {-E_{j}}{k_{B}T}}\right)&\\=Q{\frac {1}{k_{B}T^{2}}}{\frac {\sum _{j}E_{j}\exp \left({\frac {-E_{j}}{k_{B}T}}\right)}{Q}}&\\={\frac {Q}{k_{B}T^{2}}}{\frac {\sum _{j}E_{j}\exp \left({\frac {-E_{j}}{k_{B}T}}\right)}{Q}}={\frac {Q}{k_{B}T^{2}}}\langle E\rangle \end{alignedat}}$
Rearranging this resulting equation for $\langle E\rangle$ yields,
$\langle E\rangle =k_{B}T^{2}{\frac {1}{Q}}\left({\frac {\partial {Q}}{\partial {T}}}\right)_{N,V}$
and from the Gibbs Postulate,
$U=k_{B}T^{2}\left({\frac {\partial {\textrm {ln}}Q}{\partial T}}\right)_{N,V}$

## Helmholtz Energy

The Helmholtz Energy, or Helmholtz Free Energy, of a Canonical Ensemble represents the amount of work and energy obtainable by a certain closed system under constant concentration, volume and temperature. The expression for A utilizes both the internal energy and entropy of the system, and is derived by,
$A=U-TS$
Where A is the Helmholtz Energy term, U represents the internal energy and S represents the entropy of the system being studied. Substituting the per-determined values for the canonical ensemble,
$A=\langle E\rangle -T\left({\frac {\langle E\rangle }{T}}+k_{B}\ln {Q}\right)$
$A=\langle E\rangle -\langle E\rangle -k_{B}T\ln {Q}$
$A=-k_{B}T\ln \left(Q\right)$
Q represents the partition function for this particular system, and is proportional to the absolute free energy. Thus, an increase in $\ln(Q)$ will occur with an increase in the number of total accessible states, and a more negative free energy.

## Entropy

The Gibbs definition of Entropy is described by,
$S=-k_{B}\sum _{j}P_{j}\ln {P_{j}}$
where $P_{j}$ represents the Probability of being in state i and described by the weight of the state divided by the sum of all possible weights, such as,
$P_{i}={\frac {\exp \left({\frac {-E_{i}}{k_{B}T}}\right)}{\sum _{j}\exp \left({\frac {-E_{j}}{k_{B}T}}\right)}}$
and thus large probabilities of multiple states correlate with large values of S. By using the above Gibbs definition, the entropy of a Canonical Ensemble (NVT) can be derived, in terms of Q, to yield the following expression,
$S={\frac {\langle E\rangle }{T}}+k_{B}\ln {Q}$ or $S=k_{B}T\left({\frac {\partial {\ln {Q}}}{\partial {T}}}\right)_{N,V}+k_{B}\ln {Q}$
The value of Q in this equation can also be represented as $Q={\frac {q^{n}}{N!}}$, where q is equivalent to the partition function of the molecules, with N representing the number of molecules, in the system.
The partition function is also represented by the denominator of the probability term for a certain state, given by the following,
$P_{i}={\frac {\exp \left({\frac {-E_{j}}{k_{B}T}}\right)}{Q}}$

## Chemical potential

The Chemical Potential, μ, represents the change in the Helmholtz free energy when an additional particle is added to the canonical ensemble system. A heterogeneous system represents a system containing more than one type of gas and the expression for the chemical potential here is μi, where i represents each differing species. This term is derived from Helmholtz free energy, A, with respect to number of molecules for a certain species i. Thus,
$\mu _{i}=\left({\frac {\partial {A}}{\partial {N_{i}}}}\right)_{T,V,N}$
And utilizing the above Helmholtz expression, the following can be derived,
$=\left({\frac {\partial-k_{B}T\ln {Q}}{\partial {N_{i}}}}\right)_{T,V,N}$
$=-k_{B}T\left({\frac {\partial {\ln {\frac {q_{i}\left(V,T\right)^{N_{i}}}{N_{i}!}}}}{\partial {N_{i}}}}\right)_{T,V,N}$
$=-k_{B}T\left({\frac {\partial {\ln {q_{i}\left(V,T\right)^{N_{i}}}}-\ln {N_{i}!}}{\partial {N_{i}}}}\right)_{T,V,N}$
$=-k_{B}T\left({\frac {\partial {N_{i}\ln {q_{i}\left(V,T\right)}}-N_{i}\ln {N_{i}}+N_{i}}{\partial {N_{i}}}}\right)_{T,V,N}$
$=-k_{B}T\left(\ln {q_{i}}\left(V,T\right)-\ln {N_{i}}-1+1\right)_{T,V,N}$
$\mu =-k_{B}T\ln\left({\frac {q_{i}\left(V,T\right)}{N_{i}}}\right)$
This definition helps describe the change in the Helmholtz free energy with a changing system composition, such as a reaction forming and/or consuming certain molecules in a system.

## Heat Capacity

In this section, we will complete the deviation of heat capacity in terms of the partition function Q.
$Q={\displaystyle \sum _{j}\exp(-E_{j}/k_{B}T)}$
According to the Gibbs postulate, the ensemble average is equal to the average internal energy, U
$U=\langle E\rangle ={\frac {\displaystyle \sum _{j}E_{j}\exp(-E_{j}/k_{B}T)}{Q}}$
Substitute equation for partition function into ensemble average.
$\langle E\rangle ={\frac {\displaystyle \sum _{j}E_{j}\exp(-E_{j}/k_{B}T)}{\displaystyle \sum _{j}\exp(-E_{j}/k_{B}T)}}$
$\beta ={\frac {1}{k_{B}T}}$ , which is the Boltzmann's Constant.
Now substituting $\beta$ you get,
$\langle E\rangle ={\frac {\displaystyle \sum _{j}E_{j}\exp(-\beta E_{j})}{\displaystyle \sum _{j}\exp(-\beta E_{j})}}$
$C_{v}=\left({\frac {d\langle E\rangle }{dT}}\right)$, which is the heat capacity.
To find the equation of heat capacity using Statistical Mechanics we first have to differentiate the ensemble average with respect to $\beta$.
$\left({\frac {d\langle E\rangle }{dT}}\right)_{N,V}={\frac {\displaystyle \sum _{j}E_{j}\exp(-\beta E_{j})}{\displaystyle \sum _{j}\exp(-\beta E_{j})}}$ $={\frac {-1}{Q}}\left({\frac {dQ}{d\beta }}\right)_{N,V}$
Therefore, the equation of heat capacity with respect to the partition function Q is,
$C_{v}={\frac {-1}{Q}}\left({\frac {dQ}{d\beta }}\right)_{N,V}$