Thermodynamics of 
d
-dimensional Schwarzschild black holes in the canonical ensemble

We study the thermodynamics of a $d$-dimensional Schwarzschild black hole, also known as a Schwarzschild-Tangherlini black hole, in the canonical ensemble. This generalizes York's formalism, which has been initially applied to four dimensions and later to five dimensions, to any number $d$ of dimensions. The canonical ensemble, characterized by a cavity of fixed radius $r$ and fixed temperature $T$ at the boundary, allows for two possible black hole solutions in thermal equilibrium, a smaller black hole and a larger black hole. In four and five dimensions, these solutions have a direct exact form, whereas in an arbitrary number of dimensions, one is compelled to resort to approximation schemes or numerical calculations. From the Euclidean action and the path integral approach, we obtain the free energy, the thermodynamic energy, the thermodynamic pressure, and the entropy, of the black hole plus cavity system. The entropy of the system is given by the Bekenstein-Hawking area law. The analysis of the heat capacity of the system shows that the smaller black hole is in unstable equilibrium and the larger black hole is in stable equilibrium. The $d$-dimensional photon sphere radius divides the stability criterion. Indeed, if the cavity's radius is larger than the photon sphere radius, and so the black hole is small, the system is unstable, if the cavity's radius is smaller than the photon sphere radius, and so the black hole is large, the system is stable. To study perturbations on the system, a generalized free energy function is obtained that also allows one to understand the possible phase transitions between classical hot flat space and the black holes. The Buchdahl radius, that appears naturally in the general relativistic study of star structure, also shows up in our context; the free energy is zero when the cavity's radius has the $d$-dimensional Buchdahl radius value. Then, if the cavity's radius is larger than the Buchdahl radius, classical hot flat space phase cannot make a phase transition to a black hole phase, and if smaller, classical hot flat space can nucleate a black hole. The roles of both the photon sphere and the Buchdahl limit are present for every dimension $d$, indicating that, besides their known role in dynamics, these radii also play a role in the thermodynamics of gravitational systems. The close link between the canonical analysis performed and the direct perturbation of the path integral is also pointed out. Since hot flat space is a quantum system made purely of gravitons, if only gravitation is considered, it is of great interest to compare the $d$-dimensional free energies of quantum hot flat space and the stable black hole to find for which ranges of $r$ and $T$, the quantities that characterize the canonical ensemble, one phase predominates over the other. Phase diagrams for a few different dimensions are displayed. The density of states at a given energy is found through an inverse Laplace transformation giving back the entropy of the stable black hole. Several side calculations and further deliberations are performed, namely, the calculation for the approximate expressions for the canonical ensemble black hole horizon radii, a brief study of the photon orbit radius and the Buchdahl radius in the $d$-dimensional Schwarzschild solution, a connection to the thermodynamics of thin shells in $d$ spacetime dimensions which are systems that are also apt to a rigorous thermodynamic study, a presentation of quantum hot flat space in $d$ spacetime dimensions as a thermodynamic system, an analysis of classical hot flat space in $d$ spacetime dimensions as a product of quantum hot flat space with the black hole transitions and the corresponding phase diagrams for a few different dimensions, and a synopsis with the relevance of the work. It is still worth mentioning that the comparison of the thermodynamics of $d$-dimensional Schwarzschild black holes and classical hot flat space in the canonical ensemble with the thermodynamics of spherical thin shells in $d$ dimensions yields a striking direct matching between the two systems, most notably that the photon sphere radius appears here as a thermodynamic stability divisor in both systems, and the Buchdahl radius that appears on thermodynamic grounds for canonical black holes appears also as a thermodynamic and as a dynamical radius for thin shells.