Why do plants need potassium and magnesium?

Plants need potassium because it helps in the maintenance of cell turgidity, opening and closing of stomata, cation - anion balance, activation of enzymes, essential for photosynthesis, respiration protein synthesis and in membrane permeability, Magnesium is required for chlorophyll formation,
growth, metabolism and nodule formation in legumes.