How can I find the ratio of molecular masses using the ideal gas equation? A person evacuated a cylinder and filled in $4~\mathrm{g}$ of gas A at $25~\mathrm{^\circ C}$. Pressure was found to be $1~\mathrm{atm}$. Another person filled another $8~\mathrm{g}$ of gas B in the cylinder at the same temperature. The final pressure was found to be $1.5~\mathrm{atm}$. What is the ratio of molecular masses of A and B (assuming ideal gas behaviour)? 


I tried to do it this way:

Taking the molecular mass of A as $x\ \mathrm{g}$ and that of B as $y\ \mathrm{g}$, I formed the respective ideal gas equations but the required terms ($x$ and $y$) just cancelled out. 

$$N(a) = 4/x ;\quad N (b) = 8/y$$
So$$V (a) = \frac{4 \times  22.4}{x};\quad     V (b) = \frac{8 \times  22.4}{y}$$

So, ideal gas equation for A:
$$1 X \frac{4 \times 22.4}{x} = \frac {4 \times  R  \times  25} x$$
Here $x$ cancels out. Similarly $y$ cancels out in its equation.
This is the problem I am facing. 

Another thing I want to know is that the total pressure (i.e $1.5~\mathrm{atm}$), will that be the sum of the individual pressures of gases A and B?
The ideal gas equation is $PV = nRT$
But for this problem V, R, and T are constants. So we can collect terms as:
$\dfrac{P}{n} = \dfrac{RT}{V}$
So $\dfrac{P_A}{n_A} = \dfrac{P_B}{n_B}$
Now you correctly determined the number of moles of A and B.
$n_A = \dfrac{4}{\text{MW}_A}$
$n_B = \dfrac{8}{\text{MW}_B}$
But you need to consider the partial pressures of A and B.

The cylinder was empty before A was added, and after A was added the pressure was 1 atmosphere. So the partial pressure of A is 1 atmosphere.
Before B is added the pressure is 1 atmosphere and after B is added the pressure is 1.5 atmospheres.  So the partial pressure of B is 0.5 atmospheres.

$P_A = 1$
$P_B = 0.5$
Now substituting into our simplified equation
$\dfrac{1}{\frac{4}{\text{MW}_A}} = \dfrac{0.5}{\frac{8}{\text{MW}_B}}$
$\dfrac{8}{\text{MW}_B} = \dfrac{2}{\text{MW}_A}$
$\dfrac{\text{MW}_A}{\text{MW}_B} = \dfrac{2}{8} = \dfrac{1}{4}$