# diophantine equations in hill cipher decryption

• Mar 14th 2011, 02:07 PM
LeiaBrown
diophantine equations in hill cipher decryption
i've got a question abouut 'collecting like terms'.

im tryinng to solve 125x+26y=1

by using euclid's algorithms i got:
125= 4x26 +21
26= 1x21 +5
21= 4x5 +1

GCD is 1

but now i have to work backwards because my original question was to decrypt my hill cipher message. (i know how to work this out with the inverse matrices etc its just this one step im stuck on):

1= 21-4x5 < ---- (from the last line)
= 21-4x (26-1x21) <---- (i substituted 5 from the 2nd line)

now, im meant to collect like terms together but i dont know how? the next line is meant to be 5x21-4x26, but how do i get that?
• Mar 14th 2011, 04:24 PM
hmmmm
$21-4* (26-1*21) =21-4*26-4*-21=5*21-4*26$ is this what you want?
• Mar 15th 2011, 09:54 AM
LeiaBrown
hey, nevermind i've solved it myself thanks :)