Bezout Identity Calculator
Free Bezout identity Calculator for number theory. Enter values to get step-by-step solutions with formulas and graphs.
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.