[Number theory] indeterminate equation && Chinese remainder theorem

Requirements inverse, we must first know what is indeterminate equation.

It is known that a, b, c, solving the x, y, shaped like ax + by = c equation is indeterminate equation.

There are two kinds of indefinite equation solution of the case:

1. no solution

2. The existence and infinite solutions

So, how to judge the situation solution it?

At this time, only you need to come gcd on it,

Existence and c, the equation, why | if gcd (a, b)

Because we want to use the extended Euclidean indefinite equation, we all know that Euclid is seeking

ax + by = gcd(a,b)

The x, y, and therefore if we want c substituting into gcd (a, b), then, it must be c gcd (a, b) is an integer multiple, so gcd (a, b) | c, c and therefore if not gcd (a, b) is an integer multiple of it, the indefinite equation has no solution.

 

Next, we must solve the equation of

Because until we get c must gcd (a, b) is an integer multiple, so c = k * gcd (a, b), and the k * x k * y is a solution of the equation set, set well understood, because we ask

ax + by = c

Substituting extended Euclidean

ax + by = gcd(a,b)

Since both are equivalent, and c = k * gcd (a, b), so that both sides of the passenger k

k * (ax + by) = k * gcd(a,b)

Simplification was

k * x * a + k * y * b = k * gcd(a,b)

The k * gcd (a, b) substitution of an equivalent amount is c, to give

k*x * a + k*y * b = c

Therefore, a solution for the extended Euclidean, k * x k * y and the variable is the equation.

There are particular solution through the request Solution:

Because there appreciated it an infinite solutions, so that t is an arbitrary constant is substituted into equation extended Euclid, provided p1a + q1b = gcd (a, b)

Provided p = p1 * t

q = q1 * t

Obviously, since p1a + q1b = gcd (a, b)

Therefore pa + qb = gcd (a, b) * t

Dividing both sides with gcd (a, b)

To give pa / gcd (a, b) + qb / gcd (a, b) = t

In addition to both sides with t

Obtained p1a / gcd (a, b) + q1b / gcd (a, b) = 1

p1a / gcd(a,b) + q1b / gcd(a,b) = 1

p1*(a / gcd(a,b) ) + q1*(b / gcd(a,b)) = 1

The extended Euclid previous equation, ax + by = c in the middle,

c must gcd (a, b) is an integer multiple, now c = 1, gcd (a, b) = gcd (a / gcd (a, b), b / gcd (a, b))

Therefore c must be gcd (a / gcd (a, b), b / gcd (a, b)) is an integral multiple, and c = 1, so gcd (a / gcd (a, b), b / gcd (a , b)) is equal to only 1,

Therefore, a / gcd (a, b) and b / gcd (a, b) must be coprime, so equations have solutions.

Know the conditions of the judgment, we can use the general solution of the equation Euclid indefinite extension.

 

Next you need to understand a concept called congruence:

If A MOD m = B m MOD , called a, b in the mold m meaning the same below I
can be written as A B ( MOD m )

Congruence has the following properties:

A A ( MOD m )
if A B ( MOD m ) , the B A ( MOD m )
if A B ( MOD m ) ; B C ( MOD m ) , then A C ( MOD m )
if a B ( MOD m ) , C D ( MOD m ) , then
a+ C B + D ( MOD m ) AC
BD ( MOD m ) AC BD ( MOD m ) by a defined above, can be derived AX . 1 ( MOD m ) This congruence equation


It is equivalent to solving the indefinite equation AX - My =. 1  

Therefore, to solve ax ≡ 1 (mod m) becomes Solving ax - my = 1, it is indefinite equation solving amounts to solving congruence equation.

 

At this time, we can define the inverse of the introduction:

Inverse element means one can cancel the other elements of a given element operation,

Therefore, a set of inverse element x, then

ax = 1

It was in the case of modulo m

ax ≡ 1(mod m)

This is precisely a congruence equation, it can be converted to ax - my = 1, solving this equation with variable exgcd.

 

So how to solve the congruence equation it?

Congruence equation:

x ≡ a1(mod m1)

x ≡ a2(mod m2)

...

x ≡ an(mod mn)

Solution of a congruence equations, solving integer solutions x of the smallest non-negative.

 

Guess you like

Origin www.cnblogs.com/dudujerry/p/11620728.html