How can a phase transition depend on temperature? This question may not be as simple as it might look like, let me explain what I mean.
A quantum system at temperature $T$ is described by a density operator
$$\rho = \frac{e^{-H/T}}{Z} = \sum_{i} \frac{e^{-E_i/T}}{Z} \left|E_i\right\rangle \left\langle E_i\right|$$
At temperature $T = 0$, the state is the ground state of the system. As temperature is increased, this state is supposed to mix itself with all higher energy states, with high energy states getting more and more weight. However, every state, regardless of its symmetry should always be present in the mixture.
The expectation value of an observable in this state is given by
$$ \left\langle O \right\rangle  = \mathrm{Tr}(\rho O) = \sum_{i} \frac{e^{-E_i/T}}{Z} \left\langle E_i\right| O \left|E_i\right\rangle $$
Given that, how can a physical observable vary in a discontinuous way with respect to temperature? Or, is something wrong in my reasoning?
 A: This example is an illustration of the importance of the thermodynamic limit in phase transitions. If the system has a finite number of degrees of freedom, then the partition function is a finite sum of analytic functions (for $T>0$) and so is analytic. This means that finite systems do not have phase transitions. However an infinite sum of analytic functions need not be analytic, so there can be phase transitions in infinite systems.
We can see this how this works in the Ising model. If there is a finite number of spins, then we must always have the long-time average magnetization zero. Even if the system is magnetized, if there a finite number of spins, there will eventually be a fluke that reverses the magnetization. You can imagine this will be pretty likely for a small number of spins (like $10$ or so) but as the number increases it will become very very unlikely and the system will remain magnetized in one direction for eons before reversing. Still even if it has to be averaged over eons, it will still average to zero.
However, once the system actually is infinite, then there can be true symmetry breaking, as reversal will actually be impossible. Of course all true systems are finite, though some are so large that the reversal time is so long as to be infinite for all practical purposes. When studying phase transitions carefully for finite systems, so-called finite size effects need to be taken into account where if you look close enough the phase transition is actually smoothed out and things don't behave the way that the theory for infinite systems says they should.
