View Single Post
  #7  
Old January 5th, 2009, 09:28 PM
Mush Mush is offline
Super Member
 
Join Date: Dec 2008
Location: Scotland
Posts: 863
Country:
Thanks: 6
Thanked 341 Times in 319 Posts
Mush is a jewel in the roughMush is a jewel in the roughMush is a jewel in the roughMush is a jewel in the rough
Default

It might be interesting to note, OP, that even if there was a simpler method for finding X and Y in your equation, that there is not one unique solution. There are in fact INFINITELY many solutions. You may use the regular euclidian algorithm to find one solution.

ax+by = c

If you use the regular algorithm, and get a solution(x,y). Then there are other solutions of the form (x+\frac{kb}{gcd(a,b)},y+\frac{ka}{gcd(a,b)}) where k is a member of the integers. There are in fact infinitely many integers, and hence there are infinitely many solutions so such an equation.

Hence, even if there was a simpler method, it might take you infinitely many recursions until you got to your desired answer. In your example: (y=10,x=5). Although I do realise that your grid limits the solutions such that the integers are confined to your grid, so perhaps it's not such an impractical endeavour.

If you would like further explanation on how to solve you problem using the regular euclidian algorithm, then just ask.
Reply With Quote