The Jacobi symbol is a generalization of the Legendre symbol. In this post, we define the Jacobi symbol and discuss some of its important properties. The Legendre symbol (coupled with the law of reciprocity) is a useful tool in determining whether a number is a quadratic residue modulo an odd prime. However, the Legendre symbol is also restrictive since the bottom argument must be a prime. The Jacobi symbol generalizes the Legendre symbol and in many cases is easier to evaluate than the Legendre symbol. This is demonstrated in several examples.

____________________________________________________________________________

**Defining The Jacobi Symbol**

The Legendre symbol is where the bottom argument is always an odd prime and the top argument can be any integer. When is an integer that is relatively prime to the odd prime , the Legendre symbol carries information on whether the integer is quadratic residue modulo . The following gives the definition of the Legendre symbol.

The Jacobi symbol has the same look as the Legendre symbol. The top argument can be any integer. The bottom argument is an odd positive integer. If the odd positive integer has the prime factorization , the Jacobi symbol is defined as follows:

For convenience, we define . A slightly different, but equivalent, definition is that whenever the odd integer has the prime factorization (the prime numbers are not necessarily distinct), the symbol is defined as follows:

The Jacobi symbol is defined using the Legendre symbol according to the prime factorization of the bottom argument.

____________________________________________________________________________

**Properties of The Jacobi Symbol**

Now that the Jacobi symbol has been defined based on the Legendre symbol, there are two natural questions.

- Does the value of indicates that is a quadratic residue or nonresidue modulo ?
- The Legendre symbol follows a set of rules (e.g. the law of quadratic reciprocity) that make the Legendre symbol a versatile tool. Does the Jacobi symbol follow these rules? Conceptually, evaluating the Jacobi symbol requires factoring the bottom argument of the symbol. On the surface, this appears to be a limitation. However, if the Jacobi symbol follows the rules for the Legendre symbol including the law of quadratic reciprocity, it will be just as easy to evaluate the Jacobi symbol.

For the first question, the following is true: If is a quadratic residue modulo , then . The contrapositive of this statement is that if , then the number is a quadratic nonresidue modulo the odd integer , i.e. the equation has no solutions. However, the value of does not imply that is a quadratic residue modulo . For example, but the equation has no solutions. Note that both equations and have no solutions. This means that the value of is the product of two Legendre symbols of -1.

*Theorem 1*

Let be an odd positive integer. Let be such that . Then If is a quadratic residue modulo , then . The converse does not hold if is not a prime.

*Proof*

Suppose that is a quadratic residue modulo , i.e. the equation has a solution. Let be the prime factorization of . Let for each . By the Chinese remainder theorem, the equation has a solution for each . it then follows that the equation has a solution too for each . Hence the Legendre symbol for each . It follows that the Jacobi symbol .

For the second question, the rules that are obeyed by the Legendre symbol are also obeyed by the Jacobi symbol. Some of the rules are easily seen to carry over to the Jacobi symbol. The fact that the law of quadratic reciprocity and the two supplements are obeyed by the Jacobi symbol is not entirely obvious from the definition. However the proof is not difficult. We give a complete proof here.

*Lemma 2*

Let and be odd positive integers. The following two conditions hold.

*Proof*

The lemma is established by the following derivation:

Because both and are odd integers, the right-hand-side of both equations are even integers and thus .

*Theorem 3 (Properties of Jacobi Symbol)*

- If is a prime, then the Jacobi symbol coincides with the Legendre symbol .
- If , then .
- The Jacobi symbol is multiplicative when the bottom argument is fixed, i.e. .
- The Jacobi symbol is multiplicative when the upper argument is fixed, i.e. .
**(The law of quadratic reciprocity)**

Let and be relatively prime odd positive integers. ThenEquivalently,

**(First supplement to the law of quadratic reciprocity)**

Let be an odd positive integer. Then-
.

Equivalently,

**(Second supplement to the law of quadratic reciprocity)**

Let be an odd positive integer. Then-
.

Equivalently,

*Proof*

For the first bullet point, if the top argument and the bottom argument have a prime factor in common, then one of the Legendre symbols that make up the Jacobi symbol is zero. If the top argument and the bottom argument have no prime factor in common, then all the Legendre symbols that make up the Jacobi symbol is either 1 or -1.

The second point is clear. If the bottom argument is an odd prime, the definition of Jacobi symbol leads to the Legendre symbol.

For bullet points 3, 4 and 5, simply write out the Jacobi symbol and then use the corresponding properties of the Legendre symbol.

Now the proof of bullet point 6 (the law of quadratic reciprocity). Let and be relatively prime. Let and be their prime factorizations. Note that the primes are not necessarily distinct and the primes are not necessarily distinct. However, since and are relatively prime. Consider the following derivation of the product .

where

The bullet point 6 is established after the quantity is simplified as follows:

Now consider the bullet point #7 (the first supplement to the law of quadratic reciprocity). The proof is an induction proof on the number of prime factors of . If is a prime, then it is done. So we assume (not necessarily distinct). Consider the following derivation:

It is a straightforward argument that whenever the property is true for being a product of primes, the property is true for being a product of primes. Thus bullet 7 is established.

The proof of bullet point 8 (the second supplement to the law of quadratic reciprocity) is also an induction proof on the number of prime factors of . The most important case is the of two prime factors.

With the 2-case established, it is straightforward to carry out the remainder of the induction proof of bullet 8.

____________________________________________________________________________

**Examples**

*Example 1*

Evaluate , an example where both the upper and lower arguments are primes. In the previous post, the example is calculated using only Legendre symbol. Here we work it in Jacobi symbol. As much as possible, we flip the symbol without factoring.

One advantage of using Jacobi symbol is that when the upper argument is an odd integer that is not prime, we can still flip it (the steps with *). Then reduce and then flip again until we reach a point with small numbers. Thinking in Legendre symbol only, the steps with * cannot be flipped. As Jacobi symbols, they can be flipped freely as long as the arguments are odd integers. The advantage may not be apparent in this example. When the composite integers are large to the point that their factorizations are in effect not obtainable, this advantage is huge.

*Example 2*

Evaluate where 1298351, an odd prime and 756479. This is Example 2 in this previous post. The number is not a prime. Here we use Jacobi symbol to demonstrate that factoring is not needed. We can start by flipping. We have the following derivation.

Note that the original symbol to evaluate is a Legendre symbol. The interim steps are done with Jacobi symbol as much as possible. With the Jacobi way, the symbol is flipped, reduced and flipped again multiple times. The derivation seems long. However, the flip-reduce-flip is much faster than factoring when the numbers involved are large.

*Example 3*

Evaluate where 12408107 and 4852777. Both numbers are not prime. The symbol has to be evaluated as a Jacobi symbol.

The above derivation seems long in that there are quite a few steps. But many of the steps are flip-reduce-flip-reduce that are easy to do. The steps are all done without factoring, except when the top argument is an even number. The Jacobi symbol is -1. In this case, it gives definite information about the status of quadratic nonresidues. We know for sure that is a quadratic nonresidue modulo the odd integer , i.e. the equation has no solutions.

*Example 4*

Evaluate where 48746413 and 17327467. Both numbers are not prime. As in Example 3, the symbol is evaluated using Jacobi symbol.

The result of gives ambiguous information about the status of 17327467 being a quadratic residue or nonresidue modulo 48746413. In this case, the Jacobi symbol cannot tell us whether the equation has a solution. In such a case, the only way to know the status of quadratic residue is to know some additional information, namely the factoring of the numbers. This example is small enough that 3049 x 5683 and 7109 x 6857. With this information, the Jacobi symbol can be set up as follows:

By knowing the factoring of , the original Jacobi symbol is a product of two Legendre symbols. It can be shown that both of these Legendre symbols are -1. These two Legendre symbols corresponds to these two equations: and . The Legendre values of -1 indicate that these two equations have no solutions. By the Chinese remainder theorem, the equation has no solutions. Hence 17327467 is a quadratic nonresidue modulo 48746413=7109 x 6857.

____________________________________________________________________________

**Comments**

One versatile feature of the Jacobi symbol is that it can be used in evaluating the Legendre symbol, as shown in Example 1 and Example 2. The original Legendre symbol in Example 1 have arguments that are both odd prime and thus can be flipped right away. However, there are numbers in the interim steps that are odd and not prime. With the use of the Jacobi symbol, these interim numbers do have to be factored. The original Legendre symbol in Example 2 has a top argument that is odd and not prime. Treating it as a Jacobi symbol, it can be flipped right away. When numbers involved in Legendre symbol evaluation are large such that the factoring is not obtainable, the Jacobi symbol can be flipped and reduced and flipped again to obtain the answer of the Legendre symbol. The Jacobi symbol plays an outsize role in the evaluation of the Legendre symbol and thus is a pivotal tool in determining whether a number is a quadratic residue modulo an odd prime or the solvability of the equation .

Example 3 shows that when the Jacobi symbol produces the value of -1, the top argument is a quadratic nonresidue modulo the lower argument . Example 4 shows that when the Jacobi symbol produces the value of 1, the picture is murky. In such a case, settling the question of whether the top argument is a quadratic nonresidue modulo the lower argument requires additional information. Example 4 shows that if we can factor the lower argument , then evaluating the individual Legendre symbols (based on the prime factors) will help answer the original question. This points to the possibility that solving the equation is not feasible when the factorization of a large composite modulus is not obtainable.

____________________________________________________________________________