HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Notes
  2. /Diophantine Equations and Pythagorean Triples: Quick Revision
Mathematics

Diophantine Equations and Pythagorean Triples: Quick Revision

A brief note on linear Diophantine equations, the coin problem, Pythagorean triples, factoring, bounding, remainder arguments and Pell's equation, with a worked example, practice, a program and questions.

StemPy LabWritten by StemPy Lab
Log in to save

A brief note on Diophantine Equations and Pythagorean Triples. Read it before a test. Try each question at the end before you open its answer.

Linear equations

  • Solvable: ax+by=cax + by = cax+by=c has integer solutions exactly when d=gcd⁡(a,b)∣cd = \gcd(a, b) \mid cd=gcd(a,b)∣c.
  • All solutions: x=x0+bdtx = x_0 + \frac{b}{d}tx=x0​+db​t, y=y0−adty = y_0 - \frac{a}{d}ty=y0​−da​t.
  • Positive solutions: turn x>0x > 0x>0 and y>0y > 0y>0 into bounds on ttt.
  • Coins: for coprime a,ba, ba,b the largest amount not payable is ab−a−bab - a - bab−a−b; (a−1)(b−1)2\frac{(a-1)(b-1)}{2}2(a−1)(b−1)​ amounts are not payable.

Pythagorean triples

  • Primitive: m2−n2m^2 - n^2m2−n2, 2mn2mn2mn, m2+n2m^2 + n^2m2+n2 with m>nm > nm>n coprime, of opposite parity.
  • All: multiples of primitive ones.
  • Divisibility: 60∣abc60 \mid abc60∣abc.
  • Given leg aaa: factor a2=(c−b)(c+b)a^2 = (c - b)(c + b)a2=(c−b)(c+b), both factors of the same parity.

Other methods

  • Factoring: make a product equal to a known number, such as (x−p)(y−q)=pq(x - p)(y - q) = pq(x−p)(y−q)=pq.
  • Bounding: order the unknowns and trap the smallest.
  • Remainders: squares modulo 444 or 888, cubes modulo 777 or 999.
  • Pell: x2−dy2=1x^2 - dy^2 = 1x2−dy2=1 has all solutions from powers of x1+y1dx_1 + y_1\sqrt dx1​+y1​d​.

A worked example

Find the non-negative solutions of 4x+9y=1004x + 9y = 1004x+9y=100.

  1. Condition. 9y≡100(mod4)9y \equiv 100 \pmod 49y≡100(mod4), so y≡0(mod4)y \equiv 0 \pmod 4y≡0(mod4).
  2. List. y=0,4,8y = 0, 4, 8y=0,4,8 give x=25,16,7x = 25, 16, 7x=25,16,7.
  3. Check. 4×7+9×8=28+72=1004 \times 7 + 9 \times 8 = 28 + 72 = 1004×7+9×8=28+72=100.

Practice with new numbers

A program to try

The program checks three facts by a search.

Read it first. Then run it. Do the lists agree with the worked example and the methods?

1. Change the leg 212121 to 282828. How many triangles appear?

Mistakes to avoid

  • Forgetting the gcd test.
  • Mixing positive and non-negative.
  • Factor pairs of different parity in x2−y2=nx^2 - y^2 = nx2−y2=n.
  • Forgetting negative factor pairs when integer solutions are asked.

Check yourself

  1. Does 12x+18y=5012x + 18y = 5012x+18y=50 have integer solutions?
  1. Which primitive triple comes from m=6m = 6m=6, n=5n = 5n=5?
  1. Solve (x−2)(y−4)=3(x - 2)(y - 4) = 3(x−2)(y−4)=3 in positive integers.
  1. Find the second solution of x2−3y2=1x^2 - 3y^2 = 1x2−3y2=1 from (2,1)(2, 1)(2,1).

Sources

  • David M. Burton, Elementary Number Theory, Chapters 2, 12 and 15.
← All Notes
← Fermat, Euler and Wilson: Quick RevisionMeans and the AM-GM Inequality: Quick Revision →
More onNumber Theory

Discussion (0)

Log in to join the discussion.

Loading…

On this page

  1. Linear equations
  2. Pythagorean triples
  3. Other methods
  4. A worked example
  5. Practice with new numbers
  6. A program to try
  7. Mistakes to avoid
  8. Check yourself
  9. Sources

Goes with the lesson

  1. Factoring, bounding and Pell's equationDiophantine Equations and Pythagorean Triples

More notes on this topic

  1. Fermat, Euler and Wilson: Quick Revision
  2. Congruences and the Chinese Remainder Theorem: Quick Revision
  3. Factorials, Irrational Numbers, Digits and the Floor Function: Quick Revision
  4. Common Factors, the Euclidean Algorithm and Divisors: Quick Revision
  5. Division, Divisibility Rules and Primes: Quick Revision
All notes on this topic →