The quemical equation is balanced because the total number of each element on the reactants side (to the left of the arrow) is equal to the total number of each element on the products side (to the right of the arrow).
For example, on the reactants side there are:
- 1 Mg
- 8 O
- 4 H
- 2 N
And, on the products side there are:
- 1 Mg
- 2 N
- 8 O
- 4 H