Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

**Johnathon bresly****Guest**

Is there a method for solving the equation ax+by=c where a,b,c are constants and x,y are integers

**zetafunc.****Guest**

If a, b and c are integers then that looks like a linear diophantine equation, and we know certain properties of that equation. For example, if c = gcd(a,b), then there are an infinite number of solutions. You can use the extended Euclidean algorithm to find those. And if we're considering gcd(a,b), then if c isn't a multiple of gcd(a,b), then that equation has no solutions.

**Johnathon bresly****Guest**

Could you explain it further(i don't know the Euclidean algorithm)

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 102,283

Hi;

If the gcd(a,b) does not divide c then there are no solutions.

If gcd(a,b)= d and d does divide c then there are an infinite number of solutions.

The simplest way is to get a particular solution by trial and error. This is feasible because of the simplicity of the equations.

Once you have a particular solution x0 and y0 you can get all of them by these parametric equations.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.** **A number by itself is useful, but it is far more useful to know how accurate or certain that number is.**

Offline

**Johnathon bresly****Guest**

So the first solution can only be achieved by guessing?

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 102,283

Hi;

Trial and error is not exactly guessing it is just the simplest without learning more math.

If you do want more, read this first it will give an example of the extended GCD algorithm.

http://mathworld.wolfram.com/DiophantineEquation.html

Come back then with your questions.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.** **A number by itself is useful, but it is far more useful to know how accurate or certain that number is.**

Offline

**Johnathon bresly****Guest**

I am sorry but i use mobile phone to go to internet and that link is not visible to me so it'd be better if you explain it here,and i have learned the euclidean algorithm now,(not the extended one)

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 102,283

Hi Johnathon bresly;

Here is a method to do this;

This is best understood using an example:

First find the gcd(1124,84), which equals 4.

Here are the steps.

Now we back substitute starting with the second to last step.

So then a solution of

is

x = 8 and y = -107

There is a much better way to do this using a backward recurrence but you would need to go to another page to see it.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.** **A number by itself is useful, but it is far more useful to know how accurate or certain that number is.**

Offline

**Johnathon bresly****Guest**

This back substitution is a little complex,is there any rule for which number to substitute in the steps?

**Johnathon bresly****Guest**

Oh,I understand it now,but what is it with the other solution method.

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 102,283

Hi;

The other method is somewhat simpler but requires a knowledge of recurrence or difference equations. Are you up to that?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**Johnathon bresly****Guest**

I will try my best to understand those methods,so please post them.

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 102,283

Hi;

Okay, I will need some time to post it. Or are you able to download a pdf file if I give you a link?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**Johnathon bresly****Guest**

It will be better if you post it.

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 102,283

Hi;

Let's do an example:

To solve this you form the following table:

The first two rows are just the GCD algorithm applied to 74 and 54.

The last row is generated by the following trick. See the 1 and the 0 that are boxed off they are always given. To get the 2 you take the number before it (second boxed number (1)) and multiply it by the top row number that is in the same column. So that is (1)(2), now you add the number 2 before it ( second boxed number ) (1)(2) +1 = 3.

To get the next number you take number before it and times it by the top row, same column and add the number before that.

(2)(1)+1 = 3.

Next is (3)(2)+2 = 8.

Last is (8)(1)+3 = 11. Now the whole table is filled up and ready for the final stage.

Cross multiply the first 2 numbers in the second and third row.

So x =-8 and y = 11 is a solution.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**Johnathon bresly****Guest**

I have quite understand it,30 minutes ago I searched in wikihow and found a similar way.

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 102,283

Hi Johnathon bresly;

You posted before I was done. There is more up there now.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline