In order to find the empirical formula of a compound we need to use the mass given in the question and also each molar mass and go through a step by step process, but when it comes to finding empirical formula for combustion reactions, the question needs a little more of logic in order to properly answer, so let's work on each step
The question gave us:
12.57g of CO2
7.72 of H2O
We know that the combustion reaction will be:
CxHy + O2 -> CO2 + H2O (the reaction is not properly balanced, but this will not be influential in our answer)
(CxHy is because we don't know which hydrocarbon we have yet)
Following the law of conservation of mass, we know that every Carbon present in CO2 came from the hydrocarbon, as every mol of Hydrogen also came from the hydrocarbon, let's see how many moles of each one we have
Molar mass of H2O is 18g/mol and CO2 is 44g/mol
18g = 1 mol
7.72g = x moles
x = 0.43 moles of H2O present in 7.72 grams of H2O
But since we have 2 atoms of hydrogen in the compound, we actually have 0.86 moles of H and 0.43 moles of O in this water molecule
44g = 1 mol
12.57g = x moles
x = 0.28 moles of CO2 in 12.57 grams
Since we have just 1 atom of Carbon in CO2, we will have 0.28 moles of Carbon
Now we can find the empirical formula, because we know that we have 0.86 moles of Hydrogen and 0.28 moles of Carbon coming from the hydrocarbon
In order to find the empirical formula we need to divide all the values of number of moles by the lowest value, therefore:
0.86/0.28 = 3 moles of H
0.28/028 = 1 mol of C
So this compound is CH3