This chapter describes the motion of relativistic electrons in three-dimensional ideal undulator magnetic field. The undulator magnetic field satisfies the stationary Maxwell equations. Usually, the differential equations of electron motion in three-dimensional sinusoidal magnetic field are analysed by averaging over the fast electron oscillations. This averaging method was applied in a number of previously published papers. In this study, the nonlinear differential equations for electron motion were solved analytically by using the perturbation theory. The analytic expressions for trajectories obtained by this method describe the electron trajectories more accurately as compared with the formulas, which were obtained within the framework of the averaging method. An analysis of these expressions shows that the behaviour of electrons in such a three-dimensional field of the undulator is much more complicated than it follows from the equations obtained by the averaging method. In particular, it turns out that the electron trajectories in a planar undulator are cross-dependent. A comparison of the trajectories, calculated using these new analytical expressions with the numerically calculated trajectories using the RungeKutta method, demonstrated their high accuracy.