Quadratic Congruences |
In this section we discuss techniques to solve quadratic congruences: \(ax^2+bx+c \equiv 0 \:\left(\mathrm{mod}\: n \right)\). We assume \(a\not\equiv 0 \:\left(\mathrm{mod}\: n \right)\). Otherwise \(ax^2+bx+c \equiv 0 \:\left(\mathrm{mod}\: n \right)\) reduces to the linear congruence \(bx+c \equiv 0 \:\left(\mathrm{mod}\: n \right)\). Note that solving \(ax^2+bx+c \equiv 0 \:\left(\mathrm{mod}\: n \right)\) is equivalent to solving the following system \[ y^2\equiv b^2-4ac \:\left(\mathrm{mod}\: n \right),\; 2ax\equiv y-b \:\left(\mathrm{mod}\: n \right).\]
Because of the above equivalency we concentrate on a quadratic congruence of the form \(x^2 \equiv a \:\left(\mathrm{mod}\: n \right)\) where \(n\) is an odd prime that does not divide \(a\). Note that if \(n\) is an odd prime and \(n\nmid a\), then \(\gcd(4a,n)=1\) and we get the above equivalent system. Also note that if \(n\vert a\), then \(x^2 \equiv a \:\left(\mathrm{mod}\: n \right)\) becomes \(x^2 \equiv 0 \:\left(\mathrm{mod}\: n \right)\) giving a unique solution \(x \equiv 0 \:\left(\mathrm{mod}\: n \right)\).
Example.
Let us solve \(x^2+4x+3 \equiv 0 \:\left(\mathrm{mod}\: 5\right)\).
Since \(\gcd(4\cdot 1,5)=1\), it is equivalent to
\[ y^2\equiv 4^2-4\cdot 1\cdot 3 \:\left(\mathrm{mod}\: 5\right),\; 2\cdot 1\cdot x\equiv y-4 \:\left(\mathrm{mod}\: 5 \right).\]
\(y^2\equiv 4 \:\left(\mathrm{mod}\: 5 \right)\) has two solutions \(y\equiv \pm 2\equiv 2, 3 \:\left(\mathrm{mod}\: 5\right)\).
Now for each \(y\), we solve \(2x\equiv y-4 \:\left(\mathrm{mod}\: 5 \right)\). For \(y=2\),
\(2x\equiv -4 \:\left(\mathrm{mod}\: 5 \right)\implies x\equiv -2\equiv 3 \:\left(\mathrm{mod}\: 5\right)\).
Similarly for \(y=3\), \(2x\equiv -1\equiv 4 \:\left(\mathrm{mod}\: 5 \right) \implies x\equiv 2 \:\left(\mathrm{mod}\: 5\right)\).
Thus solutions are \(x\equiv 2,3\:\left(\mathrm{mod}\: 5\right)\).
Proposition. Let \(p\) be an odd prime and \(p\nmid a\). Then \(x^2 \equiv a \:\left(\mathrm{mod}\: p \right)\) has either no solution or exactly two incongruent nonzero solutions of the form \(\pm x_0\).
Last edited