<s>[INST] Let $n$ and $m$ be integers such that $5$ divides $1+2n^2+3m^2.$ Then show that $5$ divides $n^2-1.$ 
Let $n$ and $m$ be integers such that $5$ divides $1+2n^2+3m^2.$ Then show that $5$ divides $n^2-1.$

$\textbf{My attempts} :$
From the condition, we can write $$1+2n^2+3m^2\equiv 0(\mod 5)\tag 1$$
Now, since $5$ is prime so by Fermat's little theorem, we can write $$n^4\equiv 1(\mod 5)\quad\text{and} \quad m^4\equiv 1(\mod 5).$$
So, we get $n^4-m^4\equiv 0(\mod 5)$.
Since $5$ prime so, either $5|(m^2+n^2)$ or $5|(m^2-n^2).$
Now if $5|(m^2+n^2)$ then from $(1)$ we get $$1-n^2+3n^2+3m^2\equiv 0(\mod 5)$$ So, we are done.
Now, if $5|(m^2-n^2)$ then from $(1)$ we get $$1+5n^2-3n^2+3m^2\equiv 0(\mod 5).$$ So, we shall arrive at a contradiction that $1\equiv 0(\mod 5).$
In this way, I have tried to solve this problem. I will be highly obliged if you kindly check this or correct me.
Thanks in advance.
 [/INST] If $1+2n^2+3m^2\equiv 0\pmod 5$, then $n^2\equiv m^2+2$.
Since the only squares modulo $5$ are $0,\pm 1$, the only values for $n^2$ and $m^2$ are $n^2\equiv 1\pmod 5$ and $m^2\equiv -1\pmod 5$.
</s>