Mathematics of Resonance and Gravity