[Verse 1]
Two integers meet, gcd we seek
But more than that, we need to speak
Of coefficients hiding deep
Bézout's equation makes the leap
Start with a and b so clean
Apply the standard routine
But track the steps, don't let them fade
Each quotient and remainder made
[Chorus]
Extended Euclidean, dig deeper than before
Not just the gcd, but so much more
Back-substitute the trail you left behind
Linear combination you will find
s times a plus t times b
Equals gcd, the golden key
Extended Euclidean, the power to decode
Modular arithmetic's secret road
[Verse 2]
Build your table, columns neat
Original values can't be beat
While remainder isn't zero yet
Keep dividing, place your bet
Track the quotients as you go
Soon you'll need them, this I know
When the remainder hits the floor
Backtrack through what came before
[Chorus]
Extended Euclidean, dig deeper than before
Not just the gcd, but so much more
Back-substitute the trail you left behind
Linear combination you will find
s times a plus t times b
Equals gcd, the golden key
Extended Euclidean, the power to decode
Modular arithmetic's secret road
[Bridge]
Start from the second-to-last equation
Work backwards with determination
Express each remainder in terms of originals
Replace and expand, keep it rational
The final form reveals the treasure
Coefficients beyond measure
[Verse 3]
Modular inverse waits in sight
When gcd equals one just right
The coefficient s holds the clue
Modular inverse comes through
Cryptography depends on this
RSA won't work amiss
Diophantine solutions clear
Extended algorithm draws them near
[Outro]
Remember the substitution dance
Backward steps enhance your chance
Not just division's simple game
But coefficients stake their claim
Extended Euclidean shows the way
To secrets hiding in plain display