Gradient descent functions

Cost function for single variable gradient descent.