Im going to assume you mean % by mass, but it’s important that you mention things like that.
The first thing to get the empirical formula. To do that, we will need to figure out the amounts of each element. This can be done by using the relation between molar mass, mass and number of moles. Also since we are dealing with percentages, actual amounts dont matter, only ratios. This means we can assume the total mass of whatever we want, I will use 100 g for convienence.
Therefore,
mass N = 87.42g
and since mol = mass/Molar mass
mol N = mass N/Molar mass N
mol N = 87.42g N/14.006 g/mol = 6.2416 mol N
Same for Hydrogen
mass H = 12.58g H
mol H = mass H/Molar mass H
mol H = 12.58g/1.00794 g/mol = 12.481 mol H
Now, can get the empirical formula by dividing all our mol values by the lowest one and rounding to the nearest integer.
By mole, the element we have the least of is Nitrogen, so we will use that.
#N = 6.2416 mol N/6.2416 mol N = 1
#H = 12.481 mol H/6.2416 mol N = 1.9996 = 2
So our empirical formula is NH2
However, we are not done, as we want the molecular formula, not the empirical one. To do this, we need both the empirical formula, which we have calculated, and the formula mass, which is given. To do this, we first find the empirical Molar mass:
multiply the molar mass of each element by the # in the empirical formula and sum them.
1×14.006 g/mol N + 2×1.00794 g/mol H
=14.006 g/mol + 2.01588 g/mol
=16.021 g/mol
Then we divide the formula mass by this number to find the number of empirical ‘units’ per molecule (round to the nearest integer):
32.1 g/mol / 16.021 g/mol = 2.0032 = 2
Then multiply the number of all the elements in our empirical formula to get the molecular one:
2 x (NH2) = N2H4
That is our molecular formula: N2H4