Solutions of $x^2-6x-13 \equiv 0 \pmod{127}$

. To find solutions of $x^2 - 6x - 13 \equiv 0 \mod 127$, we must write $x^2-6x - 13$ as a square of a linear term, plus a constant. It's seen easily that $x^2 - 6x - 13 = (x-3)^2 - 22$. Hence, the congruence is equivalent to $(x-3)^2 \equiv 22 \mod 127$.

Now, we must check if $22$ is a quadratic residue mod $127$. For this, we can use the Legendre symbol, whose notation I will keep the same as the binomial, so do not get confused. $$ \binom{22}{127} = \color{green}{\binom{11}{127}}\color{red}{\binom{2}{127}} = \color{green}{-\binom{127}{11}} \times \color{red}1 $$ where the terms with same color on the LHS and RHS are equal. The green equality comes by quadratic reciprocity and the second comes by the fact that $\binom{2}{p}$ is well known by the remainders which $p$ leaves when divided by $8$.

Now, we can do: $$ -\binom{127}{11} = -\binom{6}{11} = -\color{green}{\binom{2}{11}}\color{red}{ \binom{3}{11}} = -\color{green}{(-1)}\color{red}{(1)} = 1 $$

Again, the colored terms on the LHS and RHS are equal because the quantities $\binom 2p$ and $\binom 3p$ are well known.

Since we have obtained that the Legendre symbol is $1$, this implies the existence of a solution, and therefore two.

The question, though, is how to compute them. I do not know of any method other than brute force, unfortunately. However, our reward for writing $(x-3)^2 \equiv 22 \mod 127$ is that we basically only need to look for squares of the form $127k + 22$ to find a solution, rather than having to substitute values of $x$ into the expression $x^2-6x-13$ each time.

A brute force : the series $127k + 22 $ goes like : $22,149,276,403,530,657,\color{blue}{784},...$

lo and behold, $784 = 28^2$, hence this gives $x = 31$. Now, note that the congruence actually has two solutions, one given by $127 - 28 = 99$. You can check that $9801 = 99^2 = 22 + 127 \times 77$.

Hence, we get two solutions of $x$, namely $x= 31,102$.