If they both mean the same, is が optional?
気が付く has three meanings.
- notice, realize
- (often in the form よく気が付く) be attentive, be quick to notice
- come to oneself (usually after losing consciousness)
For senses 1 and 3, 気付く is also used. When used in these senses, I do not think that there is any difference in meaning between 気が付く and 気付く. I do not recognize any difference in formality, either, but I may be wrong.
As far as I understand, they mean the same thing. The one with
が seems slightly more formal.
Edit: Apparently this is ungrammatical, although I don't understand why. Maybe I'll make it a separate topic.
It is also more likely to be used if there is some "long" clause that modifies the
母に電話をかけなかった気がつきました → I realized I forgot to call my mother