Mr(HNO3) = Mr = Ar(H) + Ar(N) + 3Ar(O) = 1 + 14 + 3 * 16 = 63
w(H) = Ar(H) / Mr = 1 / 63 = 0.0159 = 1.59%
w(N) = Ar(N) / Mr = 14 / 63 = 0.2222 = 22.22%
w(O) = 3Ar(O) / Mr = 48 / 63 = 0.7619 = 76.19%
Mr(Mg(OH)2) = Mr = Ar(Mg) + 2Ar(O) + 2Ar(H) = 24 + 2 * 16 + 2 * 1 = 58
w(Mg) = Ar(Mg) / Mr = 24 / 58 = 0.4138 = 41.38%