If $p\equiv 3\pmod{4}$ and $p\mid x^2+y^2$, prove $p\mid x,y$. I have to prove that if $p$ is a prime number of the form $p = 4n - 1$, $n\in N$ and $x^2+y^2\equiv 0\pmod{p}$, then $x\equiv 0\pmod{p}$ and $y\equiv 0\pmod{p}$.
I have gone about this as follows and I hope you will correct me if I made any errors:
First of $x^2 + y^2$ is divisible by p so we can write it as being equal to some multiple $k$ of $p$ $+$ a remainder of $0$.
Then let's assume the opposite that neither $x$ or $y$ are congruent to $p$ ergo they aren't divisible by $p$ so we can represent them as being equal to some multiples $l$ and $m$ of $p$ (respectively) and with remainders (nonzero of course) $a$ and $b$ (respectively). 
So we get: 
$$ x^2 + y^2 = kp + 0$$
$$ x = lp + a $$
$$ y = mp + b$$ 
If we take the second and third expression and square them we get:
$$ x^2 = l^2p^2 + 2lpa + a^2 $$
$$ y^2 = m^2p^2 + 2mpb + b^2$$
Then we add them up:
$$ x^2 + y^2 = l^2p^2 + 2lpa + a^2 + m^2p^2 + 2mpb + b^2$$
Factorize:
$$ x^2 + y^2 = \left(l^2p + 2la + m^2p + 2mb\right)p + a^2 + b^2$$
We see that $k = l^2p + 2la + m^2p + 2mb$, which gives us:
$$ x^2 + y^2 = kp + a^2 + b^2$$
At the beginning it is stated that the remainder $a$ is equal to zero since $x^2 + y^2$ is divisible by $p$ so get to the conclusion that the sum of two nonzero, positive numbers, more precisely the sum of two squares $a^2 + b^2$ has to be $0$. This is a contradiction. 
The contradiction was brought on by the assumption that $x$ and $y$ aren't divisible by $p$ therefore we conclude that $x$ and $y$ must be divisible by $p$.
 A: I.e. you want to prove:
$p\equiv 3\pmod{4},\ p\mid x^2+y^2\implies p\mid x,y$.
If $p\mid x$, then $p\mid y$, and vice versa.
So for contradiction assume $\gcd(p,x)=\gcd(p,y)=1$. See Modular Inverse.
$x^2\equiv -y^2\pmod{p}\iff (xy^{-1})^2\equiv -1\pmod{p}$
This can give a contradiction in several ways:
$1)\ $ Just remember Quadratic Reciprocity.
$2)\ $ Raise both sides by $\frac{p-1}{2}$ (which is odd):
$\implies \left(xy^{-1}\right)^{p-1}\equiv (-1)^{\frac{p-1}{2}}\equiv -1\pmod{p}$,
which contradicts Fermat's Little Theorem.
$3)\ $ Square both sides: $\left(xy^{-1}\right)^4\equiv 1\pmod{p}$.
Then $\text{ord}_p\left(xy^{-1}\right)\mid 4$. But it cannot be $1$ or $2$, because $\left(xy^{-1}\right)^2\equiv -1\pmod{p}$, therefore $\text{ord}_p\left(xy^{-1}\right)=4$, so $4\mid p-1$ by Fermat's Little Theorem (see below).
Theorem: If $\text{ord}_m(a)=d$ and $a^k\equiv 1\pmod{m}$, then $d\mid k$.
Proof: For contradiction, assume $k=dl+r$ for some $l,r\in\Bbb Z^+,\, 0<r<d$.
$a^{k}\equiv \left(a^d\right)^la^r\equiv 1^la^r\equiv a^r\equiv 1\pmod{m}$, contradiction.
