The empirical formula of magnesium oxide can be found by heating magnesium in air and measuring the mass change. First weigh an empty crucible with its lid. Add a coil of clean magnesium ribbon and weigh again. Heat the crucible strongly. The magnesium burns and combines with oxygen from the air. Lift the lid briefly and now and then to let oxygen in, but not for long, because white smoke of magnesium oxide can escape.
When the magnesium has turned into a white powder, let the crucible cool and weigh it again. Heat and weigh again until the mass is constant, which shows the reaction is complete.
The mass of magnesium is the mass of the crucible with magnesium, minus the empty crucible. The mass of oxygen is the mass of the crucible with magnesium oxide, minus the crucible with magnesium. Example: 0.48 g of magnesium makes 0.80 g of magnesium oxide, so 0.32 g of oxygen reacted. Moles of Mg = 0.48 ÷ 24 = 0.02. Moles of O = 0.32 ÷ 16 = 0.02. The ratio is 1 : 1, so the formula is MgO. If smoke escapes, the final mass is too low, so the mass of oxygen is too low.