Keywords: rotary inverted pendulum, Lagrange equations, state feedback controller, linear quadratic regulator.