Professional Documents
Culture Documents
Appendix A: Solving Linear Equations in Unknowns
Appendix A: Solving Linear Equations in Unknowns
c1 x1 + c2 x2 + c3 x3 + · · · + cn xn = k , (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)
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)
Gx = 0 , (A.5)
where
g11 g12 g13 ... ... g1n p1
0 g22 g23 ... ... g2n p2
G= .. .. .. .. .
0 0 . . ... . .
0 0 0 gm,m ... gmn 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 nonneg-
ative integers of xi s
x 1 + x2 + x3 = 6, (A.6)
2x1 + 3x2 + 4x3 = 16 . (A.7)
x2 + 2x3 = 4 . (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 4 0 2
2 3 2 1 .
3 2 4 0