Skip to main content

Bezout Identity Calculator

Free Bezout identity Calculator for number theory. Enter values to get step-by-step solutions with formulas and graphs.

Skip to calculator
Mathematics

Bezout Identity Calculator

Find Bezout coefficients x and y such that ax + by = gcd(a,b) using the Extended Euclidean Algorithm. Solve linear Diophantine equations and compute modular inverses.

Last updated: December 2025Reviewed by NovaCalculator Mathematics Team

Calculator

Adjust values & calculate
56
15
Bezout Identity
56 * (-4) + 15 * (15) = 1
gcd(56, 15) = 1
GCD
1
Coefficient x
-4
Coefficient y
15
Numbers are coprime (GCD = 1)
Modular inverse of 56 mod 15 = 11

Extended Euclidean Algorithm Steps

56 = gcd initial
56 = 3 * 15 + 11
15 = 1 * 11 + 4
11 = 2 * 4 + 3
4 = 1 * 3 + 1
3 = 3 * 1 + 0

General Solution Family

x = -4 + 15t, y = 15 - 56t

txyax + by
-3-491831
-2-341271
-1-19711
0-4151
111-411
226-971
341-1531
Your Result
56 * (-4) + 15 * (15) = 1 | Verified: Yes | Coprime: Yes
Share Your Result
Understand the Math

Formula

ax + by = gcd(a, b)

Bezouts Identity states that for any integers a and b (not both zero), there exist integers x and y such that ax + by equals the greatest common divisor of a and b. The Extended Euclidean Algorithm finds both the GCD and the Bezout coefficients x, y simultaneously.

Last reviewed: December 2025

Worked Examples

Example 1: Finding Bezout Coefficients for 56 and 15

Find integers x and y such that 56x + 15y = gcd(56, 15).
Solution:
Extended Euclidean Algorithm: 56 = 3 * 15 + 11 15 = 1 * 11 + 4 11 = 2 * 4 + 3 4 = 1 * 3 + 1 3 = 3 * 1 + 0 Back-substitute: 1 = 4 - 1*3 1 = 4 - 1*(11 - 2*4) = 3*4 - 11 1 = 3*(15 - 11) - 11 = 3*15 - 4*11 1 = 3*15 - 4*(56 - 3*15) = -4*56 + 15*15
Result: 56*(-4) + 15*(15) = 1 | gcd(56,15) = 1 | x = -4, y = 15

Example 2: Solving a Linear Diophantine Equation

Find all integer solutions to 12x + 8y = 20.
Solution:
Step 1: gcd(12,8) = 4. Since 4 divides 20, solutions exist. Step 2: Extended Euclidean: 12*1 + 8*(-1) = 4 Step 3: Multiply by 20/4 = 5: 12*5 + 8*(-5) = 20 Particular solution: x0 = 5, y0 = -5 Step 4: General solution: x = 5 + 2t, y = -5 - 3t
Result: x = 5 + 2t, y = -5 - 3t for any integer t | e.g., (5,-5), (7,-8), (3,-2)
Expert Insights

Background & Theory

The Bezout Identity Calculator applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.

History

The history behind the Bezout Identity Calculator traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.

Share this calculator

Explore More

Frequently Asked Questions

