The equation of the circle after completing squares can be written as
x2+2g1x+g21+y2+2f1y+f21=g21+f21⟹(x+g1)2+(y+f1)2=g21+f21
x2+2g2x+g22+y2+2f2y+f22=g22+f22⟹(x+g2)2+(y+f2)2=g22+f22
Now, as these are touching, the distance between centres is equal to sum of the radii
√(−g1+g2)2+(−f1+f2)2=√g21+f21+√g22+f22
Squaring both sides,
(−g1+g2)2+(−f1+f2)2=g21+f21+g22+f22+2√(g21+f21)(g22+f22)
∴g21+g22−2g1g2+f21+f22−2f1f2=g21+f21+g22+f22+2√(g21+f21)(g22+f22)
∴−(g1g2+f1f2)=√(g21+f21)(g22+f22)
squaring both sides,
(g1g2)2+(f1f2)2+2g1g2f1f2=(g1g2)2+(f1f2)2+(f1g2)2+(g1f2)2
∴2g1g2f1f2=(f1g2)2+(g1f2)2
∴(f1g2)2+(g1f2)2−2g1g2f1f2=0
∴(f1g2−g1f2)2=0
∴f1g2=g1f2
Hence proved.