Step 1 - Discovering the molecular formula
Since this compound only has H, C and O atoms, its molecular formula will be something like:
With x, y and z representing the number of each atom in this compound. By counting the number of atoms, we know that there are, in this molecule, 2 H, 2 C and 2 O. Its molecular formula will be thus:
Step 2 - Discovering the empirical formula
The empirical formula can be found by dividing all the numbers by a common factor. We do this because the empirical formula expresses the least possible proportion between the elements.
Looking at the molecular formula we have found, H2C2O2, we can see that all numbers are divisible by 2. Therefore our empirical formula will be:
The molecular formula is thus H2C2O2 and the empirical one HCO.