Bezouts Identity (also called Bezouts Lemma) is a fundamental theorem in number theory stating that for any two integers a and b (not both zero), there exist integers x and y such that ax + by = gcd(a,b), where gcd(a,b) is the greatest common divisor of a and b. Furthermore, gcd(a,b) is the smallest positive integer that can be expressed as a linear combination of a and b. This means that every integer of the form ax + by is a multiple of gcd(a,b), and conversely, every multiple of gcd(a,b) can be written as ax + by for some integers x and y. The coefficients x and y are called Bezout coefficients. For example, gcd(56,15) = 1, and indeed 56*(-4) + 15*(15) = 1. Bezouts Identity is the theoretical foundation for many algorithms in number theory, including the Extended Euclidean Algorithm and modular arithmetic operations.
The Extended Euclidean Algorithm augments the standard Euclidean Algorithm by tracking two additional sequences of coefficients alongside the remainder sequence. Starting with (old_r, r) = (a, b), (old_s, s) = (1, 0), and (old_t, t) = (0, 1), at each step we compute the quotient q = floor(old_r / r), then update: new_r = old_r - q*r, new_s = old_s - q*s, new_t = old_t - q*t. When r reaches 0, old_r contains the GCD, and old_s and old_t are the Bezout coefficients x and y satisfying ax + by = gcd(a,b). The algorithm maintains the invariant that at every step, old_r = a*old_s + b*old_t and r = a*s + b*t. This invariant guarantees correctness because when r becomes 0, old_r = gcd = a*old_s + b*old_t. The algorithm runs in O(log(min(a,b))) steps, making it extremely efficient even for very large numbers. It is fundamental to computing modular inverses used in RSA cryptography.
Bezouts Identity is the theoretical basis for computing modular multiplicative inverses, which are essential in modern cryptography. If gcd(a,n) = 1 (a and n are coprime), then Bezouts Identity guarantees integers x and y such that ax + ny = 1. Reducing modulo n gives ax mod n = 1, meaning x is the modular inverse of a modulo n. This is critical in RSA encryption, where computing d such that ed mod phi(n) = 1 requires the Extended Euclidean Algorithm. In Diffie-Hellman key exchange, modular inverses are used in discrete logarithm computations. Bezouts Identity also underlies the Chinese Remainder Theorem, which enables efficient computation with large numbers by decomposing them into smaller modular components. Without Bezouts Identity and its constructive proof via the Extended Euclidean Algorithm, modern public-key cryptography would lack the efficient algorithms needed for key generation and decryption operations.
The Bezout equation ax + by = gcd(a,b) has infinitely many integer solutions, and they can all be expressed in terms of one particular solution. If (x0, y0) is one solution found by the Extended Euclidean Algorithm, then all solutions are given by x = x0 + (b/gcd)*t and y = y0 - (a/gcd)*t, where t is any integer. This parametric form shows that solutions come in a regular pattern, with x increasing by b/gcd and y decreasing by a/gcd as t increases by 1. For the more general linear Diophantine equation ax + by = c, solutions exist if and only if gcd(a,b) divides c. When solutions exist, they are obtained by multiplying the Bezout solution by c/gcd(a,b) and using the same parametric formula. The spacing between consecutive solutions is always b/gcd in the x-direction and a/gcd in the y-direction, regardless of the specific value of c. This infinite family of solutions has applications in scheduling, resource allocation, and optimization problems.
Bezouts Identity provides a constructive characterization of the greatest common divisor: gcd(a,b) is the smallest positive integer expressible as a linear combination ax + by with integer coefficients. This connection works in both directions. First, any common divisor d of a and b must divide ax + by for all x,y, so d divides gcd(a,b). Second, since gcd(a,b) divides both a and b, it divides every linear combination ax + by. Together, these facts prove that gcd(a,b) is exactly the smallest positive value achievable. This characterization extends to multiple integers: gcd(a,b,c) is the smallest positive integer of the form ax + by + cz. The set of all integers expressible as ax + by is precisely the set of all multiples of gcd(a,b), forming the ideal generated by a and b in the ring of integers. This algebraic perspective connects number theory to ring theory and abstract algebra, where Bezouts Identity generalizes to principal ideal domains.
A linear Diophantine equation ax + by = c has integer solutions if and only if gcd(a,b) divides c. To solve it, first use the Extended Euclidean Algorithm to find Bezout coefficients x0, y0 such that ax0 + by0 = gcd(a,b). Let g = gcd(a,b) and verify that g divides c. Then multiply the Bezout equation by c/g to get a*(x0*c/g) + b*(y0*c/g) = c, giving the particular solution x_p = x0*c/g and y_p = y0*c/g. The general solution is x = x_p + (b/g)*t and y = y_p - (a/g)*t for any integer t. To find solutions in a specific range (e.g., positive solutions), substitute the parametric formulas into the constraints and solve for valid values of t. This method is used extensively in competition mathematics, integer programming, and number theory problems. For systems of linear Diophantine equations, the Chinese Remainder Theorem provides an efficient solution method based on repeated application of Bezouts Identity.
Educational Note: This calculator is provided for educational and informational purposes. Results are based on the formulas and inputs provided. Always verify important calculations independently. NovaCalculator processes calculator inputs client-side; optional analytics follow visitor consent settings.Reviewed by: NovaCalculator Mathematics Team โ€” Verified against standard mathematical and scientific references. Last reviewed: December 2025. ยฉ 2024โ€“2026 NovaCalculator.

