First you want to look at the charges of both of those atoms. You can easily obtain those from a periodic table, but nitrate, is a polyatomic ion, so if you haven't memorized a bunch of those already, then I recommend you do so.
Question now is how will you make those charges balance?
*Really simple math:
This step is really unnecasary but if it clarifies the problem, then that's up to you!
Now you need another nitrate atom to balance the charge, thus:
You will have 2 nitrates for every magnesium...
Brackets are used to indicate