Finding simplest formula of a compound with following specifications
$$M=\frac{m}{n}\ \curvearrowright\ m=M\cdot n$$

$$M_X=10\ g\ mol^{-1},\ M_Y=20\ g\ mol^{-1}$$

$$\frac{m_X}{m_X+m_Y}=50\ \%,\ \frac{m_Y}{m_X+m_Y}=50\ \%:$$

$$m_X=m_Y$$

$$M_X\cdot n_X=M_Y\cdot n_Y$$

$$\frac{n_X}{n_Y}=\frac{M_Y}{M_X}=\frac{20\ g\ mol^{-1}}{10\ g\ mol^{-1}}=2$$

$$n_X=2\ n_Y$$

$$\curvearrowright\ X_2Y$$