# Conserved Quantities (Stat Mech Part 2)

As before, we will consider particles moving in boxes in an abstract and semi-formal way.

Imagine we have two types of particle, red and blue, in a box. Imagine they can change colour freely, and as before let's forget as much as possible. Our knowledge over particle states now looks like:

$[\mathrm{Position}] \sim \mathrm{Uniform over inside of box}$  
$[\mathrm{Colour}] \sim \mathrm{Uniform over} \{\mathrm{Red}, \mathrm{Blue}\}$

For each particle:

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/58d3d4b3b74ae6c9fbf7d12f0b0ee2e3006e826baea6a38c.png)

Let's connect these particles to a second box, but also introduce a **colour-changing gate** to the passage between the boxes. Particles can only go through the gate if they're willing to change from red to blue, and only go back if they change colour in the opposite direction.

Without further rules, lots of particles will approach the gate. The blue ones will be turned away, but the red ones happily switch to blue as they move into the second box, and ... promptly change back to red. We've not done anything interesting. We need a new rule: particles can't change colour without a good reason, they must **swap** colour by bumping into each other.

Now the particles that end up the second box must remain blue. Lets think about what happens when we start the box off. Unfortunately this question as posed is un-answerable, because we've introduced a **system** **conserved quantity**. Any time we do this, we must specify how much of the quantity is in the system. As an exercise, think about what the conserved quantity is.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/8ccead1184c7ddcb881d0ba55000ebdb3c9ba673603d3705.png)

Marvel at my incredible artistic skills while you ponder this

...

The conserved quantity is:

$[\mathrm{Number of Red Particles in Box 1}] + [\mathrm{Number of Particles in Box 2}]$

Or, conversely we could also consider:

$[\mathrm{Number of Blue Particles in Box 1}]$

To be constant, since the number of particles is constant. Writing things out like this also makes the states of the system more explicit, so we can reason about the system more accurately. We expect the constant number of blue-and-box-1 particles to be distributed evenly throughout box 1, and we expect the constant number of red-or-box-2 particles to be distributed evenly throughout boxes 1 and 2. If (as above) both boxes are equally-sized, this caches out to the following rule:

For $n$ particles starting in box 1, of which $m$ start off red, we expect to end up with $n - m$ blue particles in box 1, $m/2$ red particles in box 1, and $m/2$ blue particles in box 1.

Remember, this only works because of the conserved quantity we have induced in our system.

Global Conservation
===================

Now lets imagine that the walls of box 1 are somewhat permeable. Particles on either side cannot cross, but they can swap red-ness with external particles. We've now swapped our locally conserved quantity for a **globally-conserved quantity**.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/5ef42067a6602f3719864cb445d42e6604953ea58365f483.png)

In this case, we can't eyeball things anymore. We have to go back to the maths of entropy. We can write the entropy of our system $H_{sys}$ as the sum of the entropy of each individual particle. The entropy of each particle can then be written as a sum of the entropy arising from our uncertainty over the three states $b1, r1, b2$ (denoting colour and box) plus the entropy coming from our uncertainty over the position of a particle within a given box, which is constant.

$H_{sys} = n\big[-p_{b1} \ln p_{b1} - p_{r1} \ln p_{r1} - p_{b2} \ln p_{r2} + H_{box}\big] $

Thanks to our previous calculation, we can write all of these in terms of a single probability $p$, which we will choose to be $p_{r1} + p_{b2} = 1-p_{b1} = 2 p_{r1} = 2 p_{b2}$.

$H_{sys} = n \big[ - \frac p 2 \ln \frac p 2 - \frac p 2 \ln \frac p 2 - (1-p) \ln (1-p) + H_{box} \big ]$

$H_{sys} = n \big[ - p \ln p - (1-p) \ln (1-p) + p \ln 2 + H_{box}\big]$

What we actually care about, as it turns out, is the derivative of entropy with respect to this parameter:

$\frac{\mathrm d H_{sys}}{\mathrm d p} = n\big[- \ln p + \ln(1-p) + \ln 2\big]$

Which is almost the same as the derivative of entropy in a simple two-state system where $p$ is the probability of being in one of these states. In a way, we do have a two state system, where the states are $[\mathrm{Blue}, 1], \big[[\mathrm{Red}, 1] \lor [\mathrm{Blue}, 2]\big]$. The only difference is that for particles in the state $\big[[\mathrm{Red}, 1] \lor [\mathrm{Blue}, 2]\big]$, there is an extra bit of uncertainty over position, hence the $\ln 2$ term. We can think of this system in two equivalent ways:

1.  A three-state system with states $[\mathrm{Blue}, 1], [\mathrm{Red}, 1], [\mathrm{Blue}, 2]$, where $\mathrm P(\mathrm {Red}, 1) = \mathrm P(\mathrm{Blue}, 2)$. The entropy is just the entropy calculated over all three states.
2.  A two-state system with states $[\mathrm{Blue}, 1], \big[[\mathrm{Red}, 1] \lor [\mathrm{Blue}, 2]\big]$ with no restrictions on the distribution other that $p$. The entropy is calculated over two states but an extra $p\ln 2$ term is added to correct for the intrinsically higher entropy of state 2.

The second one is most commonly done in stat mech, when we have very complex systems. In fact, we have already seen this concept in the last post when we considered the entropy of a particle distributed over two boxes of different size.

Derivatives In Terms of Red-ness
--------------------------------

Our previous calculation found the derivative $H_{sys}$ in terms of $p$. This is a bad choice, since we don't want to think of changing $p$ directly. Instead we have to think in terms of changing $n_{r1 \lor b2}$ which for short-hand I'll call $m$ as before. Because $m = p \times n$, and $n$ is constant, we can just divide by $n$ to get the derivative of $H_{sys}$ in terms of $m$.

$\frac{\mathrm d H_{sys}}{\mathrm d m} = - \ln p + \ln(1-p) + \ln 2$

This is even better, since it doesn't depend on $m$ at all! Now we must consider the external entropy $H_{ext}$. Lets say we have $n_{ext} \to \infty$ particles outside the box, which have a probability $q$ of being red. If $H_{out}$ is the entropy coming from the entire exterior of the box, and this is equal between red and blue external particles, we can find the derivative of $H_{ext}$ with respect to $q$ quite simply:

$\frac{\mathrm d H_{ext}}{\mathrm d q} = n_{ext} \big[ - \ln q + \ln(1-q) \big ]$

From which follows the derivative in terms of the number of red particles outside the box $m_{ext} = n_{ext} \times q$:

$\frac{\mathrm d H_{ext}}{\mathrm d m_{ext}} = - \ln q + \ln(1-q)$

The important part here is that, as $n_{ext} \to \infty$, the derivative of $H_{ext}$ with respect to $m_{ext}$ remains constant. For sufficiently large $n_{ext}$, we can totally ignore the change in $q$ when $m_{ext}$ changes. Finally, if we assume that $m + m_{ext} $ is a constant, we can write down the following derivative:

$\frac{\mathrm d H_{tot}}{\mathrm d m} = \frac{\mathrm d H_{sys}}{\mathrm d m} - \frac{\mathrm d H_{ext}}{\mathrm d m_{ext}} = - \ln p + \ln (1-p) + \ln 2 + \ln q - \ln (1-q)$

If we want to find the maximum entropy, i.e. **forget as much as possible** then we want to set this to zero, which  gives the following relation:

$\ln p - \ln (1-p) = \ln 2 + \ln q - \ln (1-q)$

$\ln \frac p {1-p} = \ln \frac{2q}{1-q}$

$\frac p {1-p} = \frac {2q}{1-q}$

$p = \frac{2q}{q+1}$

Normally it's not so easy to solve the relevant equation in terms of obvious parameters of the external world like $q$. In most cases, we work out the solution in terms of the derivative:

$\frac{\mathrm d H_{ext}}{\mathrm d m_{ext}}$

Which is often easier to measure than you might think! But you'll have to wait for the next post for that.

Conclusions
===========

1.  When we induce a conserved quantity in our system, we must specify how much of that quantity is present. 
2.  When we look at a globally conserved quantity, we must instead specify the derivative of the total external entropy $H_{ext}$ with respect to the total external amount of that quantity.
3.  We can switch between more micro-level views of individual states, and more macro-level views of states with "intrinsic" entropy.