Exact solution to the relative orbital motion in eccentric orbits