On moving from left to right in a period of periodic table, the chemical reactivity of elements first decreases from sodium to silicon and then increases from phosphorus to chlorine.
The electronic configuration of metal ‘A’ is 2,8,1. This is electronic configuration of sodium metal.
The electronic configuration of metal ‘B’ is 2,8,2. This is electronic configuration of magnesium metal.
In the first element of third period, sodium, there is 1 valence electron which it can lose easily to react with other substances, so it is very reactive metal. The second element magnesium has 2 valence electrons. It is not easy for an atom to lose 2 electrons, so magnesium is less reactive than sodium.
Reaction with dil hydrochloric acid: