On equivalent systems in optimal control and stability theory