Finding the maximum or minimum value of a quadratic by completing the square