Applications of the identity $ab + \left(\frac{a+b}{2} - b\right)^2 = \left(\frac{a+b}{2}\right)^2$ I am reading Euclid's elements
I found the algebraic identity
$ab + \left(\frac{a+b}{2} - b\right)^2 = \left(\frac{a+b}{2}\right)^2$
I ponder on usage of this identity for $2$ hours.
but I can't click anything.
$a^2 + b^2 = c^2$ can be used when you want to know the direction between $2$ coordinates.
Any example involving this identity?

This identity can be rewritten as $$(a-b)^2=(a+b)^2-4ab$$ and, is the secret behind the discriminant of a quadratic equation. Let me explain it. Suppose $Ax^2+Bx+C=0$ is a quadratic equation with real coefficients, then its roots must occur as complex conjugate pairs. If we have two complex roots $a, b$ for this equation, then there are real $\alpha, \beta$ such that $a,b=\alpha\pm i\beta.$  Clearly, $$a-b=2i\beta,\qquad a+b=2\alpha=-\dfrac{B}{A},\qquad ab=\alpha^2+\beta^2=\dfrac{C}{A}.$$ Hence we have $$(a-b)^2=-4\beta^2=\dfrac{B^2-4AC}{A^2}.$$ Since $\beta^2\gt 0$ we have $$\Delta=A^2(a-b)^2=B^2-4AC\lt0.$$ Other two cases follows similarly. 
