Magnesium reacts with oxygen producing a bright white flame leaving behind a white ash of magnesium oxide.

          magnesium   +   oxygen   →   magnesium oxide

          2Mg (s)   +   O₂ (g)   →   2MgO

MgO is a base, which can react with an acid to give a salt and water.

 

Hydrogen reacts with oxygen in an explosive reaction. This is the basis of the ‘squeak pop’ test for hydrogen in test tube. With larger quantities of hydrogen this explosion can be dangerous.

          hydrogen   +   oxygen   →   water

          2H₂ (g)   +   O₂ (g)   →   2H₂O (l)

 

Sulfur reacts with oxygen producing a blue flame.

          sulfur   +   oxygen   →   sulfur dioxide

          S (s)   +   O₂ (g)   →   SO₂ (g)

When sulfur dioxide (SO₂) dissolves in water it forms an acidic solution of sulfurous acid:

          SO₂ (g)   +   H₂O (l)   →   H₂SO₃ (aq)