If $m^2 +n^2 - m$ is a multiple of $mn$ and $p$ divides $m$ then $p^2$ divides $m$

Given natural numbers $m,n$ such that $m^2 + n^2 - m \equiv 0 \pmod{mn}$ and $p$ a prime dividing $m$, then I want to show that $p^2$ divides $m$.

I have tried multiple approaches: Euclidean division gives that $m = qp^2 + r$ for some $q, r \in \mathbb{N}$ where $0 \leq r < p^2$ and filling this in to show that $r = 0$. I also tried using that $p$ divides $m$ and $mn$ divides $m^2 + n^2 - m$ and again filling this in to find that $p^2$ has to divide $m$, but with no succes.

Any hints would be appreciated.

$\textbf{EDIT}$ Based on the given hint I have the following solution: Since $p$ divides $m$, we have that $p$ divides $mn$ and therefore $m^2 + n^2 - m$. Hence, there is some $k \in \mathbb{Z}$ such that $kp = m^2 + n^2 -m$ and therefore we have that $kp - m^2 + m = n^2$, so that $p$ divides $n^2$. Since $p$ is prime, it must divide $n$. Since $p$ divides both $m,n$ we have that $p^2$ divides $mn$ and therefore $m^2 + n^2 - m$. Also $p^2$ divides $m^2, n^2$ hence it must divide $m$.

• Hint: $p$ divides $m^2+n^2-m$ (why?), so it also divides $n$. Thus $p^2$ divides $mn$... – Wojowu Feb 15 '17 at 14:15
• @Wojowu Why does $p$ divide $n$? – tatan Feb 15 '17 at 14:20
• @tatan Do you see why it divides $n^2$? – Wojowu Feb 15 '17 at 14:21
• @Wojowu Got it...thanks!! – tatan Feb 15 '17 at 14:24

$p$ divides $m\implies p$ divides both $mn$ and $m^2-m=m(m-1)$.
$p$ divides $mn$ and $mn$ divides $m^2+n^2-m\implies p$ divides $m^2+n^2-m$.
$p$ divides both $m^2-m$ and $m^2+n^2-m\implies p$ divides their substraction $m^2+n^2-m-(m^2-m) = n^2$.
$p$ is prime and $p$ divides $n^2=n\cdot n\implies p$ divides $n$.

Conclusion:$p$ divides both $m^2$ and $n^2\implies p$ divides $m^2+n^2-(m^2+n^2-m) =m$.

• wasn't it to show $p^2$ divides $m$? – miniparser Feb 15 '17 at 15:26
• Yeah just noticed, gonna edit – Giulio Feb 15 '17 at 15:28
• @miniparser This is usually expressed in more symmetric form about the prime divisors of values of quadratic forms, e.g. see my answer. – Bill Dubuque Feb 15 '17 at 15:39
• @BillDubuque: i sort of understand what '$\equiv$' means. 'modular congruence'? it means that '$p$ divides $a$-$b$' for $a\equiv b$ (mod p) which also means $a$ mod $p = b$ mod $p$. i am a bit confused by cases of $n_1\equiv n_2\equiv n_3\equiv...\equiv n_k$ (mod p) though. is that the same as $n_1\equiv n_2$ (mod p) $\Longleftrightarrow n_1\equiv n_3$ (mod p) $\Longleftrightarrow...\Longleftrightarrow n_1\equiv n_k$ (mod p)? thanks. – miniparser Feb 15 '17 at 21:54
• @miniparser $\ a\equiv b\equiv c\,$ means they all have the same remainder mod $p,\,$ or, equivalently, $p$ divides the difference of any two of them. So $\,m\equiv 0 \equiv a\,$ means $\,p\,$ divides both $m$ and $a\ \$ – Bill Dubuque Feb 15 '17 at 22:11

By hypothesis $\,m = m^2+n^2-kmn\,$ for $\,\in\Bbb Z\,$ so it follows by this well known

Theorem  If $\ a = m^2+n^2+kmn\,$ then prime $\,p\mid m,a\,\Rightarrow\, p^2\mid a$

Proof $\,\ {\rm mod}\ p\!:\,\ \color{#c00}m\equiv 0\equiv a\equiv \color{#c00}m^2+n^2+k\color{#c00}mn\equiv n^2\,$ so $\ p\mid n^2\Rightarrow\,p\mid n$

Therefore $\,p\mid m,n\,\Rightarrow\, p^2\mid m^2,n^2,mn\,\Rightarrow\, p^2\mid a$