I'm reading "Elementary Number Theory by Kenneth H.Rosen", and in the book, there is one problem that I couldn't understand the solution.
Problem 9 (Chapter 9.2 - 6th edition)
Problem
Show that if $p$ is a prime and $p \equiv 1 \pmod{4}$, then there is an integer $x$ such that $x^2 \equiv -1 \pmod{p}$.Solution from Textbook
By Larange's theorem, there are at most two solutions $x^2 \equiv 1 \pmod{p}$, and we know $x \equiv \pm1$ are the two solution.
Since $p \equiv 1 \pmod{4} \implies 4 | (p - 1) = \phi(p)$ so there is an element $x$ of order $4$ modulo p.
Then $x^4 = (x^2)^2 \equiv 1 \pmod{p}$, so $x^2 \equiv \pm1 \pmod{p}$. If $x^2 \equiv 1 \pmod{p}$ then $x$ does not have order $4$. Therefore $x^2 \equiv -1 \pmod{p}$.
What I did not understand is, "If $x^2 \equiv 1 \pmod{p}$ then $x$ does not have order $4$." I really don't see how the author came up with this one? Any idea?
Thanks,