method of completing the square