Bounding the length of gradient trajectories