Why do metal oxides when dissolving in water make an alkaline solution?

And

Why non-metal oxides dissolve in water and become acids ?

Is this a concept that has to be learned or is there a rule or a defintion for it

I suppose it's a concept that should be learned; however, note that the reaction between a metal oxide and water can't do much more than produce a hydroxide.

MgO + HOH ==> Mg(OH)2. It seems obvious to me that the Mg will combine with the OH of HOH leaving the O and H to become another OH.

CO2 + H2O ==> H2CO3
SO3 + H2O ==> H2SO4
Here is a rather good site summarizing several types of reactions. http://pages.towson.edu/ladon/react.html

The observation that metal oxides when dissolving in water produce alkaline solutions, while non-metal oxides dissolve in water and become acids, is based on the concepts of acidity and alkalinity.

To understand why metal oxides produce alkaline solutions, we need to consider the chemistry behind it. When a metal oxide dissolves in water, it reacts with the water molecules to form hydroxide ions (OH-) and metal cations, which are positively charged. The hydroxide ions contribute to the alkalinity of the solution because they can accept protons (H+) from the surrounding environment. This reaction can be summarized as follows:

Metal Oxide + Water → Metal Cation + Hydroxide Ion

For example, when sodium oxide (Na2O) dissolves in water, it reacts to form sodium hydroxide (NaOH), a strong alkaline solution:

Na2O + H2O → 2Na+ + 2OH-

On the other hand, non-metal oxides dissolve in water and become acids because they react with water to form acidic solutions. When a non-metal oxide reacts with water, it forms oxoacids, such as sulfuric acid (H2SO4) or carbonic acid (H2CO3), depending on the specific non-metal oxide involved. These oxoacids release hydrogen ions (H+) into the solution, which contribute to the solution's acidity. The reaction can be expressed as:

Non-metal Oxide + Water → Oxoacid

For example, when sulfur dioxide (SO2) dissolves in water, it forms sulfuric acid, resulting in an acidic solution:

SO2 + H2O → H2SO4

In summary, the alkaline or acidic nature of a solution formed upon dissolving metal oxides or non-metal oxides in water respectively is a concept based on the chemical reactions taking place. While there are general trends and common examples, understanding the concept requires knowledge of the specific reactions involved, as well as the properties of different elements and compounds.