Determine the mole fraction Under certain conditions, the well-known fertilizer $\ce{NH4NO3 (s)}$ explodes according to the following balanced reaction:

$\ce{2NH4NO3 (s) -&gt; 2N2 (g) + 4H2O (g) + O2 (g)}$

Exactly 8 g of $\ce{NH4NO3}$ is placed in a 1.18 L constant-volume container containing dry air at 56.01 kPa and 15 ºC. The explosive reaction goes to completion and the temperature rises to 527 ºC. The container remains intact after the explosion. Determine the mole fraction of N2 in the gas phase after the explosion.

Data: Assume that the composition of dry air is 79% N2 and 21% O2 by volume.

So I know that $\ce{N2}$ takes 0.9322 L of volume. I calculated it by 0.79*1.18 = 0.09322 

The only thing that I don't know is the number of moles, so do I just use the formula of ideal gas law which is $PV = nRT$,
 P = 0.5528 atm( 56.01kPA) V = 0.09322

However, which temperature should I use?
And am I using the right approach for this problem?
You're asked to find the mole fraction of $\ce{N2}$ after the reaction. That is defined by:

$$x_{\ce{N_2},\text{f}} = \frac{n_{\ce{N_2},\text{f}}}{n_{\text{tot},\text{f}}}$$

where $x$ indicates a mole fraction, $n$ the number of moles and the subscript $\text{f}$ means "final". Furthermore, since the container is sealed, no gases can escape the container. This means that:

$$\begin{align}
n_{\ce{N_2},\text{f}} &amp;= n_{\ce{N_2},\text{i}} + \Delta n_{\ce{N_2}} \\
n_{\text{tot},\text{f}} &amp;= n_{\text{tot},\text{i}} + \Delta n_{\text{tot}}
\end{align}$$

where the symbol $\text{i}$ indicates "initial" and $\Delta n$ indicates the change in the number of moles caused by the decomposition of $\ce{NH4NO3}$. The four quantities on the right-hand side of these two equations are the quantities that you will have to find.


$n_{\text{tot},\text{i}}$ - This can be found by using the ideal gas law, $pV = nRT$ with the data given before the explosion. Substituting $p = 56.01\mathrm{~kPa}$, $V = 1.18\mathrm{~L}$, and $T = 286{~K}$, you will find that $n_{\text{tot},\text{i}} = 0.0276\mathrm{~mol}$.
$n_{\ce{N_2},\text{i}}$ - Since 79% of pre-explosion air is $\ce{N_2}$, $n_{\ce{N_2},\text{i}} = (0.79)(0.0276\mathrm{~mol}) = 0.0218\mathrm{~mol}$.
$\Delta n_{\ce{N_2}}$ - This is related stoichiometrically to the number of moles of $\ce{NH4NO3}$. In fact, it is numerically equal, as the coefficients of $\ce{NH4NO3}$ and $\ce{N2}$ are the same. The molar mass of $\ce{NH4NO3}$ is $80.04\mathrm{~g~mol^{-1}}$, so $\Delta n_{\ce{N_2}} = (8\mathrm{~g})/(80.04\mathrm{~g~mol^{-1}}) = 0.100\mathrm{~mol}$.
$\Delta n_{\text{tot}}$ - This is also related stoichiometrically to the number of moles of $\ce{NH4NO3}$. Each mole of $\ce{NH4NO3}$ leads to the formation of $(2+4+1)/2 = 3.5\mathrm{~mol}$ of gaseous products (observe that water will be gaseous after the explosion due to the rise in temperature). Therefore, $\Delta n_{\text{tot}} = (3.5)(0.100\mathrm{~mol}) = 0.35\mathrm{~mol}$.


Putting it all together, we have:

$$x_{\ce{N2},\text{f}} = \frac{0.0218 + 0.100}{0.0276 + 0.35} = 0.323$$

Note that the mole fraction is dimensionless. The exact final temperature is also of no use; its only purpose is to tell you that water will exist as a gas (and therefore contribute to the total number of moles). It could be any other number above $100^\circ\mathrm{C}$ and the final answer would be the same, as the mole fraction is independent of temperature.

I hope I didn't mess up the arithmetic.