Chapter 6: linear equations and the greatest common factor (2)


Now, we know the equation


There is always an integer solutionxAndyHow many solutions are there and how to express them?

We are mutually exclusiveaAndbLet gogcd(a,b)=1, assuming(x_1,y_1)It’s an equationax+by=1A solution of. adoptx_1subtractbSum of multiples ofy_1addaOther solutions can be obtained. In other words, for any integerkWe get a new solution(x_1+kb,y_1-ka)By calculating


Still observinggcd(a,b)=1It can be proved that this method gives all solutions and hypotheses(x_1,y_1)And(x_2,y_2)It’s an equationax+by=1Two solutions of, namely

Ax_ 1+by_ 1 = 1 and ax_ 2+by_ 2=1

We use ity_1Multiply the first equation with they_2Multiply the second equation and subtract itbAfter sorting outax_1y_2-ax_2y_1=y_2-y_1

Similar, if you usex_2Multiply the first equation with thex_1Multiply the second equation and subtract itbx_2y_1-bx_1y_2=x_2-x_1

Ifk=x_2y_1-x_1y_2, then we get


Therefore, from the initial understanding of the solution(x_1,y_1)By going to differentkValue can be obtainedax+by=1Every solution of(x_1+kb,y_1-ka)

Ifgcd(a,,b)>1What will happen?

We orderg=gcd(a,b)The equation is known by Euclidean algorithmax+by=gAt least one solution(x_1,y_1), andgto be divisible byaAndbSo(x_1,y_1)It’s a simple equation


The solution. Through thekThe value of

(x_1+k·\frac{b}{g},y_1-k \frac{a}{g})

###Theorem of linear equation

set upaAndbIs a nonzero integer,g=gcd(a,b), equationax+by=gThere is always an integer solution(x_1,y_1)Then each solution of the equation can be obtained by the Euclidean algorithm(x_1+k·\frac{b}{g},y_1-k \frac{a}{g})Get, wherekCan be any integer.

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


Recommended Today

The course of using Chinese software of poedit Pro

Poedit pro (formerly known as poedit) is a free (professional version charge), open source and cross platform gettext class (. Po format, gettext is used in the application program for program internationalization) International Translation editor. It is also one of the most widely used software of the same type. At present, it is available in […]