Note that
(a-b)^2 + (b-c)^2 + (c-a)^2
= a^2 - 2ab + b^2 + b^2 - 2bc + c^2 + c^2 - 2ac + a^2
= 2(a^2 + b^2 + c^2) - 2(ab + bc + ac).
Since the two expressions in parentheses are equal,
the difference will be zero.
However, in the expression
(a-b)^2 + (b-c)^2 + (c-a)^2,
none of the three squares can be a negative number,
so if their sum is zero, each of them must separately be zero.
That's how they get
(a-b)^2 = 0, (b-c)^2 = 0, (c-a)^2 = 0,
which proves that a-b = 0, b-c = 0, c-a = 0,
and hence a=b=c.