### Theorem of linear equation

Likeax+byThe smallest positive integer of is equal togcd(a,b)

We use Euclidean algorithm to construct the appropriatexAndyIn other words, the equation will be describedax + by= gcd(a,b)Integer solutionxAndyMethods. Because of each numberax+bycovergcd(a,b)to be divisible by,ax + byThe smallest positive integer value of is exactlygcd(a,b)

Solving equations by Euclidean algorithmax+by=gcd(a,b)

For example, try to solve the problem22x+60y=gcd(22,60)

In the first step, Euclidean algorithm is used to calculate the greatest common factor

60 = 2·22 +16

22 = 1·16 +6

16=2·6+4

6=1·4+2

4=2·2+0

This shows thatgcd(22,60)=2This is an obvious fact that there is no need for Euclidean algorithm. However, it is very important to use Euclidean algorithm because we use the middle quotient and remainder to solve the equation. First, rewrite the first equation into

16 = a-2b, where a = 60, B = 22

Next, replace the value in the second equation with this value16, get

b=1·16+6=1·(a-2b)+6

Rearrange the equation6Move to one side

6=b-(a-2b)=-a+3b

Now the value of16And6Put in the next equation16=2·6+4

a-2b=16=2·6+4=2(-a+3b)+4

The result of transfer

4=(a-2b)-2(-a+3b)=3a-8b

Finally, use the equation6=1·4+2have to

-a+3b=6=1·4+2=1·(3a-8b)+2

Rearrange the equation to get the desired solution

-4a+11b=2

This work adoptsCC agreementThe author and the link to this article must be indicated in the reprint