completed gradient decedent for one variable