<s>[INST] Completing the square of $(x+a)(x+b)$ The problem is simple, to complete the square of $(x+a)(x+b)$. My calculations yield
$$\left(x+\frac{a+b}{2}\right)^2-\frac{(a+b)^2}{4}+ab,$$
But the textbook's answer is different ("problem 361", at the bottom of the page):
$$\left(x+\frac{a+b}{2}\right)^2-\frac{(a-b)^2}{4}$$
Did I do anything the wrong way? 
$$(x+a)(x+b)=x^2+xb+ax+ab=x^2+x(a+b)+ab=$$
$$=\left(x^2+2*\frac{a+b}{2}*x+\left(\frac{a+b}{2}\right)^2\right)-\left(\frac{a+b}{2}\right)^2+ab=$$
$$=\left(x+\frac{a+b}{2}\right)^2-\frac{(a+b)^2}{4}+ab$$
 [/INST] You did nothing wrong. 
Note that 
$$-\frac{(a+b)^2}{4}+ab=\frac{-(a+b)^2+4ab}{4}=\frac{-a^2+2ab-b^2}{4}=-\frac{(a-b)^2}{4}$$
</s>