I have this problem assigned for homework, and I think I've completed the majority of the proof, but I'm stuck at one part.
Problem
If $p>2$ is a prime, $n\in \mathbb{N}$, and $m\in \mathbb{Z}$, show that $m^2 \equiv 1\pmod{p^n} \implies$ either $m\equiv 1\pmod{p^n}$ or $m\equiv -1\pmod{p^n}$.
Proof
Let $m^2\equiv 1\pmod{p^n}$.
Then, $m^2 = qp^n + 1$, some $q\in \mathbb{Z}$
$\implies m^2 - 1=qp^n$
$\implies (m+1)(m-1)=qp^n$.
$\implies m+1=\frac{qp^n}{m-1}$.
Note that $\frac{q}{m-1}=x$, some $x\in\mathbb{Z}$. (This is the step I'm unable to prove.)
Thus, we have $m+1=xp^n\implies m=xp^n-1\implies m\equiv -1\pmod{p^n}$.
It also follows from $(m+1)(m-1)=qp^n$ that $m-1=\frac{qp^n}{m+1}$.
Note that $\frac{q}{m+1}=y$, some $y\in\mathbb{Z}$. (Again, I'm unable to prove this.)
Thus, we have $m-1=yp^n\implies m=yp^n+1\implies m\equiv 1\pmod{p^n}$.
Therefore, $m^2 \equiv 1\pmod{p^n} \implies$ either $m\equiv 1\pmod{p^n}$ or $m\equiv -1\pmod{p^n}$. $\blacksquare$
Thanks in advance!
What you need to show is either $\frac{q}{m-1}=x$ or $\frac{q}{m+1}=y$ must be true.
This can be shown by using the fact $p$ is prime so $p^n$ must be coprime with either $m+1$ or $m-1$. ($m=2$ will be a special case and can be easily shown as $p$ must be $3$ for the premise to be true)
If $p^n$ is coprime with $m-1$, then $\frac{q}{m-1}=x$ must be true because $\frac{qp^n}{m-1}=m+1$ is an integer. Similar for $m+1$ case.