The ideal gas law is a relationship between the pressure $P$, the volume $V$, and temperature $T$ of a gas. The equation is
$PV = nRT$
where $n$ is the amount of substance of the system measured in moles (mol), and $R$ is the universal gas constant of 8.314472 $\frac{\mbox{J}}{\mbox{K mol}}$.
A mole of gas contains as many elementary entities (e.g., atoms, molecules, ions, electrons) as 12 grams of carbon 12. Consequently, one mole of carbon has a mass of 12 grams. Avogadro's number is the number of elementary entities. That value is $6.022 \times 10^{23}$.
It turns out that the mass in grams of a mole of a gas is roughly its atomic mass number. Because the earth's atmosphere is predominantly $\mbox{N}_2$ (amu = 28) and $\mbox{O}_2$ (amu = 32), the mass of a mole of atmosphere is approximately 28.9 grams or 0.0289 kg. So, to determine the mass $m$ (in kg) in a $n$ moles of air, multiply $n$ times 0.0289. That is, $m = 0.0289*n$ or $\displaystyle{n=\frac{m}{0.0289}}$.
The original equation can be adjusted using these facts to give a gas law, specifically for the earth's atmosphere, based on mass. That is
$PV = \frac{m}{0.0289}(8.314472) T $
$PV = \frac{8.314472}{0.0289}mT$
$PV = 287mT$
$P = 287\frac{m}{V}T$
$P = 287\rho T$
The pressure $P$ in the equation above is measured in pascals, or newtons per square meter. Recall that 1 millibar (mb) is 100 pascals. Consequently, the last equation can be changed to give the pressure in mb
$P=2.87\rho T$
The equation states that if density $\rho$ is constant, then the temperature and the pressure of the system rise and fall proportionally. Simply stated, we say that temperature and pressure are directly proportional.
The last equation may be solved for density $\rho$ in terms of pressure and temperature. The result is
$\rho = \frac{P}{2.87T}$
The equation above indicates that if the pressure of the system remains constant, and the temperature increases, then the density $\rho$ must decrease. If the temperature decreases, the density must increase.
The last equation may be rearranged to give
$T = \frac{P}{2.87\rho}$
Either of the last two equations establish the general relationship between temperature and density when pressure is held constant. That is, density and temperature are inversely proportional.
If temperature $T$ is held constant in the equation
$P = 2.87\rho T$,
then one can see that pressure and density are directly proportional.