ArticleslgStudy

mathematics

Congruence of squares

Congruence of squares is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Congruence of squares rather than just read about it. In short: In number theory, a congruence of squares is a congruence commonly used in integer factorization algorithms. Derivation Given a positive integer n, Fermat's factorization method relies on finding numbers x and y satisfying the equality x2−y2=n We can then factor n = x2 − y2 = (x + y)(x − y).

Key takeaways

  • Congruence of squares belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Congruence of squares to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Congruence of squares from memory before moving on to harder problems.

Reference excerpt

In number theory, a congruence of squares is a congruence commonly used in integer factorization algorithms.

Derivation Given a positive integer n, Fermat's factorization method relies on finding numbers x and y satisfying the equality

x2−y2=n We can then factor n = x2 − y2 = (x + y)(x − y). This algorithm is slow in practice because we need to search many such numbers, and only a few satisfy the equation. However, n may also be factored if we can satisfy the weaker congruence of squares conditions:

x2≡y2(modn) x≢±y(modn) From the first of these, we easily deduce

x2−y2≡0(modn) (x+y)(x−y)≡0(modn) This means that n divides the product (x + y)(x − y). The second non-triviality condition guarantees that n does not divide (x + y) nor (x − y) individually. Thus (x + y) and (x − y) each contain some, but not all, factors of n, and the greatest common divisors of (x + y, n) and of (x − y, n) will give us these factors. This can be done quickly using the Euclidean algorithm. Most algorithms for finding congruences of squares do not actually guarantee non-triviality; they only make it likely. There is a chance that a congruence found will be trivial, in which case we need to continue searching for another x and y. Congruences of squares are extremely useful in integer factorization algorithms. Conversely, because finding square roots modulo a composite number turns out to be probabilistic polynomial-time equivalent to factoring that number, any integer factorization algorithm can be used efficiently to identify a congruence of squares.

Using a factor base A technique pioneered by Dixon's factorization method and improved by continued fraction factorization, the quadratic sieve, and the general number field sieve, is to construct a congruence of squares using a factor base. Instead of looking for one pair x2≡y2(modn) directly, we find many "relations" x2≡y(modn) where the y have only small prime factors (they are smooth numbers), and multiply some of them together to get a square on the right-hand side. The set of small primes which all the y factor into is called the factor base. Construct a logical matrix where each row describes one y, each column corresponds to one prime in the factor base, and the entry is the parity (even or odd) of the number of times that factor occurs in y. Our goal is to select a subset of rows whose sum is the all-zero row. This corresponds to a set of y values whose product is a square number, i.e. one whose factorization has only even exponents. The products of x and y values together form a congruence of squares. This is a classic system of linear equations problem, and can be efficiently solved using Gaussian elimination as soon as the number of rows exceeds the number of columns. Some additional rows are often included to ensure that several solutions exist in the nullspace of our matrix, in case the first solution produces a trivial congruence. A great advantage of this technique is that the search for relations is embarrassingly parallel; a large number of computers can be set to work searching different ranges of x values and trying to factor the resultant ys. Only the found relations need to be reported to a central computer, and there is no particular hurry to do so. The searching computers do not even have to be trusted; a reported relation can be verified with minimal effort. There are numerous elaborations on this technique. For example, in addition to relations where y factors completely in the factor base, the "large prime" variant also collects "partial relations" where y factors completely except for one larger factor. A second partial relation with the same larger factor can be multiplied by the first to produce a "complete relation".

Examples

Factorize 35 We take n = 35 and find that

62=36≡1=12(mod35). We thus factor as

gcd⁡(6−1,35)⋅gcd⁡(6+1,35)=5⋅7=35

Factorize 1649 Using n = 1649, as an example of finding a congruence of squares built up from the products of non-squares (see Dixon's factorization method), first we obtain several congruences

412≡32=25(mod1649), 422≡115=5⋅23(mod1649), 432≡200=23⋅52(mod1649). Of these, the first and third have only small primes as factors, and a product of these has an even power of each small prime, and is therefore a square

32⋅200=25+3⋅52=28⋅52=(24⋅5)2=802 yielding the congruence of squares

32⋅200=802≡412⋅432≡1142(mod1649). So using the values of 80 and 114 as our x and y gives factors

gcd⁡(114−80,1649)⋅gcd⁡(114+80,1649)=17⋅97=1649.

See also Congruence relation

References

Worked examples

Example 1 — a first encounter with Congruence of squares

Start with the simplest possible case. Write down what Congruence of squares claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Congruence of squares before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Congruence of squares ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Congruence of squares

In research
Congruence of squares appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Congruence of squares in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Congruence of squares is common in secondary-school and first-year university syllabi. It links to neighbouring topics Equivalence (mathematics), Integer factorization algorithms, Modular arithmetic, so understanding it makes those chapters shorter.
In everyday life
Look for Congruence of squares outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Congruence of squares” →

How to study Congruence of squares in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Congruence of squares means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Congruence of squares out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Congruence of squares in simple terms?

In number theory, a congruence of squares is a congruence commonly used in integer factorization algorithms. Derivation Given a positive integer n, Fermat's factorization method relies on finding numbers x and y satisfying the equality x2−y2=n We can then factor n = x2 − y2 = (x + y)(x − y).

Why does Congruence of squares matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Congruence of squares?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Congruence of squares.

Tags

  • Equivalence (mathematics)
  • Integer factorization algorithms
  • Modular arithmetic
  • Squares in number theory

Keep exploring