Share this calculator

Formula

ax + by = gcd(a, b)

Bezouts Identity states that for any integers a and b (not both zero), there exist integers x and y such that ax + by equals the greatest common divisor of a and b. The Extended Euclidean Algorithm finds both the GCD and the Bezout coefficients x, y simultaneously.

Worked Examples

Example 1: Finding Bezout Coefficients for 56 and 15

Problem: Find integers x and y such that 56x + 15y = gcd(56, 15).

Solution: Extended Euclidean Algorithm:\n56 = 3 * 15 + 11\n15 = 1 * 11 + 4\n11 = 2 * 4 + 3\n4 = 1 * 3 + 1\n3 = 3 * 1 + 0\n\nBack-substitute:\n1 = 4 - 1*3\n1 = 4 - 1*(11 - 2*4) = 3*4 - 11\n1 = 3*(15 - 11) - 11 = 3*15 - 4*11\n1 = 3*15 - 4*(56 - 3*15) = -4*56 + 15*15

Result: 56*(-4) + 15*(15) = 1 | gcd(56,15) = 1 | x = -4, y = 15

Example 2: Solving a Linear Diophantine Equation

Problem: Find all integer solutions to 12x + 8y = 20.

Solution: Step 1: gcd(12,8) = 4. Since 4 divides 20, solutions exist.\nStep 2: Extended Euclidean: 12*1 + 8*(-1) = 4\nStep 3: Multiply by 20/4 = 5: 12*5 + 8*(-5) = 20\nParticular solution: x0 = 5, y0 = -5\nStep 4: General solution: x = 5 + 2t, y = -5 - 3t

Result: x = 5 + 2t, y = -5 - 3t for any integer t | e.g., (5,-5), (7,-8), (3,-2)

Frequently Asked Questions

What is Bezouts Identity and what does it state?

Bezouts Identity (also called Bezouts Lemma) is a fundamental theorem in number theory stating that for any two integers a and b (not both zero), there exist integers x and y such that ax + by = gcd(a,b), where gcd(a,b) is the greatest common divisor of a and b. Furthermore, gcd(a,b) is the smallest positive integer that can be expressed as a linear combination of a and b. This means that every integer of the form ax + by is a multiple of gcd(a,b), and conversely, every multiple of gcd(a,b) can be written as ax + by for some integers x and y. The coefficients x and y are called Bezout coefficients. For example, gcd(56,15) = 1, and indeed 56*(-4) + 15*(15) = 1. Bezouts Identity is the theoretical foundation for many algorithms in number theory, including the Extended Euclidean Algorithm and modular arithmetic operations.

How does the Extended Euclidean Algorithm find Bezout coefficients?

The Extended Euclidean Algorithm augments the standard Euclidean Algorithm by tracking two additional sequences of coefficients alongside the remainder sequence. Starting with (old_r, r) = (a, b), (old_s, s) = (1, 0), and (old_t, t) = (0, 1), at each step we compute the quotient q = floor(old_r / r), then update: new_r = old_r - q*r, new_s = old_s - q*s, new_t = old_t - q*t. When r reaches 0, old_r contains the GCD, and old_s and old_t are the Bezout coefficients x and y satisfying ax + by = gcd(a,b). The algorithm maintains the invariant that at every step, old_r = a*old_s + b*old_t and r = a*s + b*t. This invariant guarantees correctness because when r becomes 0, old_r = gcd = a*old_s + b*old_t. The algorithm runs in O(log(min(a,b))) steps, making it extremely efficient even for very large numbers. It is fundamental to computing modular inverses used in RSA cryptography.

