Math calculator

Extended Euclidean Algorithm Calculator

Find the GCF together with coefficients x and y satisfying ax + by = gcd(a,b). The displayed bézout identity includes enough working to inspect signs and scale.

Extended Euclidean Algorithm inputs

Numerical setup

Understanding the reported Extended Euclidean Algorithm

The extended algorithm carries coefficient updates alongside ordinary Euclidean remainders. Its final coefficients express the GCF as an integer linear combination.

A correct bézout identity is reliable for Extended Euclidean Algorithm only when the chosen model fits the problem.

Reproducing Extended Euclidean Algorithm later

Track triples (remainder,x,y), beginning with (a,1,0) and (b,0,1). Subtract quotient multiples until the remainder reaches zero. To continue from Extended Euclidean Algorithm, try modular inverse.

From one identity to many

If ax₀+by₀=g, then x=x₀+k(b/g) and y=y₀−k(a/g) produce the same value for any integer k. The displayed coefficients are therefore one convenient solution, not privileged constants. Substitution is the most direct way to verify the returned pair.

Bézout coefficients are generally not unique; adding multiples derived from a/g and b/g creates other valid pairs. Inputs cannot both be zero. If the Extended Euclidean Algorithm assumptions do not fit, consider ordinary Euclidean steps.

A second verification of Extended Euclidean Algorithm

Keep Integer a integral when Extended Euclidean Algorithm requires integers. Verify Integer b through the defining Extended Euclidean Algorithm identity.

Test zero in Extended Euclidean Algorithm, then test one in Extended Euclidean Algorithm. Rebuild the starting integer through Extended Euclidean Algorithm.

Cross-checking Extended Euclidean Algorithm

A one-input trial is useful when Extended Euclidean Algorithm behaves unexpectedly. Change Integer b alone, retain Integer a and Integer b, and observe Bézout identity. Multiple simultaneous edits would make the cause of the changed Bézout identity ambiguous within the Extended Euclidean Algorithm setup.

Preserve the first Extended Euclidean Algorithm case before testing another value of Integer a. Leave Integer b unchanged so a shift in Bézout identity has one cause. Recording both values of Bézout identity also prevents the revised Extended Euclidean Algorithm data from replacing the original silently.

Test Extended Euclidean Algorithm with a round value for Integer a. Keep Integer b fixed and estimate Bézout identity before recalculating. The estimated Bézout identity gives the original Extended Euclidean Algorithm answer a scale check, while the unchanged Integer b makes the comparison meaningful.

Questions about Extended Euclidean Algorithm

Are the coefficients unique?

No.

How can I verify them?

Substitute x and y into ax+by.

When does ax+by=1 have a solution?

Exactly when a and b are coprime.

Can coefficients be negative?

Yes, commonly.