Explanation: Valency can be defined as the combining power of an element. It is the valency that dictates the value an element will have when writing a chemical formula for its compound.
MgX is a compound of magnesium and an element X. The valency of magnesium in most of its compound is +2. Now for the 2 to have been absent in the chemical formula, this shows that the element X itself have a valency if -2 for the valencies of both to have canceled out.
Now considering the element potassium, it is an alkaline metal belonging to group 1 of the periodic table. Hence, it is expected that it has a valency of +1
Forming a compound with element X means there would be an exchange of valencies between the two. We have established that x has a valency of -2. The formula of the compound thus formed by exchanging the valencies of both element would be K2X
Mass number<span> is the </span>number<span> of protons </span>and<span> neutrons in an atom. </span>Atomic mass<span> is the average </span>mass<span> of all the isotopes of a certain type.</span>