# How are canonical and grand canonical ensemble related in the framework of large deviations theory?

I have a toy model of $\rho N$ particles in $N$ boxes and Hamiltonian $H = \sum_{i=1}^N\log{(1+n_i)}$

$$P(\underline{n})=\frac{1}{Z(T,\rho,N)}e^{-H(\underline{n})/T}$$

The canonical partition function is obtained by summing $e^{-H \left (\underline{n}\right )/T}$ over all the states with $\rho N$ particles.

And here is the first sentence I don't understand in my notes:

this corresponds to looking at large deviations where $\langle n_i\rangle = \rho$ ...

What corresponds to what? Large deviations from what?

Then it says a simpler way to study the system would be to introduce the grand canonical ensemble and the chemical potential.

$$\mathcal{Z}(T,\mu,N) = \sum_{M=0}^{+\infty} e^{-M\mu/T} Z(T,\rho = M/N,N)$$

removing the restriction on the density.

And there is this second sentence I can't understand:

The grand canonical trick is biasing a priori probabilities ($\mu = 0$) on the distribution of particles in each box to recover states with a given density as large deviations, i.e. as typical outcome under the biased distribution

What are the a priori probabilities?

Canonical ensemble can be recovered as large deviation of the Canonical ensemble itself at $T \to \infty$ and Grand Canonical as large deviation of the Canonical for $\mu \to \infty$