Translation:Theorematis fundamentalis in doctrina de residuis quadraticis demonstrationes et ampliationes novae

The fundamental theorem of quadratic residues, which is said to be among the most beautiful truths of higher arithmetic, was easily discovered by induction, but it is much more difficult to demonstrate. It often happens in this subject that the simplest truths, which offer themselves spontaneously to the inquirer by induction, have demonstrations which are hidden in the deepest depths, which can only be brought to light after many fruitless attempts, and quite possibly by a different path than that by which they were sought. Then, when at first one path has been discovered, it happens not infrequently that several more appear from time to time, with some being shorter and more direct, and others arising obliquely and from very different principles, which one would have thought to be nearly unrelated to the proposed question. Strange connections of this kind between abstruse truths not only give a certain charm to these contemplations, but also deserve to be diligently investigated and analyzed, because they frequently lead to new resources or advances in science.

Therefore, although the arithmetic theorem which is to be discussed here may seem to be fully completed by previous efforts, which provided four entirely different demonstrations, I nonetheless return again to the same theme, and add two more demonstrations, which will certainly shed new light on this matter. The first is in a certain way related to the third, as it proceeds from the same lemma; afterwards, however, it follows a different course, so that it can well be considered a new proof, whose elegance will be seen to be, if not superior, then at least not inferior to that of the third. On the other hand, the sixth demonstration is based on a completely different and more subtle principle and provides a new example of an astonishing connection between arithmetic truths that, at first glance, appear to be very far removed from each other. To these two demonstrations, a very simple new algorithm is added to determine whether a given integer is a quadratic residue modulo a given prime or not.

There was yet another reason, which prompted me to publish the new demonstrations at this particular moment, although they had been promised nine years ago. In 1805, when I began to investigate the theory of cubic and biquadratic residues, which is a much more difficult subject, I experienced almost the same fate as I once had in the theory of quadratic residues. Indeed, those theorems, which entirely exhaust these questions, and in which a remarkable analogy with the theorems pertaining to quadratic residues shines forth, were immediately discovered by induction as soon as a suitable approach had been found. However, all efforts to obtain them, with their demonstrations perfected in every aspect, remained fruitless for a long time. This was the incentive for me to add more and more demonstrations concerning quadratic residues to those already known, supported by the hope that among the many diverse methods, one or another might do something to reveal an analogous line of reasoning. This hope was by no means in vain, and tireless labor was finally followed by prosperous success. It will soon be possible to bring the fruits of this vigilance to public light; but before embarking on this arduous task, I decided to return once more to the theory of quadratic residues, to complete all that still remained of that agenda, and thus to bid farewell to this sublime part of arithmetic.

1.
In the introduction, we have already stated that the fifth and third proof proceed from the same lemma. As a matter of convenience, it seems appropriate to repeat it in this place, with notation adapted to the present discussion.

Let $m$ be a prime number (positive odd), and let $M$  be an integer not divisible by $m.$  Consider the minimal positive residues of the numbers

$$M, 2 M, 3 M, 4 M, \ldots \frac{1}{2}(m-1) M$$

modulo $m.$ Some of these will be less than $\frac{1}{2} m$  and some will be greater; let the multitude of the latter $=n.$  Then $M$  will be a quadratic residue or non-residue modulo $m,$  depending on whether $n$  is even or odd.

Let those residues which are less than $\frac{1}{2} m$ be denoted by $a,$  $b,$  $c,$  $d$  etc. , and let the rest, which are greater than $\frac{1}{2} m,$ be denoted by $a^{\prime},$  $b^{\prime},$  $c^{\prime},$  $d^{\prime}$  etc. The complements modulo $m$ of the latter, $m-a^{\prime},$  $m-b^{\prime},$  $m-c^{\prime},$  $m-d^{\prime}$  etc. , will evidently all be less than $\frac{1}{2} m,$ and they will be distinct both among themselves and from the residues $a,$  $b,$  $c,$  $d,$  etc. Thus they will be identical, albeit in a different order, to the numbers $1,$ $2,$  $3,$  $4 \dots \frac{1}{2}(m-1).$  So, if we set

$$1 \times 2 \times 3 \times 4 \ldots \frac{1}{2}(m-1)=P$$

then

$$P=a b c d \ldots \times(m-a^{\prime})(m-b^{\prime})(m-c^{\prime})(m-d^{\prime}) \ldots$$

and thus

$$(-1)^{n} P=a b c d \ldots \times(a^{\prime}-m)(b^{\prime}-m)(c^{\prime}-m)(d^{\prime}-m) \ldots$$

Furthermore, we have

$$P M^{\frac{1}{2}(m-1)} \equiv a b c d \ldots \times a^{\prime} b^{\prime} c^{\prime} d^{\prime} \ldots \equiv a b c d \ldots \times(a^{\prime}-m)(b^{\prime}-m)(c^{\prime}-m)(d^{\prime}-m) \ldots$$

modulo $m,$ so

$$P M^{\frac{1}{2}(m-1)} \equiv P(-1)^{n}$$

Hence $M^{\frac{1}{2}(m-1)} \equiv \pm 1,$ where the sign is positive if $n$  is even and negative if $n$  is odd. Therefore, with the help of the theorem proved in Disquisitiones Arithmeticae art. 106, the truth of the lemma is immediately apparent.

2.
Let $m,$ $M$  be positive odd relatively prime integers, and let $n$  be the multitude of numbers in the sequence

$$M, 2 M, 3 M \ldots \frac{1}{2}(m-1) M$$

whose minimal positive residues modulo $m$ are greater than $\frac{1}{2} m.$  Similarly, let $N$  be the multitude of numbers in the sequence

$$m, 2 m, 3 m \ldots \frac{1}{2}(M-1) m$$

whose minimal positive residues modulo $M$ are greater than $\frac{1}{2} M.$  Then the three numbers $n,$  $N,$  $\frac{1}{4}(m-1)(M-1)$  will either be all even, or one will be even and the other two will be odd.

Let us denote

by $f$ the complex of numbers $1, 2, 3 \ldots \frac{1}{2}(m-1)$

by $f^{\prime}$ the complex of numbers $m-1, m-2, m-3 \ldots \frac{1}{2}(m+1)$

by $F$ the complex of numbers $1,2,3 \ldots \frac{1}{2}({M}-1)$

by $F^{\prime}$ the complex of numbers $M-1, M-2, M-3 \ldots \frac{1}{2}(M+1)$

Thus $n$ will indicate how many numbers $M f$  have their least positive residues modulo $m$  in the complex $f^{\prime},$  and similarly $N$  will indicate how many numbers $m F$  have their least positive residues modulo $M$  in the complex $F^{\prime}.$  Finally, let us denote

by $\varphi$ the of numbers $1, 2, 3 \ldots \frac{1}{2}(m M-1)$ by $\varphi^{\prime}$ the complex of numbers $m M-1, m M-2, m M-3 \ldots \frac{1}{2}(m M+1)$

Since every integer not divisible by $m$ must be congruent, modulo $m,$  to a residue from the complex $f$  or from the complex $f^{\prime},$  and similarly every integer not divisible by $M$  must be congruent to a residue from the complex $F$  or from the complex $F^{\prime},$  it follows that all the numbers $\varphi,$  among which obviously no one is divisible by both $m$  and $M,$  can be distributed into eight classes in the following way.


 * I. In the first class there will be those numbers which are congruent to some number from $f$ modulo $m,$  and congruent to some number from $F$  modulo $M.$  We will denote the multitude of these numbers by $\alpha.$


 * II. Numbers congruent to numbers from $f,$ $F^{\prime}$  modulo $m,$  $M,$  respectively, the multitude of which we set $=\beta.$


 * III. Numbers congruent to numbers from $f^{\prime},$ $F$  modulo $m,$  $M,$  respectively, the multitude of which we set $=\gamma.$


 * IV. Numbers congruent to numbers from $f^{\prime},$ $F^{\prime}$  modulo $m,$  $M,$  respectively, the multitude of which shall be $=\delta.$


 * V. Numbers divisible by $m,$ and congruent to one of the residues from $F$  modulo $M.$


 * VI. Numbers divisible by $m,$ and congruent to one of the residues from $F^{\prime}$  modulo $M.$


 * VII. Numbers divisible by $M,$ congruent to one of the residues from $f$  modulo $m.$


 * VIII. Numbers divisible by $M,$ congruent to one of the residues from $f^{\prime}$  modulo $m.$

Clearly, classes V and VI taken together will include all of the numbers $mF.$ The multitude of numbers contained in VI will be $=N,$  and hence the multitude of numbers contained in V will be $\frac{1}{2}(M-1)-N.$  Similarly, classes VII and VIII taken together will contain all numbers $Mf,$  in class VIII there will be $n$  numbers, and in class VII there will be $\frac{1}{2}(m-1)-n.$

Similarly, all the numbers $\varphi^{\prime}$ will be distributed into eight classes IX - XVI. If we maintain the same order, then it is easy to see that the numbers in the classes

IX, X, XI, XII, XIII, XIV, XV, XVI

are the complements modulo $mM$ of the numbers in the classes

IV, III, II, I, VI, V, VIII, VII

respectively, so that in class IX there will be $\delta$ numbers; in class X, there will be $\gamma,$  and so on. Now, it is clear that if all the numbers of the first class are joined with all the numbers of the ninth class, one will have all the numbers below $m M$ which are congruent to some number from $f$  modulo $m$ , and to some number from $F$  modulo $M.$  It is easily seen that the multitude of these is equal to the multitude of all combinations of one individual from $f$  and one individual from $F.$  Therefore,

$$\alpha+\delta=\frac{1}{4}(m-1)(M-1)$$

and by a similar argument

$$\beta+\gamma=\frac{1}{4}(m-1)(M-1)$$

By joining all numbers of classes II, IV, VI, we will clearly have all numbers below $\frac{1}{2} m M,$ which are congruent to some residue from $F^{\prime}$  modulo $M.$  Moreover, these same numbers can also be presented as follows:

$$F^{\prime}, M+F^{\prime}, 2 M+F^{\prime}, 3 M+F^{\prime} \ldots \frac{1}{2}(m-3) M+F^{\prime}$$

from which the total number of them will be $=\frac{1}{4}(m-1)(M-1),$ or in other words we will have

$$\beta+\delta+N=\frac{1}{4}(m-1)(M-1)$$

Similarly, by joining the classes III, IV, VIII, it follows that

$$\gamma+\delta+n=\frac{1}{4}(m-1)(M-1)$$

From this the following four equations arise:

$$\begin{aligned} &2 \alpha=\frac{1}{4}(m-1)(M-1)+n+N \\ &2 \beta=\frac{1}{4}(m-1)(M-1)+n-N \\ &2 \gamma=\frac{1}{4}(m-1)(M-1)-n+N \\ &2 \delta=\frac{1}{4}(m-1)(M-1)-n-N \end{aligned}$$

each of which demonstrates the truth of the theorem.

3.
If we now assume that $m$ and $M$  are prime numbers, the combination of the previous theorem with the lemma of article 1 immediately yields the fundamental theorem. For it is clear that,


 * I. Whenever one or both of $m,$ $M$  is of the form $4k+1,$  the number $\frac{1}{4}(m-1)(M-1)$  will be even, and therefore $n$  and $N$  will either be both even or both odd, and thus either $m$  and $M$  are both quadratic residues modulo each other, or both are quadratic non-residues modulo each other.


 * II. Whenever $m,$ $M$  are both of the form $4k+3,$  the number $\frac{1}{4}(m-1)(M-1)$  will be odd, hence one of the numbers $n,$  $N$  will be even and the other odd, and therefore one of the numbers $m,$  $M$  will be a quadratic residue modulo the other, and the other will be a quadratic non-residue modulo the one. Q. E. D.

1.
''Let $p$ be a prime number (odd positive), let $n$  be a positive integer not divisible by $p,$  and let $x$  be an indeterminate quantity. Then the function''

$$1+x^{n}+x^{2 n}+x^{3 n}+\text{etc.}+x^{n p-n}$$

will be divisible by

$$1+x+x x+x^{3}+\text{etc.}+x^{p-1}$$

Let $g$ be a positive integer such that $g n \equiv 1\pmod{p},$  and let $g n=1+h p.$  Then we have

$$\begin{aligned} \frac{1+x^{n}+x^{2 n}+x^{3 n}+\text{etc.}+x^{n p-n}}{1+x+x x+x^{3}+\text{etc.}+x^{p-1}}=\frac{(1-x^{n p})(1-x)}{(1-x^{n})(1-x^{p})} & =\frac{(1-x^{n p})(1-x^{g n}-x+x^{h p+1})}{(1-x^{n})(1-x^{p})} \\ & =\frac{1-x^{n p}}{1-x^{p}} \cdot \frac{1-x^{g n}}{1-x^{n}}-\frac{x(1-x^{n p})}{1-x^{n}} \cdot \frac{1-x^{h p}}{1-x^{p}} \end{aligned}$$

and therefore the function is clearly integral. Q. E. D.

It follows that any integral function of $x$ which is divisible by $\frac{1-x^{n p}}{1-x^{n}},$  will also be divisible by $\frac{1-x^{p}}{1-x}.$

2.
Let $\alpha$ denote a positive primitive root modulo $p,$  i. e. , let $\alpha$ be a positive integer such that the minimal positive residues of the powers $1,$  $\alpha,$  $\alpha \alpha,$  $\alpha^{3},$  $\ldots,$  $\alpha^{p-2}$  modulo $p$  are identical (without regard to order) to the numbers $1,$  $2,$  $3,$  $4,$  $\ldots,$  $p-1.$   Furthermore, denoting the function

$$x+x^{\alpha}+x^{\alpha \alpha}+x^{\alpha^{3}}+\ldots+x^{\alpha^{p-2}}+1$$

by $f(x),$ it is clear that $f(x)-1-x-x x-x^{3}-\ldots-x^{p-1}$  will be divisible by $1-x^{p},$  and therefore a fortiori by $\frac{1-x^{p}}{1-x}=1+x+x x+x^{3}+\ldots+x^{p-1}.$  From this it follows, since $x$  is an indeterminate quantity, that $f(x^{n})$  will also be divisible by $\frac{1-x^{n p}}{1-x^{n}}$  and consequently (by the previous article) also by $\frac{1-x^{p}}{1-x},$  as long as $n$  is an integer not divisible by $p.$  Conversely, whenever $n$  is an integer divisible by $p,$  each part of the function $f(x^{n}),$  reduced by unity, will be divisible by $1-x^{p}.$  Therefore in this case, $f(x^{n})-p$  will also be divisible by $1-x^{p},$  and consequently also by $\frac{1-x^{p}}{1-x}.$

3.
If we set

$$x-x^{\alpha}+x^{\alpha \alpha}-x^{\alpha^{3}}+x^{\alpha^{4}}-\text{etc.}-x^{\alpha^{p-2}}=\xi$$

then $\xi \xi \mp p$ will be divisible by $\frac{1-x^{p}}{1- x},$  if we take the upper sign whenever $p$  is of the form $4k+1$  and the lower sign whenever $p$  is of the form $4k+3.$ 

It can easily be seen that, of the $p-1$ functions

$$\begin{aligned} & +x \xi-x x+x^{\alpha+1}-x^{\alpha \alpha+1}+\text{etc.}+x^{\alpha^{p-2}+1} \\ & -x^{\alpha} \xi-x^{2 \alpha}+x^{\alpha \alpha+\alpha}-x^{\alpha^{3}+\alpha}+\text{etc.}+x^{\alpha^{p-1}+\alpha} \\ & +x^{\alpha \alpha} \xi-x^{2 \alpha \alpha}+x^{\alpha^{3}+\alpha \alpha}-x^{\alpha^{4}+\alpha \alpha}+\text{etc.}+x^{\alpha^{p}+\alpha \alpha} \\ & -x^{\alpha^{3}} \xi-x^{2 \alpha^{3}}+x^{\alpha^{4}+\alpha^{3}}-x^{\alpha^{5}+\alpha^{3}}+\text{etc.}+x^{\alpha^{p+1}+\alpha^{3}} \end{aligned}$$

etc. up to

$$-x^{\alpha^{p-2}} \xi-x^{2 \alpha^{p-2}}+x^{\alpha^{p-1}+\alpha^{p-2}}-x^{\alpha^{p}+\alpha^{p-2}}+\text{etc.}+x^{\alpha^{2 p-4}+\alpha^{p-2}}$$

the first will be $=0,$ and each of the others will be divisible by $1-x^{p}.$  Therefore, the sum of all these will also be divisible by $1-x^{p}.$  This sum is

$$\begin{aligned} &=\xi \xi-(f(x x)-1)+(f(x^{\alpha+1})-1)-(f(x^{\alpha \alpha+1})-1)+(f(x^{\alpha^{3}+1})-1)-\text{etc.}+(f(x^{\alpha^{p-2}+1})-1)\\ &=\xi \xi-f(x x)+f(x^{\alpha+1})-f(x^{\alpha \alpha+1})+f(x^{\alpha^{3}+1})-\text{etc.}+f(x^{\alpha^{p-2}+1})=\Omega \end{aligned}$$

Therefore, this expression $\Omega$ will also be divisible by $\frac{1-x^{p}}{1-x}.$  Now among the exponents $2,$  $\alpha+1,$  $\alpha \alpha+1,$  $\alpha^{3}+1 \ldots \alpha^{p-2}+1,$  the only one divisible by $p$  will be $\alpha^{\frac{1}{2}(p-1)}+1,$  and so by the previous article, the individual parts of the expression $\Omega,$

$$f(x x), f(x^{\alpha+1}), f(x^{\alpha \alpha+1}), f(x^{\alpha^{3}+1}) \text{ etc.}$$

except for the term $f(x^{\alpha^{\frac{1}{2}(p-1)}+1}),$ will be divisible by $\frac{1-x^{p}}{1-x}.$  It is therefore permissible to delete those parts, and the remaining function

$$\xi \xi \mp f(x^{\alpha^{\frac{1}{2}(p-1)}+1})$$

will still be divisible by $\frac{1-x^{p}}{1-x}.$ Above the sign will be positive or negative, depending on whether $p$  is of the form $4k+1$  or $4k+3.$  And since $f(x^{\alpha^{\frac{1}{2}(p-1)}+1})-p$  is divisible by $\frac{1-x^{p}}{1-x},$  it follows that $\xi \xi \mp p$  will also be divisible by $\frac{1-x^{p}}{1-x}.$  Q.E.D.

To avoid any ambiguity from the double sign, we will denote by $\varepsilon$ the number $+1$  or $-1,$  according to whether $p$  is of the form $4k+1$  or $4k+3.$  Therefore,

$$\frac{(1-x)(\xi \xi-\varepsilon p)}{1-x^{p}}$$

will be an integral function of $x,$ which we will denote by $Z.$

4.
Let $q$ be a positive odd number, so that $\frac{1}{2}(q-1)$  an integer. Then $(\xi \xi)^{\frac{1}{2}(q-1)}-(\varepsilon p)^{\frac{1}{2}(q-1)}$ will be divisible by $\xi \xi-\varepsilon p,$  and therefore also by $\frac{1-x^{p}}{1-x}.$  If we set $\varepsilon^{\frac{1}{2}(q-1)}=\delta,$  and

$$\xi^{q-1}-\delta p^{\frac{1}{2}(q-1)}=\frac{1-x^{p}}{1-x} \cdot Y$$

then $Y$ will be an integral function of $x,$  and we will have $\delta=+1$  whenever one of the numbers $p,$  $q,$  or both, is of the form $4k+1;$  on the other hand, we will have $\delta=-1$  whenever both $p,$  $q$  are of the form $4k+3.$

5.
Now, let us assume that $q$ is also a prime number (different from $p$ ). Then it is clear from the theorem proven in Disquisitiones Arithmeticae, art. 51, that

$$\xi^{q}-(x^{q}-x^{q \alpha}+x^{q \alpha \alpha}-x^{q \alpha^{3}}+\text{etc.}-x^{q \alpha^{p-2}})$$

is divisible by $q,$ or of the form $qX,$  where $X$  is an integral function of $x,$  even with respect to its numerical coefficients (which also applies to the other integral functions occurring here, $Z,$  $Y,$  $W$ ). Let us denote by $\mu$ the index of the number $q$  with respect to the primitive root $\alpha$  modulo $p,$  i. e. let $q \equiv \alpha^{\mu}\pmod{p}.$ Then the numbers $q,$  $q \alpha,$  $q \alpha \alpha,$  $q \alpha^{3}\ldots q \alpha^{p-2}$  will be congruent to $\alpha^{\mu},$  $\alpha^{\mu+1},$  $\alpha^{\mu+2}\ldots \alpha^{p-2},$  $1,$  $\alpha,$  $\alpha \alpha\ldots \alpha^{\mu-1}$  modulo $p,$  and thus

$$\begin{aligned} &x^{q}-x^{\alpha^{\mu}} \\ &x^{q \alpha}-x^{\alpha^{\mu+1}} \\ &x^{q \alpha \alpha}-x^{\alpha^{\mu+2}} \\ &x^{q \alpha^{3}}-x^{\alpha^{\mu+3}}\\ &\quad \vdots \\ &x^{q \alpha^{p-\mu-2}}-x^{\alpha^{p-2}}\\ &x^{q \alpha^{p-\mu-1}}-x\\ &x^{q \alpha^{p-\mu}}-x^{\alpha}\\ &x^{q \alpha^{p-\mu+1}}-x^{\alpha \alpha}\\ &\quad \vdots\\ &x^{q\alpha^{p-2}}-x^{\alpha^{\mu-1}} \end{aligned}$$

will all be divisible by $1-x^{p}.$ Taking these quantities alternately positively and negatively, and adding them all up, it is clear that the function

$$x^{q}-x^{q \alpha}+x^{q \alpha \alpha}-x^{q \alpha \alpha^{3}}+\text{etc.}-x^{q \alpha^{p-2}}\mp \xi$$

will be divisible by $1-x^{p},$ provided that the sign is taken to be positive or negative depending on whether $\mu$  is even or odd, i.e. depending on whether $q$ is a quadratic residue or non-residue modulo $p.$  Therefore, let us set

$$x^{q}-x^{q \alpha}+x^{q \alpha}-x^{q \alpha^{3}}+\text{etc.}-x^{q \alpha^{p-2}}-\gamma \xi=(1-x^{p})W$$

where $\gamma=+1$ or $\gamma=-1$  depending on whether $q$  is a quadratic residue or non-residue modulo $p.$  Then it is clear that $W$  will be an integral function.

6.
Having made these preparations, we deduce by combining the preceding equations that

$$q \xi {X}=\varepsilon p(\delta p^{\frac{1}{2}(q-1)}-\gamma)+\frac{1-x^{p}}{1-x} \cdot(Z(\delta p^{\frac{1}{2}(q-1)}-\gamma)+Y \xi \xi-W \xi(1-x))$$

Suppose that upon dividing the function $\xi X$ by

$$x^{p-1}+x^{p-2}+x^{p-3}+\text{etc.}+x+1$$

we obtain a quotient $U$ and remainder $T,$  or in other words we have

$$\xi X=\frac{1-x^{p}}{1-x} \cdot U+T$$

where $U$ and $T$  are integral functions, even with respect to their numerical coefficients, and the degree of $T$  is lower than the divisor. Then we will have

$$q T-\varepsilon p(\delta p^{\frac{1}{2}(q-1)}-\gamma)=\frac{1-x^{p}}{1-x} \cdot(Z(\delta p^{\frac{1}{2}(q-1)}-\gamma)+Y \xi \xi-W \xi(1-x)-q U)$$

which is obviously false unless the left member and the right member both vanish individually. Thus $\varepsilon p(\delta p^{\frac{1}{2}(q-1)}-\gamma)$ will be divisible by $q,$  and also $\delta p^{\frac{1}{2}(q-1)}-\gamma,$  and therefore, because $\delta \delta=1,$  the number $p^{\frac{1}{2}(q-1)}-\gamma \delta$  will be divisible by $q.$

Now if $\beta$ denotes a positive or negative unit, depending on whether $p$  is a quadratic residue or non-residue modulo $q,$  then $p^{\frac{1}{2}(q-1)}-\beta$  will be divisible by $q,$  and therefore so will be $\beta-\gamma \delta,$  which cannot happen unless $\beta=\gamma \delta.$  Hence, the fundamental theorem follows automatically. Namely,


 * I. Whenever both $p,$ $q,$  or one of them alone, is of the form $4 k+1,$  and consequently $\delta=+1,$  we will have $\beta=\gamma,$  and thererfore either $q$  is a quadratic residue mduloo $p,$  and $p$  is simultaneously a quadratic residue modulo $q,$  or $q$  is a quadratic non-residue modulo $p,$  and simultaneously $p$  is a quadratic non-residue modulo $q.$


 * II. Whenever both $p,$ $q$  are of the form $4 k+3,$  and consequently $\delta=-1,$  we will have $\beta=-\gamma,$  and therefore either $q$  is a quadratic residue modulo $p,$  and simultaneously $p$  is a quadratic non-residue modulo $q,$  or $q$  is a non-residue modulo $p,$  and simultaneously $p$  is a residue modulo $q.$  Q. E. D.

1.
Before we present a new solution to this problem, we will briefly repeat the solution given in Disquisitiones Arithmeticae, which was accomplished quite expediently with the help of the fundamental theorem and the following well-known theorems:


 * I. The relation of a number $a$ to a number $b$  (insofar as the former is a quadratic residue or non-residue modulo the latter) is the same as the relation of a number $c$  to $b,$  if $a \equiv c\pmod{b}.$


 * II. If $a$ is a product of factors $\alpha,$  $\beta,$  $\gamma,$  $\delta,$  etc ., and $b$  is a prime number, then the relation of $a$  to $b$  will depend on the relation of these factors to $b,$  so that $a$  will be a quadratic residue or non-residue depending on whether there is an even or odd number of such factors which are quadratic non-residues modulo $b.$  Thus, whenever any factor is a square, it will not be considered at all in this examination; and if any factor is a power of an integer with an odd exponent, it can be replaced with that integer instead.


 * III. The number 2 is a quadratic residue modulo any prime number of the form $8m+1$ or $8m+7,$  and a non-residue modulo any prime number of the form $8m+3$  or $8m+5.$

Therefore, given a number $a$ whose relation to the prime number $b$  is sought, we first substitute the minimal positive residue of $a$  modulo $b$  in place of $a.$  Then, after resolving this residue into its prime factors, the problem is reduced by theorem II to the determination of the relations of each of these factors to $b.$  The relation of the factor 2 (if it is present an odd number of times) to $b$  is known by theorem III. The relations of the remaining factors to $b$  known by the fundamental theorem. Thus instead of the relation of the given number to the prime number $b,$ we must now investigate the relations of $b$  to certain other odd primes smaller than $b$, and these problems will be reduced in the same way to smaller moduli, and it is clear that these successive reductions will eventually be exhausted.

2.
To illustrate this solution by an example, let us seek the relation of the number $103$ to $379.$  Since $103$  is already less than $379,$  and is itself a prime number, the fundamental theorem must be applied immediately, which tells us that the relation we seek is the opposite of the relation of the number $379$  to $103.$  This in turn is equal to the relation of the number $70$  to $103,$  which depends on the relations of the numbers $2,$  $5,$  $7$  to $103.$  The first of these relations is revealed by theorem III. The second, by the fundamental theorem, depends on the relation of the number $103$ to $5,$  which by theorem I is equal to the relation of the number $3$  to $5;$  this, in turn, by the fundamental theorem, depends on the relation of the number $5$  to $3,$  which by theorem I is equal the relation of the number $2$  to $3,$  which is known by theorem III. Likewise, the relation of the number $7$ to $103$  depends, by the fundamental theorem, on the relation of the number $103$  to $7,$  which by theorem I is equal to the relation of the number $5$  to $7;$  this, in turn, by the fundamental theorem, depends on the relation of the number $7$  to $5,$  which is equal, by theorem I, to the relation of the number $2$  to $5,$  which is known by theorem III. If one prefers to transform this analysis into a synthesis, the decision of the question will be referred to the fourteen points, which we present here in full, so that the greater concision of the new solution may be the more clearly understood.


 * 1) The number $2$  is a quadratic residue modulo $103$  (theorem III).
 * 2) The number $2$  is a quadratic non-residue modulo $3$  (theorem III).
 * 3) The number $5$  is a quadratic non-residue modulo $3$  (by 1 and 2).
 * 4) The number $3$  is a quadratic non-residue modulo $5$  (fund . theorem and 3).
 * 5) The number $103$  is a quadratic non-residue modulo $5$  (1 and 4).
 * 6) The number $5$  is a quadratic non-residue modulo $103$  (fund . theorem and 5).
 * 7) The number $2$  is a quadratic non-residue modulo $5$  (theorem III).
 * 8) The number $7$  is a quadratic non-residue modulo $5$  (1 and 7).
 * 9) The number $5$  is a quadratic non-residue modulo $7$  (fund . theorem and 8).
 * 10) The number $103$  is a quadratic non-residue modulo $7$  (1 and 9).
 * 11) The number $7$  is a quadratic residue modulo $103$  (fund . theorem and 10).
 * 12) The number $70$  is a quadratic non-residue modulo $103$  (II, 1, 6, 11).
 * 13) The number $379$  is a quadratic non-residue modulo $103$  (1 and 12).
 * 14) The number $103$  is a quadratic residue modulo $379$  (fund . theorem and 13).

In the following, for the sake of brevity, we will use the notation introduced in ''Comment. Gotting. Vol.'' XVI. Namely, by $[x]$ we will denote the quantity $x$  itself, if $x$  is an integer, or the greatest integer smaller than $x,$  if $x$  is a fractional quantity, so that $x-[x]$  is always a non-negative quantity less than unity.

3.
If $a$ and $b$  are positive integers which are relatively prime to each other, and $\left[\frac{1}{2} a\right]=a^{\prime},$  evaluate the sum

$$\left[\frac{b}{a}\right]+\left[\frac{2 b}{a}\right]+\left[\frac{3 b}{a}\right]+\left[\frac{4 b}{a}\right]+\text{etc.}+\left[\frac{a^{\prime} b}{a}\right]$$

For the sake of brevity, let us denote the sum in question by $\varphi(a, b),$ so that

$$\varphi(b, a)=\left[\frac{a}{b}\right]+\left[\frac{2 a}{b}\right]+\left[\frac{3 a}{b}\right]+\text{etc.}+\left[\frac{b^{\prime} a}{b}\right]$$

if we set $\left[\frac{1}{2} b\right]=b^{\prime}.$ It was shown in the demonstration of the third fundamental theorem that in the case where $a$  and $b$  are both odd, we have

$$\varphi(a, b)+\varphi(b, a)=a^{\prime} b^{\prime}$$

As we already mentioned there, the truth of this proposition can also be extended to the case where only one of the numbers $a,$ $b$  is odd, by following the same method. Let $a$ be divided by $b$  in a manner analogous to the method by which the greatest common divisor of two integers is investigated, let $\beta$  be the quotient, and let $c$  be the remainder; then divide $b$  by $c$  and so on in a similar manner, so as to obtain equations

$$\begin{aligned} & a=\beta b+c \\ & b=\gamma c+d \\ & c=\delta d+e \\ & d=\varepsilon e+f \text{ etc.} \end{aligned}$$

In this way, through a series of continually decreasing numbers $b,$ $c,$  $d,$  $e,$  $f$  etc. , we shall eventually arive at unity, since by hypothesis $a$ and $b$  are coprime. Then the final equation will be

$$k=\lambda l+1$$

We clearly have

$$\begin{aligned} & {\left[\frac{a}{b}\right]=\left[\beta+\frac{c}{b}\right]=\beta+\left[\frac{c}{b}\right]} \\ & {\left[\frac{2 a}{b}\right]=\left[2 \beta+\frac{2 c}{b}\right]=2 \beta+\left[\frac{2 c}{b}\right]} \\ & {\left[\frac{3 a}{b}\right]=\left[3 \beta+\frac{3 c}{b}\right]=3 \beta+\left[\frac{3 c}{b}\right]} \end{aligned}$$

etc., so

$$\varphi(b, a)=\varphi(b, c)+\frac{1}{2} \beta (b^{\prime} b^{\prime}+b^{\prime})$$

and therefore

$$\varphi(a, b)=a^{\prime} b^{\prime}-\frac{1}{2} \beta (b^{\prime} b^{\prime}+b^{\prime})-\varphi(b, c)$$

By similar reasoning, if we set $\left[\frac{1}{2} c\right]=c^{\prime},$ $\left[\frac{1}{2} d\right]=d^{\prime},$  $\left[\frac{1}{2} e\right]=e^{\prime}$  etc. , then

$$\begin{aligned} & \varphi(b, c)=b^{\prime} c^{\prime}-\frac{1}{2} \gamma(c^{\prime} c^{\prime}+c^{\prime})-\varphi(a, d) \\ & \varphi(c, d)=c^{\prime} d^{\prime}-\frac{1}{2} \delta(d^{\prime} d^{\prime}+d^{\prime})-\varphi(d, e) \\ & \varphi(d, e)=d^{\prime} e^{\prime}-\frac{1}{2} \varepsilon(e^{\prime} e^{\prime}+e^{\prime})-\varphi(e, f) \end{aligned}$$

etc. up to

$$\varphi(k, l)=k^{\prime} l^{\prime}-\frac{1}{2} \lambda(l^{\prime} l^{\prime}+l^{\prime})-\varphi(l, 1)$$

Therefore, since it is obvious that $\varphi(l, 1)=0,$ we obtain the formula

$$\begin{aligned} \varphi(a, b)=&a^{\prime} b^{\prime}-b^{\prime} c^{\prime}+c^{\prime} d^{\prime}-d^{\prime} e^{\prime}+\text{etc.} \pm k^{\prime} l^{\prime} \\ &-\frac{1}{2} \beta (b^{\prime} b^{\prime}+b^{\prime})+\frac{1}{2} \gamma(c^{\prime} c^{\prime}+c^{\prime})-\frac{1}{2} \delta(d^{\prime} d^{\prime}+d^{\prime})+\frac{1}{2} \varepsilon(e^{\prime} e^{\prime}+e^{\prime})-\text{etc.} \mp \frac{1}{2} \lambda(l^{\prime} l^{\prime}+l^{\prime}) \end{aligned}$$

4.
It is easily concluded from what was set forth in the third proof, that the relation of the number $b$ to $a,$  whenever $a$  is a prime number, is automatically known from the value of the sum $\varphi(a, 2 b).$  Namely, $b$  will be a quadratic residue or non-residue modulo $a$  according to whether this sum is an even or odd number. The sum $\varphi(a, b)$ itself can be used for the same purpose, but with the restriction that the case where $b$  is odd must be distinguished from the case where it is even. Specifically,


 * I. Whenever $b$ is odd, $b$  will be a quadratic residue or non-residue modulo $a,$  depending on whether $\varphi(a, b)$  is even or odd.


 * II. Whenever $b$ is even, the same rule will hold, if in addition $a$  is of the form $8n+1$  or of the form $8n+7.$  If however, for an even value of $b$  the modulus $a$  is of the form $8n+3$  or $8n+5,$  the opposite rule must be applied, namely that $b$  will be a quadratic residue modulo $a$  if $\varphi(a, b)$  is odd, but it will be a non-residue if $\varphi(a, b)$  is even.

All of this is very easily derived from article 4 of the third proof.

5.
Example. If the ratio of the number 103 to the prime number 379 is sought, then to find the sum $\varphi(379,103),$ we first compute

$$\begin{array}{r|r|r} a= 379 & a^{\prime}=189 & \\ b= 103 & b^{\prime}=\phantom{0}51 & \beta=3 \\ c= \phantom{0}70 & c^{\prime}=\phantom{0}35 & \gamma=1 \\ d= \phantom{0}33 & d^{\prime}=\phantom{0}16 & \delta=2 \\ e= \phantom{00}4 & e^{\prime}=\phantom{00}2 & \varepsilon=8 \end{array}$$

hence

$$\varphi(379,103)=9639-1785+560-32-3978+630-272+24=4786$$

and thus $103$ is a quadratic residue modulo $379.$  If we want to use the sum $\varphi(379,206)$  for the same purpose, we have the following pattern,

$$ \begin{array}{r|r|r} 379&189&\\ 206&103&1\\ 173&86&1\\ 33&16&5\\ 8&4&4\end{array}$$

from which we deduce

$$\varphi(379,206)=19467-8858+1376-64-5356+3741-680+40=9666$$

and thus 103 is a quadratic residue modulo 379.

6.
Since in order to determine the relation of $b$ to $a,$  it is not necessary to compute each part of the aggregate $\varphi(a, b),$  but rather it is sufficient to know how many of them are odd, our rule can also be expressed as follows:

Let $a = \beta b+c,$ $b = \gamma c+d,$  $c = \delta d+e$  etc. , until the series of numbers $a,$ $b,$  $c,$  $d,$  $e$  etc. reaches unity. Set $\left[\frac{1}{2} a\right]=a^{\prime},$ $\left[\frac{1}{2} b\right]=b^{\prime},$  $\left[\frac{1}{2} c\right]=c^{\prime}$  etc. , and let $\mu$ be the multitude of odd numbers in the series $a^{\prime},$  $b^{\prime},$  $c^{\prime}$  etc. which are immediately followed by an odd number; further, let $\nu$ be the multitude of odd numbers in the series $\beta,$  $\gamma,$  $\delta$  etc. , such that the corresponding number in the series $b^{\prime},$ $c^{\prime},$  $d^{\prime}$  etc. is of the form $4n+1$ or $4n+2.$  With this being done, $b$  will be a quadratic residue or non-residue modulo $a,$  depending on whether $\mu + \nu$  is even or odd, except in the case where $b$  is even and $a$  is of the form $8n+3$  or $8n+5,$  in which case the opposite rule holds.

In our example, the sequence $a^{\prime},$ $b^{\prime},$  $c^{\prime},$  $d^{\prime},$  $e^{\prime}$  has two consecutive pairs of odd numbers, hence $\mu =2,$  and in the series $b^{\prime},$  $c^{\prime},$  $d^{\prime},$  $e^{\prime},$  there are two odd numbers, but the corresponding numbers in $b^{\prime},$  $c^{\prime},$  $d^{\prime},$  $e^{\prime}$  are of the form $4n+3,$  hence $\nu = 0.$  Therefore, $\mu + \nu$  is even, and it follows that 103 is a quadratic residue modulo 379.