Application of optimization theory on the operation of modern rapid transit systems produces optimal trajectories for scheduled and disturbed operation. Using the maximum principle and considering the constraints on the control and state variables algorithms for time and energy optimal operation are determined. From the consideration of various braking systems it is found what energy savings may be obtained under which conditions by ideal braking. For unscheduled operation with variable target coordinates the optimization theory according to Euler-Lagrange produces favorable trajectories, which may be implemented using an adaptive control system.