# Determine the molecular formula of the compound using percentage composition

I’ve attempted to solve this problem with percent composition, but it says the answer is wrong. Is it a $pV=nRT$ problem, and if so, can I use the units as they are given?

A $\pu{0.02867 g}$ sample of gas occupies $\pu{10.0 ml}$ at $\pu{290.0 K}$ and $\pu{1.10 atm}$. Upon further analysis, the compound is found to be $38.734 \%~ \ce{C}$ and $61.266\%~\ce{F}$. What is the molecular formula of the compound?

I keep on getting $\ce{CF}$ for the answer via percent composition.

You're actually on the right track. Looking at the percent composition, you've correctly identified that the ratio of $\ce{C}$ to $\ce{F}$ atoms is 1:1, however, you cannot assume that the formula is just $\ce{CF}$ (which isn't a known compound), it could be any compound with that ratio, $\ce{C2F2}$, $\ce{C3F3}$, $\ce{C4F4}$, etc.

The way to narrow it down is to use the gas data. You are right that you need to use the ideal gas law. If you look at the equation, you have everything except the number of moles, so you're interested in finding $n$:

$$n=\frac{PV}{RT}$$

As for the units, that depends on what units you have in $R$. If you have $R$ in $\mathrm{J/(mol\cdot K)}$, then $P$ needs to be in $\mathrm{Pa}$ and $V$ in $\mathrm{m^3}$, if it's in $\mathrm{L\cdot atm/(mol\cdot K)}$, then $P$ should be in $\mathrm{atm}$ and $V$ in $\mathrm{L}$. You can either convert what you have to match $R$ or convert $R$ to match your variables; it doesn't really matter.

Once you have the number of moles, you can calculate the molar mass of the compound from the sample mass: $$m_\mathrm M=\frac{m_\mathrm s}{n}$$

Then, since we know the ratio of $\ce{C}$ to $\ce{F}$ is 1:1, the molar mass will be some multiple of the mass of $\ce{CF}$ which is $31.0091\ \mathrm{g/mol}$, so just divide the molar mass by that and you'll know $n$ in $\ce{C_nF_n}$.

Also, while not a sure way if fake compounds are possible answers, not all compounds with formula $\ce{C_nF_n}$ are known ($\ce{CF}$, for instance), so you can narrow down your choice of answer.