Extended Euclidean Algorithm – Bézout Coefficients
gcd with Bézout identity: gcd(240,46)=2 and 2 = −9·240 + 47·46.
- Every back-substitution step shown; powers RSA key generation.
Figures are estimates from this calculator’s standard formula — adjust the inputs in the tool below for your exact number.
How the Extended Euclidean Algorithm Works
The extended algorithm runs Euclid’s divisions and then back-substitutes to express the gcd as a combination of the inputs. For 240 and 46: 240 = 5×46 + 10, 46 = 4×10 + 6, 10 = 1×6 + 4, 6 = 1×4 + 2, 4 = 2×2 + 0 — gcd 2. Back-substitution rebuilds it: 2 = 6 − 4 = 6 − (10 − 6) = 2×6 − 10 = 2(46 − 4×10) − 10 = 2×46 − 9×10 = 2×46 − 9(240 − 5×46) = 47×46 − 9×240. Check: −2160 + 2162 = 2 ✓, so Bézout coefficients are (s, t) = (−9, 47). The calculator prints the division table and the full back-substitution chain, verifies the identity numerically, and links the machinery to modular inverses: reducing s·a + t·b = g modulo b shows t ≡ a⁻¹ (mod b) whenever g = 1 — the step that constructs RSA private keys. Alternative signed-remainder and recursive table methods are noted.
- 1
Enter a and b
Any integers, e.g. 240 and 46
- 2
Run the divisions
The quotient/remainder ladder is printed
- 3
Back-substitute
Each substitution step rebuilds the gcd combination
- 4
Verify Bézout
−9×240 + 47×46 = 2 is checked numerically
Use Cases
RSA Key Setup
Private exponent d = e⁻¹ mod φ via the coefficient t
Diophantine Equations
Solvability of 240x + 46y = c hinges on gcd 2 dividing c
Modular Inverses
Read a⁻¹ mod b straight from the Bézout coefficient
Tips
- 1
Bézout always exists: gcd(a,b) = sa + tb for some integers s, t
- 2
When gcd = 1, the coefficient of a is its inverse mod b
- 3
Back-substitution is mechanical — write every remainder swap
Common Mistakes
Stopping at the gcd without performing back-substitution
Sign slips when substituting remainders upward
Forgetting to verify sa + tb reproduces the gcd
Misreading which coefficient inverts which input
FAQs
What are the Bézout coefficients of 240 and 46?
What is gcd(240,46)?
How does this find modular inverses?
What is Bézout’s identity?
When is 240x + 46y = 50 solvable?
Related tools
Pick another tool to continue your calculation.
Binary⇄Decimal Converter – Bases 2, 8, 10, 16
Convert numbers between binary, octal, decimal, and hexadecimal.
Number Base Converter – Any Base 2 to 36
Convert numbers between different base systems.
Number Properties Explorer – Factors & More
Discover properties of any natural number.
Random Number Generator – Range & Dice
Generate random numbers within a specified range.
Catalan Number Calculator – C(n) Counts
Calculate the nth Catalan number.
Mixed Number to Decimal Converter
Convert mixed numbers to decimals and vice versa.