traj backward calculation