# Diophantine Equations - Modular Arithmetic Considerations

A useful technique for problems involving diophantine equations is reducing mod \( n \) for some well-chosen modulus \( n \). This is often a method for proving the nonexistence of solutions: if there are no solutions mod \( n \) for some \( n \), then there are no solutions over the integers. Occasionally it is also useful to narrow down the possible solutions based on solutions mod \( n \), but finding a complete set of solutions, when the set is nonempty, will almost always require more advanced techniques.

Solve in positive integers the equation \[x^2+4x+1=4y^2.\]

Taking both sides modulo 4, we get \[x^2+1\equiv 0 \pmod 4.\] However, \(x^2\equiv 0,1 \pmod 4\), so \[x^2+1\equiv 1,2 \pmod 4.\] Therefore, since the left hand side is never divisible by 4, the equation has no solutions in positive integers. \( _\square\)

## Choice of Modulus

Once the appropriate modulus is chosen, the verification that there are no solutions is often a straightforward computation. So the main difficulty in solving these types of problems is deciding which modulus to use.

One guideline that is often helpful (and is used in the introductory example) is to choose moduli that make coefficients of the polynomials vanish. This often simplifies the equation and can help to eliminate variables.

Source: IMO 1982, Problem 4Show that \( x^3-3xy^2+y^3 =2891 \) has no integer solutions \( x,y \).

Look mod \( 7 \). The equation becomes \( x^3-3xy^2+y^3 \equiv 0 \pmod{7} \).

If \( x \equiv 0 \pmod{7}\), then \( y \equiv 0 \pmod{7} \), but this is impossible since \( 7^3 \nmid 2891 \). Now suppose \( x \not\equiv 0 \pmod{7}\). Let \( u \equiv y/x \pmod{7}\). Dividing through by \( x^3 \) gives \[ 1-3u^2+u^3 \equiv 0 \pmod{7} \] and it is easy to check that this has no solutions. \(_\square\)

For Diophantine equations which are polynomials in the unknowns, a good choice tends to be an odd prime \( p \) for which the key exponent divides \( p-1 \). This is due to the fact that \[ \frac1{\text{gcd}(k,p-1)} \] of the nonzero elements mod \(p\) are \( k^\text{th}\) powers mod \( p \) (see the wiki on primitive roots for details), and the most helpful and restrictive conditions come from taking a \( p \) for which that fraction is minimized, which happens when the denominator is \(k\).

Show that \( x^5+113y^5 = 137 \) has no integer solutions.

Look mod \( 11 \): \( x^5 \) and \( y^5 \) are in \( \{-1,0,1\} \), so \( x^5+113y^5 \equiv x^5+3y^5\) is in \( \{ -4,-3,-2,-1,0,1,2,3,4 \} \) mod \( 11 \). But \( 137 \equiv 5 \). So there are no solutions mod \( 11\), hence no solutions. \(_\square\)

Note that looking mod \( 113 \) or mod \( 137 \) doesn't help here, because every number is a fifth power modulo either of those two primes.

Another common choice when the exponent is a prime \( p \) is a power of \( p \). As above, only \( 1/p\) of the integers relatively prime to \( p \) are \( p^\text{th}\) powers mod \( p^k\).

For instance, if the exponent is \(2\) or \( 4\), it is effective to use moduli of \( 8\) and \( 16\), respectively, since \( x^2 \equiv 1\) mod \( 8 \) for odd \( x \), and \( x^4 \equiv 0,1 \) mod \( 16 \) for any \( x \). (These choices can be extended for exponents which are higher powers of \(2\) as well.)

Source: USAMO 1979, Problem 1Find all nonnegative solutions in integers to \[ n_1^4 + n_2^4 + \cdots +n_{14}^4 = 1599. \]

Look mod \( 16 \). Then \( n_i^4 \equiv 0 \) or \( 1 \), so the left side is in \( \{ 0,1,2,\ldots,14\} \) mod \( 16 \), but the right side is \( 15 \) mod \( 16 \). So there are no solutions. \(_\square\)

The

three cubes problemis the subject of considerable contemporary research: for which values of \(n\) do integer solutions to \[ x^3+y^3+z^3=n \] exist? Show that for \( n = 32 \) there are no solutions. (The question of whether there is a solution for \( n = 33 \) is still wide open!)

Look mod \( 9 \). Cubes are \( -1,0,1 \), so their sum is in \( \{ -3,-2,-1,0,1,2,3 \} \). Thus any number congruent to \( \pm 4\) mod \( 9 \) cannot be written as a sum of three integer cubes. And \( 32 \equiv -4 \) mod \(9\).

(The conjecture is that any \( n \not\equiv \pm 4 \) mod \( 9 \) admits solutions, but there are lots of such \( n \) where solutions have not been found, including \( 33\) and \( 42 \).)

## Descent

Sometimes there are solutions mod \( n\), but only the "trivial" ones where the variables are \( 0 \). So \( n \) divides all the variables. Sometimes factoring \( n \) out leads to a contradiction, and sometimes it leads to a simpler equation.

For more examples, see the wiki on infinite descent.

## Diophantine Equations with Powers

This section deals with equations with terms of the form \(a^n\), where \(a\) is a given positive integer. The standard technique for solving this type of equation is manipulating the equation until the form, \(a^n=\text {product of several expressions},\) is obtained. In particular, if \(a\) is prime, then we can conclude by fundamental theorem of arithmetic that each factor in the product is a power of that prime. Even if \(a\) is a composite, it often boils down to caseworks after considerations of greatest common divisor. We give the following example to illustrate this technique:

Solve for \((p,n,x)\) in the following diophantine equation with prime \(p\) and positive integers \(x,n:\)

\[p^n+1=x^2.\]

Notice that we get a difference of squares by substrating \(1\) on both sides: \[p^n=x^2-1=(x-1)(x+1).\] From the opening discussion, we know each factor is a power of \(p\): \[\begin{align} x-1&=p^a \\ x+1&=p^b, \end{align}\] where \(a,b\) are non-negative integers that satisfy \(a+b=n\). Note that \(x+1>x-1\implies b>a\).

Subtracting the two equations gives \(p^b-p^a=2.\)

If \(a\ge 1\), then \(p\) is a divisor on the lefthand side, so \(p|2\implies p=2\). Also, \(a\le 1\) or else \(4|2\). Thus \(a=1\) and we have \(2^b-2^1=2\implies 2^b=4\implies b=2\), which gives the solution \((2,3,3)\).

If \(a=0\), then \(p^b=3\implies p=3, b=1\), which gives the solution \((3,1,2)\).

In conclusion, \((2,3,3),(3,1,2)\) are the only solutions to the equation. \(_\square\)

A fairly easy category of power equations to solve has the form \[a^x-b^y=1,\] where \(a,b\) are given positive integers. We will assume that \(a,b\) are relatively prime and \(x,y\) are positive. For those who are familiar with Zsigmondy theorem, it is easy to see that the equation has a finite number of solutions. Indeed, if we write the equation as \(a^x-1=b^y\), then we know there exists \(N\) such that for all \(x\ge N\), \(a^x-1\) has prime divisors that do not divide \(b\).

Although this heavy theorem gives us an upper bound of our solution, a more elementary and practical approach uses modular arithemetic. The general method is based on the fact that if a divisor of \(b\) always divides \(a^x-1\), then a fixed number must also always divide \(x\). This is just a property of order of an element: If \(a^x\equiv 1\pmod m\) and \(a,m=1\), then \(\text {ord}_m(a)|x\). On one hand, we get that \(\text {ord}_m(a)\) is even, which implies \(x\) is even and gives way to difference of squares. On the other hand, we get that \(a^{\text {ord}_m(a)}-1\) has prime divisors that do not divide \(b\). Since \(a^{\text {ord}_m(a)}-1|a^x-1=b^y\), we know there is no solution when this occurs. If neither of these cases happens, then choose a "larger" \(b\). We illustrate this in the examples below.

Solve \(11^x=2^y-1\) in positive integers.

From \(2^y\equiv 1 \pmod {11}\), we have \(\text {ord}_{11}(a)=10\implies 10|y\). It follows that \(2^{10}-1|2^y-1=11^x\), which is impossible because \(2^{10}-1=11\cdot 3\cdot 31\). Therefore this equation has no solution. \(_\square\)

Find all integers \(n,m\) such that \[|2^n-3^m|=1.\]

We first get the zero cases out of the way: \((n,m)=(1,0)\). Now assume that \(n,m\) are positive integers.

The absolute value means we have two cases:

Case 1: \(2^n-3^m=1\implies 2^n-1=3^m\)

Considering modulo \(3\) gives us \(2|n\). This result, however, is not strong enough as \(2^2-1=3\) does not contain prime divisors other than \(3\). What do we do now? Well, \(m=1\) produces the solution \((2,1)\). Now we assume \(m\ge 2\) and consider modulo \(3^2\). This gives us \(6|n\) and we can stop here because \(7|2^6-1\). Thus there is not a solution when \(m\ge 2\).Note that from \(2|n\) we could have proceeded differently using difference of squares, so try this yourself to check with the answers above.

Case 2: \(3^m-2^n=1\).

This case can be solved similarly as case 1. Here, however, we cannot conclude one of \(m,n\) being even, which means difference of square is out of the window. I will leave this case as an exercise for interested readers. \(_\square\)

What happens if our equation is \[a^x-b^y=n ~\text { with }~ n>1? \] Then in general, we cannot apply the method above because using order requires \(n\) to be \(1\). In these situations, choosing the right modulus often helps by giving us information about \(x,y\). Trying different modulus on the equation should be priority when solving these equations.

Find all positive integers \(m,n\) that satisfy \[|12^m-5^n|=7.\]

Case 1: \(5^n-12^m=7\). In modulo \(4\), this becomes \(1\equiv 3\pmod 4\), so there are no solutions for this case.

Case 2: \(12^m-5^n=7\) In modulo \(6\), this becomes \((-1)^n\equiv -1\pmod 6\), so \(n\) is odd. Note that \(m=n=1\) is a solution, so taking modulo \(5\) and \(4\) would not help. Instead, we can assume that \(m\ge 2\) and now we can analyze with modulo \(8\): \[5^n\equiv 1\pmod 8 \implies 2|n.\] This contradicts with \(n\) being odd, what we found earlier. So \(m=n=1\) is our only solution. \(_\square\)

The harder example below demonstrates another useful technique: Use modulus that have the same orders.

Prove that \(x=y=1\) is the only positive integer solution to the diophantine solution

\[5^x-3^y=2.\]

We first write the expression in the form of \[(2+3)^x-3^y=2.\]

Now, using binomial expansion, \((2+3)^x\) = \(2^x+3p\), where \(p\) is an integer.

\[2^x+3p-3^y=2\]

It is evident from the equation that \(3p-3^y\) needs to be 0, as \(2^a+3^b=2^c\) can not have any solution. This results in \(x=y=1\)

**Cite as:**Diophantine Equations - Modular Arithmetic Considerations.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/general-diophantine-equations-modular-arithmetic/