If $gcd(a,b)=d$ and $a^2+b^2=c^2$, show that $gcd(a,c)=gcd(b,c)=d$.
This is what I have so far. We know that $d|a$ and $d|b$ which implies that $d|c$, but that is not enough to show that $gcd(a,c)=gcd(b,c)=d$, only that they are at least $d$. Also $a^2=c^2-b^2$ and $b^2=c^2-a^2$. Any hints or solutions are greatly appreciated.