100 g of the compound contains 12.5 g H and 100−12.5=87.5 g N.
The atomic masses of H and N are 1 g/mol and 14 g/mol respectively.
The number of moles of H = 12.5 g1 g/mol = 12.5 mol
The number of moles of N = 87.5 g14 g/mol = 6.25 mol
The mole ratio N:H=6.25:12.5=1:2
Hence, the empirical formula of the compound is NH2.