<s>[INST] Exercise on elementary number theory Let $a,b,c,d$ integers, $c\not=0$ such that $ad-bc=1$ and $c\equiv 0 \pmod p$ for some prime $p>3$.

Show that if $a+d=\pm1$ then $p\equiv 1\pmod 3$

I don't know how to approach this problem because when I take the expression $ad-bc$ modulo $p$ we have that either $d-d^2\equiv 1\pmod p$ or $d+d^2\equiv 1\pmod p$.
 [/INST] Let's consider:
$ad-bc\equiv1 \pmod p\implies ad=1-bc \equiv 1\pmod p$
$(a+d)^2 \equiv a^2+d^2+2ad\equiv a^2+d^2+2\equiv1\pmod p$
$\implies a^2+d^2+1\equiv 0\pmod p$
$\implies (a^2+d^2+1)^2\equiv 0\pmod p$
Since:
$a+d=\pm1 \implies a\cdot d=(k+1)\cdot(-k)=-k^2-k$
Consider the following table $\pmod 3$
$$\begin{array}{ l | c | r }
  k  &  a  &  d  &  a^2 & d^2 & p \\
 -1  &  0  &  1  &  0   &  1  & 1 \\
  0  &  1  &  0  &  1   &  0  & 1 \\
  1  &  -1 &  -1 &  1   &  1  & 0 \\
\end{array}$$
$\implies p \equiv1 \pmod 3 \quad \square$
</s>