Tuesday, October 6, 2009

linear diophantine equation

solve for integer pair (x,y) such that ax + by = c.

if (a,b) | c, this has solutions.

5x + 3y = 8

Solve for 5x + 3y = 1 first

5(-1)+3(2) = 1
5(-8) + 3(16) = 8

x = -8 + 3k
y = 16 - 5k

Extended gcd would do

No comments: