# Thue's lemma

Last updated

In modular arithmetic, Thue's lemma roughly states that every modular integer may be represented by a "modular fraction" such that the numerator and the denominator have absolute values not greater than the square root of the modulus.

## Contents

More precisely, for every pair of integers (a, m) with m > 1, given two positive integers X and Y such that Xm < XY, there are two integers x and y such that

$ay\equiv x{\pmod {m}}$ and

$|x| Usually, one takes X and Y equal to the smallest integer greater than the square root of m, but the general form is sometimes useful, and makes the uniqueness theorem (below) easier to state. 

The first known proof is attributed to AxelThue  ( 1902 )  who used a pigeonhole argument.   It can be used to prove Fermat's theorem on sums of two squares by taking m to be a prime p that is congruent to 1 modulo 4 and taking a to satisfy a2 + 1 = 0 mod p. (Such an "a" is guaranteed for "p" by Wilson's theorem.  )

## Uniqueness

In general, the solution whose existence is asserted by Thue's lemma is not unique. For example, when a = 1 there are usually several solutions (x, y) = (1, 1), (2, 2), (3, 3), ..., provided that X and Y are not too small. Therefore, one may only hope for uniqueness for the rational number x/y, to which a is congruent modulo m if y and m are coprime. Nevertheless, this rational number need not be unique; for example, if m = 5, a = 2 and X = Y = 3, one has the two solutions

$2a+1\equiv -a+2\equiv 0{\pmod {5}}$ .

However, for X and Y small enough, if a solution exists, it is unique. More precisely, with above notation, if

$2XY and

$ay_{1}-x_{1}\equiv ay_{2}-x_{2}\equiv 0{\pmod {m}}$ ,

with

$\left|x_{1}\right| and

$\left|x_{2}\right| then

${\frac {x_{1}}{y_{1}}}={\frac {x_{2}}{y_{2}}}.$ This result is the basis for rational reconstruction, which allows using modular arithmetic for computing rational numbers for which one knows bounds for numerators and denominators. 

The proof is rather easy: by multiplying each congruence by the other yi and subtracting, one gets

$y_{2}x_{1}-y_{1}x_{2}\equiv 0{\pmod {m}}.$ The hypotheses imply that each term has an absolute value lower than XY < m/2, and thus that the absolute value of their difference is lower than m. This implies that $y_{2}x_{1}-y_{1}x_{2}=0$ , hence the result.

## Computing solutions

The original proof of Thue's lemma is not efficient, in the sense that it does not provide any fast method for computing the solution. The extended Euclidean algorithm, allows us to provide a proof that leads to an efficient algorithm that has the same computational complexity of the Euclidean algorithm. 

More precisely, given the two integers m and a appearing in Thue's lemma, the extended Euclidean algorithm computes three sequences of integers (ti), (xi) and (yi) such that

$t_{i}m+y_{i}a=x_{i}\quad {\text{for }}i=0,1,...,$ where the xi are non-negative and strictly decreasing. The desired solution is, up to the sign, the first pair (xi, yi) such that xi < X.

## Related Research Articles In number theory, the Chinese remainder theorem states that if one knows the remainders of the Euclidean division of an integer n by several integers, then one can determine uniquely the remainder of the division of n by the product of these integers, under the condition that the divisors are pairwise coprime. In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers "wrap around" when reaching a certain value, called the modulus. The modern approach to modular arithmetic was developed by Carl Friedrich Gauss in his book Disquisitiones Arithmeticae, published in 1801. In number theory, the law of quadratic reciprocity is a theorem about modular arithmetic that gives conditions for the solvability of quadratic equations modulo prime numbers. Due to its subtlety, it has many formulations, but the most standard statement is:

Fermat's little theorem states that if p is a prime number, then for any integer a, the number apa is an integer multiple of p. In the notation of modular arithmetic, this is expressed as

In number theory, Euler's theorem states that if n and a are coprime positive integers, then a raised to the power of the totient of n is congruent to one, modulo n, or: In mathematics, factorization or factoring consists of writing a number or another mathematical object as a product of several factors, usually smaller or simpler objects of the same kind. For example, 3 × 5 is a factorization of the integer 15, and (x – 2)(x + 2) is a factorization of the polynomial x2 – 4.

This article collects together a variety of proofs of Fermat's little theorem, which states that

In number theory, Euler's criterion is a formula for determining whether an integer is a quadratic residue modulo a prime. Precisely, In mathematics, p-adic analysis is a branch of number theory that deals with the mathematical analysis of functions of p-adic numbers. In arithmetic and algebra, the cube of a number n is its third power, that is, the result of multiplying three instances of n together. The cube of a number or any other mathematical expression is denoted by a superscript 3, for example 23 = 8 or (x + 1)3.

A unit fraction is a rational number written as a fraction where the numerator is one and the denominator is a positive integer. A unit fraction is therefore the reciprocal of a positive integer, 1/n. Examples are 1/1, 1/2, 1/3, 1/4, 1/5, etc.

In additive number theory, Fermat's theorem on sums of two squares states that an odd prime p can be expressed as:

In algebraic number theory, the narrow class group of a number field K is a refinement of the class group of K that takes into account some information about embeddings of K into the field of real numbers.

In number theory, the law of quadratic reciprocity, like the Pythagorean theorem, has lent itself to an unusual number of proofs. Several hundred proofs of the law of quadratic reciprocity have been published.

In mathematics, particularly in the area of number theory, a modular multiplicative inverse of an integer a is an integer x such that the product ax is congruent to 1 with respect to the modulus m. In the standard notation of modular arithmetic this congruence is written as

Pocklington's algorithm is a technique for solving a congruence of the form

In computational number theory, Cornacchia's algorithm is an algorithm for solving the Diophantine equation , where and d and m are coprime. The algorithm was described in 1908 by Giuseppe Cornacchia.

Coppersmith's attack describes a class of cryptographic attacks on the public-key cryptosystem RSA based on the Coppersmith method. Particular applications of the Coppersmith method for attacking RSA include cases when the public exponent e is small or when partial knowledge of the secret key is available.

AN codes are error-correcting code that are used in arithmetic applications. Arithmetic codes were commonly used in computer processors to ensure the accuracy of its arithmetic operations when electronics were more unreliable. Arithmetic codes help the processor to detect when an error is made and correct it. Without these codes, processors would be unreliable since any errors would go undetected. AN codes are arithmetic codes that are named for the integers and that are used to encode and decode the codewords.

In algebraic number theory Eisenstein's reciprocity law is a reciprocity law that extends the law of quadratic reciprocity and the cubic reciprocity law to residues of higher powers. It is one of the earliest and simplest of the higher reciprocity laws, and is a consequence of several later and stronger reciprocity laws such as the Artin reciprocity law. It was introduced by Eisenstein (1850), though Jacobi had previously announced a similar result for the special cases of 5th, 8th and 12th powers in 1839.

• Shoup, Victor (2005). A Computational Introduction to Number Theory and Algebra (PDF). Cambridge University Press. Retrieved 26 February 2016.CS1 maint: discouraged parameter (link)
1. Shoup, theorem 2.33
2. Thue, A. (1902), "Et par antydninger til en taltheoretisk metode", Kra. Vidensk. Selsk. Forh., 7: 57–75
3. Clark, Pete L. "Thue's Lemma and Binary Forms". CiteSeerX  .Cite journal requires |journal= (help)
4. Löndahl, Carl (2011-03-22). "Lecture on sums of squares" (PDF). Retrieved 26 February 2016.Cite journal requires |journal= (help)CS1 maint: discouraged parameter (link)
5. Ore, Oystein (1948), Number Theory and its History, pp. 262–263
6. Shoup, section 4.6
7. Shoup, section 4.5