  Fixing the number of particles $N$, the quantum canonical ensemble imposes a
constraint on the occupation numbers of single-particle states. The constraint
particularly hampers the systematic calculation of the partition function and
any relevant thermodynamic expectation value for arbitrary $N$ since, unlike
the case of the grand-canonical ensemble, traces in the $N$-particle Hilbert
space fail to factorize into simple traces over single-particle states. In this
paper we introduce a projection operator that enables a constraint-free
computation of the partition function and its derived quantities, at the price
of an angular or contour integration. Being applicable to both bosonic and
fermionic non-interacting systems in arbitrary dimensions, the projection
operator approach provides closed-form expressions for the partition function
$Z_N$ and the Helmholtz free energy $F_{\! N}$ as well as for two- and
four-point correlation functions. While appearing only as a secondary quantity
in the present context, the chemical potential potential emerges as a
by-product from the relation $\mu_N = F_{\! N+1} - F_{\! N}$, as illustrated
for a two-dimensional fermion gas with $N$ ranging between 2 and 500.
