Professional Documents
Culture Documents
A.1
(A.1)
where xi s are the variables and ci s are the coefficients. The ci s are nonnegative
integers and k is a positive integer. We wish to solve for xi , for i = 1, 2, . . . , n
subject to a constraint that all xi s must be nonnegative integers. In addition, the
following constraint may be imposed:
xi qi (constant) .
(A.2)
x(n 1) = In1
x(n) = (k c(1) x(1) . . .
c(n 1) x(n 1))/c(n).
IF x(n) < 0, DISCARD THE SOLUTION.
IF x(n) 0, SAVE THE SOLUTION.
NEXT In1
..
.
NEXT I3
NEXT I2
NEXT I1
A.2
=
=
..
.
k1 ,
k2 ,
km ,
(A.3)
where the coefficients cij s are nonnegative integers, the constants ki s are positive
integers, and n > m. Furthermore, the solutions to the system of equations are
subject to a constraint that all the variables xi , for i = 1, 2, . . . , n, must be nonnegative
integers. Writing Equation (A.3) in matrix form yields
Cx=0,
(A.4)
where
c11
c21
..
.
c12
c22
..
.
cm1
x
cm2
c13
c23
..
.
cn3
T
[x1 , x2 , . . . , xn , 1]
...
...
..
.
c1n
c2n
..
.
...
cmn
k1
k2
..
.
km
g11
0
G=
0
0
g12
g22
g13
g23
..
.
0
0
(A.5)
...
...
..
.
...
...
g1n
g2n
..
.
...
...
gm,m
gmn
p1
p2
..
.
pm
The last row in Equation (A.5) contains n m + 1 unknowns which can be solved
by the procedure outlined in the preceding section. Once xm , . . . , xn are known, the
remaining unknowns are found by back substitution.
Example A.1 We wish to solve the following two equations for all possible nonnegative integers of xi s
x 1 + x2 + x3
6,
(A.6)
16 .
(A.7)
(A.8)
Equation (A.8) contains two unknowns. Since both 2x3 and 4 are even numbers, x2
must be an even number. Let x2 assume the values of 0, 2, and 4, one at a time, and
solve Equation (A.8) for x3 . Once x3 is found, we solve Equation (A.6) for x1 . As a
result, we obtain the three solutions:
Solution
x1
x2
x3
1
2
3
4
3
2
0
2
4
2
1
0
References
[1] Gelfond, A.O., 1981, Solving Equations in Integers, Translated by Sheinin,
O.B., Mir Publisher, Moscow.