Consider a triangle ABC with centroid at G and the coordinaes be
A(0,0); B(x1,y1); C(x2,y2)
then coordinates of point 'G' the centroid of the triangle is given by
x = (0 + x1 + x2) /3 = (x1 + x2) /3
y = (0 + y1 + y2) /3 = (y1 + y2) /3
Now to prove
AB2+BC2+CA2 = 3(GA2+GB2+GC2)
Substitute the coordinates at each sides and simplify to obtain above result.
Similarly take O(x,y) to prove second result