Lagrangian For Inverted Compound Pendulum Theory