Why is Bezouts Identity important for modular arithmetic and cryptography?

Bezouts Identity is the theoretical basis for computing modular multiplicative inverses, which are essential in modern cryptography. If gcd(a,n) = 1 (a and n are coprime), then Bezouts Identity guarantees integers x and y such that ax + ny = 1. Reducing modulo n gives ax mod n = 1, meaning x is the modular inverse of a modulo n. This is critical in RSA encryption, where computing d such that ed mod phi(n) = 1 requires the Extended Euclidean Algorithm. In Diffie-Hellman key exchange, modular inverses are used in discrete logarithm computations. Bezouts Identity also underlies the Chinese Remainder Theorem, which enables efficient computation with large numbers by decomposing them into smaller modular components. Without Bezouts Identity and its constructive proof via the Extended Euclidean Algorithm, modern public-key cryptography would lack the efficient algorithms needed for key generation and decryption operations.

How many solutions does the Bezout equation ax + by = gcd(a,b) have?

The Bezout equation ax + by = gcd(a,b) has infinitely many integer solutions, and they can all be expressed in terms of one particular solution. If (x0, y0) is one solution found by the Extended Euclidean Algorithm, then all solutions are given by x = x0 + (b/gcd)*t and y = y0 - (a/gcd)*t, where t is any integer. This parametric form shows that solutions come in a regular pattern, with x increasing by b/gcd and y decreasing by a/gcd as t increases by 1. For the more general linear Diophantine equation ax + by = c, solutions exist if and only if gcd(a,b) divides c. When solutions exist, they are obtained by multiplying the Bezout solution by c/gcd(a,b) and using the same parametric formula. The spacing between consecutive solutions is always b/gcd in the x-direction and a/gcd in the y-direction, regardless of the specific value of c. This infinite family of solutions has applications in scheduling, resource allocation, and optimization problems.

What is the relationship between Bezouts Identity and the GCD?

Bezouts Identity provides a constructive characterization of the greatest common divisor: gcd(a,b) is the smallest positive integer expressible as a linear combination ax + by with integer coefficients. This connection works in both directions. First, any common divisor d of a and b must divide ax + by for all x,y, so d divides gcd(a,b). Second, since gcd(a,b) divides both a and b, it divides every linear combination ax + by. Together, these facts prove that gcd(a,b) is exactly the smallest positive value achievable. This characterization extends to multiple integers: gcd(a,b,c) is the smallest positive integer of the form ax + by + cz. The set of all integers expressible as ax + by is precisely the set of all multiples of gcd(a,b), forming the ideal generated by a and b in the ring of integers. This algebraic perspective connects number theory to ring theory and abstract algebra, where Bezouts Identity generalizes to principal ideal domains.

How do you solve linear Diophantine equations using Bezouts Identity?

A linear Diophantine equation ax + by = c has integer solutions if and only if gcd(a,b) divides c. To solve it, first use the Extended Euclidean Algorithm to find Bezout coefficients x0, y0 such that ax0 + by0 = gcd(a,b). Let g = gcd(a,b) and verify that g divides c. Then multiply the Bezout equation by c/g to get a*(x0*c/g) + b*(y0*c/g) = c, giving the particular solution x_p = x0*c/g and y_p = y0*c/g. The general solution is x = x_p + (b/g)*t and y = y_p - (a/g)*t for any integer t. To find solutions in a specific range (e.g., positive solutions), substitute the parametric formulas into the constraints and solve for valid values of t. This method is used extensively in competition mathematics, integer programming, and number theory problems. For systems of linear Diophantine equations, the Chinese Remainder Theorem provides an efficient solution method based on repeated application of Bezouts Identity.

References

Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy