Diophantine Equation Solver

Find integer solutions to linear, quadratic, and Pell-type equations. Complete step-by-step solutions with visualization.

Linear Equation
Pell's Equation
Quadratic Equation
Custom Equation
Security Notice: Custom equations are evaluated in a secure sandbox. Only mathematical operations are allowed.

Linear Diophantine Equation: \(ax + by = c\)

where \(a, b, c\) are integers, and we seek integer solutions \((x, y)\).

Alt+1
Alt+2
Alt+3
12x + 15y = 9
3x + 5y = 7
6x + 9y = 21
7x + 13y = 1
4x + 6y = 3

Pell's Equation: \(x^2 - Dy^2 = 1\)

where \(D\) is a positive non-square integer, and we seek positive integer solutions \((x, y)\).

Must be a positive non-square integer
x² - 2y² = 1
x² - 3y² = 1
x² - 5y² = 1
x² - 7y² = 1
x² - 13y² = 1

Quadratic Diophantine Equation: \(ax^2 + bxy + cy^2 + dx + ey + f = 0\)

Simplified forms available below.

Max search value for |x|, |y|
x² - 5y² = 4
x² - 2y² = -1
x² - 3y² = 2
x² - 7y² = 9

Custom Diophantine Equation: Enter any equation in x and y

Use standard mathematical notation. Example: "x^2 + 2*y^2 = 17" or "x^2 + y^2 - 25 = 0"

Alt+E
Search for |x|, |y| up to this value
Maximum number of solutions to find
x² + y² = 25
x² + 2y² = 17
2x + 3y = 10
x² - 2y² = 1
Initializing...
Solving equation...

Diophantine Equations: Mathematical Background

Diophantine equations are polynomial equations with integer coefficients where only integer solutions are sought. They are named after the ancient Greek mathematician Diophantus of Alexandria.

General Form:

A Diophantine equation in two variables has the form:

\(P(x, y) = 0\)

where \(P(x, y)\) is a polynomial with integer coefficients, and we seek integer pairs \((x, y)\) that satisfy the equation.

Types of Diophantine Equations

1

Linear Diophantine Equations: \(ax + by = c\)

These have solutions if and only if \(\gcd(a, b)\) divides \(c\). The extended Euclidean algorithm finds all solutions.

2

Pell's Equation: \(x^2 - Dy^2 = 1\)

For non-square positive integer \(D\), Pell's equation has infinitely many solutions. The fundamental solution generates all others.

3

Quadratic Diophantine Equations: \(ax^2 + bxy + cy^2 + dx + ey + f = 0\)

These can often be transformed into Pell-type equations or solved by factoring over the integers.

Solution Methods

Method Applicable To Key Idea Example
Extended Euclidean Algorithm Linear equations Find gcd and express as linear combination \(12x + 15y = 9\)
Continued Fractions Pell's equation Use convergents of \(\sqrt{D}\) \(x^2 - 2y^2 = 1\)
Factorization Quadratic equations Rewrite as product of linear factors \(x^2 - y^2 = (x-y)(x+y)\)
Modular Arithmetic All types Check possibilities modulo n \(x^2 + y^2 = z^2 \mod 4\)
Parametrization Homogeneous equations Express variables in terms of parameters Pythagorean triples

Famous Diophantine Equations

Pythagorean Triples: \(x^2 + y^2 = z^2\)

All primitive solutions given by: \(x = m^2 - n^2\), \(y = 2mn\), \(z = m^2 + n^2\) with \(m > n > 0\), \(\gcd(m, n) = 1\), \(m\) and \(n\) of opposite parity.

Fermat's Last Theorem: \(x^n + y^n = z^n\) for \(n > 2\)

Proven by Andrew Wiles in 1994: No nontrivial integer solutions exist for \(n > 2\).

Brahmagupta's Identity: If \((x_1, y_1)\) and \((x_2, y_2)\) solve \(x^2 - Dy^2 = k\), then their composition gives another solution.

This is the basis for the Brahmagupta-Bhaskara equation and the chakravala method.

Historical Context

c. 250 CE

Diophantus of Alexandria writes Arithmetica, containing 130 algebraic problems with integer solutions.

628 CE

Brahmagupta gives the first systematic solution to Pell's equation \(x^2 - Dy^2 = 1\).

1150 CE

Bhaskara II develops the chakravala method, a complete algorithm for solving Pell's equation.

1657

Pierre de Fermat challenges European mathematicians to solve Pell's equation for specific values of D.

1768

Joseph-Louis Lagrange proves that Pell's equation always has infinitely many solutions for non-square D.

Applications of Diophantine Equations

  • Number Theory: Understanding the structure of integers
  • Cryptography: RSA and other public-key cryptosystems use Diophantine problems
  • Coding Theory: Error-correcting codes based on integer solutions
  • Geometry: Rational points on curves and surfaces
  • Computer Science: Algorithm design and complexity theory

Calculator Features:

  • Solves linear Diophantine equations using extended Euclidean algorithm
  • Finds solutions to Pell's equation using continued fractions
  • Solves quadratic Diophantine equations through transformation and search
  • Handles custom equations through intelligent parsing and search
  • Provides step-by-step solutions with mathematical justification
  • Visualizes solutions on integer lattice and coordinate plane
  • Includes historical context and mathematical background