cost function, gradient descent

initial implementation