I'm trying to prove that, for a gas, as temperature $T$ increases, density $\rho$ decreases in constant pressure $P$ and/or constant volume $V$. My initial motivation was this: Imagine a cube where there is a hot air zone and a cold air zone. If you wanted to heat up the cold air zone and make it less dense, would that go to the top of the cube? I got to the conclusion that this would only be possible if volume or pressure were constant because of Boyle's Law which states that $P \propto \frac{1}{V}$ at constant mass $m$ and temperature $T$. So, at least I wanted to know that if one of these two were constant then what would have to occur for this to happen.
If pressure $P$ is constant, my calculations are:
We know that $\rho=\frac{m}{V}$.
Therefore, rearranging this equation at constant $P$ and $T$ we get that $V =\frac{m}{\rho}$, which implies $V \propto \frac{1}{\rho}$
We also know that according to Charles' Law, $V \propto T$ when $P$ and $n$ is constant.
We can combine these two relationships:
- From $V \propto \frac{1}{\rho}$ we get $V=k_1 \cdot \frac{1}{\rho}$, where $k_1$ is a proportionality constant.
- From $V \propto T$ we get $V=k_2 \cdot T$, where $k_2$ is a proportionality constant.
- Equating the two expressions for $V$ we get $k_1 \cdot \frac{1}{\rho} = k_2 \cdot T$
- Rearranging to express $\rho$ in terms of $T$: $\rho \propto \frac{1}{T}$
Therefore, at constant pressure $P$ the density $\rho$ of a gas is inversely proportional to its temperature $T$.
We can also deduce this in $\rho = \frac{PM}{RT}$ from $PV=nRT$ and $\rho = \frac{m}{V}$
If volume $V$ is constant, one way to change the density of the gas would be to change the mass that it has. We can see this from the density formula. If volume $V$ and mass $m$ are both constant then $\rho_1=\rho_2$, which would mean that no matter the temperature of the gas, it would not change its density. If mass can vary then we could achieve greater density with an increase in mass as $\rho \propto m$. In this case, the gas with less mass would go to the top of the cube mentioned in the beginning.
In conclusion, if pressure is constant we can simply increase the temperature to decrease the density ($\rho \propto \frac{1}{T}$) but if volume is constant then we can decrease the mass of one of both gases so that its density decreases ($\rho \propto m$). My final remark is that it boggles my mind that, according to my calculations and understanding of the situation, I could have two gases with constant masses in a constant volume cube and heat up the colder gas and as the mass doesn't change it will remain at the bottom as its density doesn't change either thus having a hotter gas at the bottom. Am I missing something? I am also unsure about the claims I make as different physical quantities ($T$, $m$, $n$, etc.) are constant in the various relationships I am using to demonstrate certain concepts, does that suppose a problem?
P.S. I have been researching this and what could possibly happen is thermodynamic equilibrium but, if you think about it, normally in a room (supposing isolation) the temperature is not uniform along its whole volume, so I am still unsure as to what would really happen. Also, the problem might change a bit if we take gravity or not into consideration.