Generally speaking due to the relationship between Magnesium and Potassium, when you have a Magnesium deficiency it will cause a Potassium deficiency as well, it's the way the body works.
I''m surprised he had you supplement potassium as it's fairly easy to get sufficient amounts from your diet and will rise when you address the magnesium deficiency, have him check into it, but I'm right

Magnesium on the other hand can be a bit trickier to maintain proper levels dietarily, which is why it's often supplemented especially by athletes and bodybuilders due to it's relationship with muscle and nerve function.
With a magnesium deficiency you'll want to increase the amount of these magnesium rich foods in your diet as with any vitamin or mineral your body absorbs them easier through dietary sources than by supplements as those isolated supplements have to be manipulated (usually combined with Croscarmellose Sodium) to get them to be absorbed through the intestine and increase bioavailability. Sadly due to this combination the majority of the supplement is processed as a toxin in your body and passed.
Bran (rice, wheat and oat), Squash, pumpkins, cacao (dark chocolate), flax, sesame, and brazil nuts are all excellent sources of magnesium. Magnesium should be consumed in the evening and to "push" absorption you'll want to supplement Vitamin B6 as it triggers the body to absorb magnesium over calcium, which vie for absorption. Adversely Vitamin D is the trigger for your body to absorb Calcium over Magnesium which is why it's often added to milk.
Hope that helps, let me know if I can be of further assistance

Eric