In order to learn more about minimizing cost functions or squared (difference) error functions using gradient descent, visit the following site:
https://en.wikipedia.org/wiki/Gradient_descent