It can be shown that matter is neither created nor destroyed in a chemical reaction by taking a critical look at the each atom in both sides of the reaction (reactant and product sides).
1 atom of Mg started the reaction and 1 atom is also present in the products.
8 atoms of O are present in the reactants and 8 is also present in the products.
4 H atoms are present in the reactants and 4 are also present in the products.
2 N atoms are present in the reactants and 2 are also in the products.
In other words, the total number of each atom that is present in the reactants are also present in the product. Nothing has been lost during the reaction, although, the forms of each atom might have changed.
More on the law of conservation of matter can be found here: brainly.com/question/20635180