The purpose of this paper is to present a method of the control design for a nonlinear process to swing up the inverted pendulum which stay initially in the natural pendent position and to stabilize the pendulum at the inverted position. Firstly, to swing up the inverted pendulum, optimal trajectory is derived by bang-bang control such as makes a cart move into right and left direction in turn near the natural frequency of the pendulum. Secondly, a nonlinear differential equation is transformed into a linear time-varying system around the optimal trajectory (nominal state), and then a linear time-varying optimal regulator is applied to make the pendulum trajectory exactly follow up the nominal state, and then to stabilize it at the inverted point. After a pendulum is inverted, a time-invariant optimal regulator with higher control gain than time-varying one is used in order to reduce the off-set of a cart position and to stabilize the pendulum for disturbances. Further, Kalman filter is applied to eliminate the small vibration of pendulum. Finally, it is demonstrated that the successful probability for swinging up and stabilizing has been almost 100% by the control experiments. The presented method improves the result of the previous research and shows to produce a reliable control system.