Divisibility of $x^2+y^2$ by prime $p$ [duplicate]
As suggested by Ethan Bolker in the comments, continuing my line of reasoning we have: $$x^2\equiv-y^2\pmod p$$ If $p$ divides $y$ we're done, otherwise suppose $p$ doesn't divide $y$, then $p$ can't divide $y^{-1}$ (its modular inverse) either since if it did: $$y\cdot y^{-1}\equiv y\cdot0\equiv0\neq1\pmod p$$ Thus we can multiply both sides of the first conguence by $(y^{-1})^2$ without changing the mod since $(y^{-1},p)=1$, thus:$$x^2\cdot (y^{-1})^2\equiv(x\cdot y^{-1})^2\equiv-1\pmod p$$ Which is a contradiction because $k^2\equiv -1 \pmod p \iff p\equiv 1 \pmod4$