Linear Diophantine Equations Page | SECTION A Linear

advertisement
Linear Diophantine Equations
Page | 1
SECTION A Linear Diophantine Equations
By the end of this section you will be able to
 recognise a linear Diophantine equation
 solve a linear Diophantine equation
A1 Introduction
This is a scene from Die Hard with Vengeance:
• On the fountain's edge there was an empty 3 gallon bucket and an empty 5 gallon
bucket.
• The message on the bomb said that the only way to diffuse it was to place
EXACTLY 4 gallons of water on the pressure sensitive pad attached to the bomb's
arming mechanism.
How can we solve this problem?
Let x and y be the number of times we fill the 5 and 3 gallon containers respectively.
We have
5x  3 y  4
4  5x
Solving this for y gives y 
.
3
Only interested in integer solutions. By trial and error we have the solution x  2 and
y  2 .
This solution means fill the 5 gallon container twice and empty the 3 gallon twice which
is illustrated below:
Figure 1
The linear equation 5 x  3 y  4 is an example of a Diophantine equation where we
restrict our solutions to integers. Actually this equation 5 x  3 y  4 is a linear
Diophantine equation.
Linear Diophantine Equations
Page | 2
From the course on linear algebra you should know the equation 5 x  3 y  4 has an
infinite number of solutions. Why?
Because we have two unknowns x and y but only one equation which means there are
only two possibilities – no solution or infinite number of solutions. Since we have already
found a solution so the equation is consistent which means we have an infinite number of
solutions. We can plot the solutions on a graph:
Any point on
this line is a
solution.
Figure 2
How can we write the infinite number of solutions?
4  5x
Since y 
so let x  t where t is any real number. Hence
3
4  5t
y
3
When t  2 we have the above solution x  2 and y  2 . If t  2 we have the solution
45
1
x  1, y 

3
3
This time we do not have an integer solution.
A2 Solutions of a Linear Diophantine Equation
If a linear system ax  by  c has a solution then it has an infinite number of
solutions.
Proposition (1.1).
If a linear system ax  by  c has a solution x0 and y0 then so is
x  x0  bt and y  y0  at
for any integer t.
Proof.
We are given that x0 and y0 are solutions to the equation, so we have
ax0  by0  c
Substituting x  x0  bt and y  y0  at into the given equation ax  by  c yields
a  x0  bt   b  y0  at   ax0  abt  by0  bat
 ax0  by0
 abt  abt
c
 c
Hence x  x0  bt and y  y0  at is a solution for any integer t.
0
Linear Diophantine Equations
Page | 3
■
Example 1
For the above example 5x  3 y  4 find other integer solutions apart from x  2
and y  2 .
Solution
Applying the above Proposition (1.1) with x0  2 , y0  2 , a  5 and b  3 we have
(*)
x  x0  bt  2  3t and y  y0  at  2  5t
Substituting t  1 into (*) gives
x  2  3t  2  3 1  5 and y  2  5t  2  5 1  7
Check that x  5 and y  7 is a solution to the given equation 5x  3 y  4 .
Substituting t  2 into (*):
x  2  3t  2  3  2  8 and y  2  5t  2  5  2   12
We can create a table of values:
y  2  5t
t
x  2  3t
0
2  3  0  2
2  5  0  2
3
2  3  3  7
2  5  3  13
10
2  3 10   32
2  5 10  52
2  3  666  2000
2  5  666  3332
You may like to check these solutions satisfy the given equation.
666
We need a process by which we can test if a linear Diophantine equation has a solution or
not. The next proposition states such a process:
Proposition (1.2).
Consider the linear Diophantine equation ax  by  c . Let g  gcd  a, b  . If g
does not divide c then the linear equation has no solution. If g c then the given equation
has a solution.
Proof.
Assume g does not divide c. Suppose ax  by  c has a solution. We are given
that g  gcd  a, b  which means that g a and g b therefore
g  ax  by   g c
We have contradiction because g divides c and does not divide c. Hence
ax  by  c has no solution.
Suppose g c . There is an integer k such that gk  c .
We are given g  gcd  a, b  so there exists integers m and n such that
g  am  bn
Multiplying this by k gives
gk  amk  bnk
 a  mk   b  nk   c
Let x  mk and y  nk so we have ax  by  c which means we have a solution.
This completes our proof.
Linear Diophantine Equations
Page | 4
■
Example 2
Decide whether the following linear Diophantine equations have a solution:
(a) 2x  4 y  5
(b) 7 x  3 y  4
(c) 15x  30 y  45
Solution
In each case we apply the above proposition (1.2).
(a) For 2x  4 y  5 we have a  2 and b  4 so
g  gcd  2, 4   2 and 2 does not divide 5
Hence the given equation has no integer solution which means no point on the line
2x  4 y  5 has integer coordinates:
Figure 3(a)
(b) Similarly we have a  7 and b  3 and the
g  gcd  3, 7   1
1 divides 4 so the equation 7 x  3 y  4 has integer solutions. We can illustrate this
by looking at the graph of 7 x  3 y  4 :
Figure 3(b)
(c) We are given the equation 15x  30 y  45 . The
g  gcd 15, 30  15 and 15 divides 45
The given equation 15x  30 y  45 has integer solutions:
Linear Diophantine Equations
Page | 5
Figure 3(c)
Example 3
Suppose you have to pay a parking meter of £2.10 and the meter only accepts 2p and 10p
coins. How many of each do you need in order to pay?
Solution
We can formulate this as a Diophantine equation. Let x be the number of 2p coins and y
be the number of 10p coins. We have
2x  10 y  210
Need to solve this equation for integer solutions. Why?
Because we cannot break the 2p and 10p coins into smaller coins.
Clearly g  gcd  2, 10  2 and 2 10 so we have integer solutions. We can find the
integer solutions by trial and error. For example x  0, y  21 . This means we have 21
pieces of 10p coins and no 2p coins.
Need to find the
integer solutions
on this line.
Figure 4
We need a way to capture all the integer solutions.
A3 General Solutions of a Linear Diophantine Equation
We can summarize the above into:
Theorem (1.3):
The linear Diophantine equation ax  by  c has a solution  g c where
g  gcd  a, b  . If x0 , y0 are particular solution of this equation, then all the other
integer solutions are given by
b
a
x  x0    t and y  y0    t
g
g
where t is an arbitrary integer.
Linear Diophantine Equations
Page | 6
In the above Example 3 we choose a particular solution, x  0, y  21 and substitute
b
a
g  2 , a  2, b  10 into x  x0    t and y  y0    t :
g
g
 10 
2
x  0    t  5t and y  21    t  21  t
2
 2
The general solution to the above equation is x  5t and y  21  t .
Remember x and y represent the number of 2p and 10p coins respectively. These cannot
be negative. This means we must have x  5t  0 and y  21  t  0 . What is the range of
values of t?
0  t  21
The solutions in the above example were found by trial and error. This is always possible
but may take a long time to find a solution. Next we describe a systematic way of finding
the solution.
Example 4
Solve the linear congruence 343x  280 y  35 and find the general solution.
Solution
First we need to find the g  gcd  343, 280  . Applying the Euclidean algorithm:
343  1 280   63
280  4  63  28
63  2  28   7
28  4  7   0
Hence the g  gcd  343, 280  7 and 7 divides 35 so there are solutions. How do we
find the solutions?
Working backwards from the above:
7  63  2  28 
 63  2  280  4  63   9  63  2  280 
 9  343  280   2  280 
 9  343  11 280   343  9   280  11
We have found 343  9  280  11  7 but we need to find integers x and y such that
343x  280 y  35
How?
Multiply 343  9  280  11  7 by 5:
343  9  5   280  11 5   7  5
343  45   280  55   35

x  45 and y  55
A particular solution to the given equation is x  45 and y  55 :
Linear Diophantine Equations
Page | 7
Figure 5
By the above Theorem (1.3) all the other solutions are given by:
b
a
x  x0    t and y  y0    t
g
g
We have
b
 280 
 343 
x  x0    t  45  
 t  45  40t and y  55   7  t  55  49t


 7 
g
for some integer t. Hence the general solution is x  45  40t and y  55  49t .
Example 5
Solve the linear congruence 172x  20 y  1000 and state the general solution.
Solution
First we need to find the g  gcd 172, 20 . Applying the Euclidean algorithm:
172  8  20   12
20  112   8
12  1 8   4
8  2  4  0
Hence g  gcd 172, 20  4 and 4 divides 1000 so there are solutions. How do we find
the solutions?
Working backwards from the above:
4  12  8
 12   20  12   2 12   20
 2 172  8  20    20
 2 172   17  20   172  2   20  17 
We have found 172  2  20  17   4 but we need to find integers x and y such that
172x  20 y  1000
How?
Multiply 172  2  20  17   4 by 250:
Linear Diophantine Equations
Page | 8
172  2  250   20  17  250   4  250
172  500   20  4250   1000
A particular solution to the given equation is x  500 and y  4250 .
By (1.3):
b
a
x  x0    t and y  y0    t
g
g
The general solution is
b
 20 
 172 
x  x0    t  500    t  500  5t and y  35  
 t  4250  43t
 4 
 4 
g
where t is an integer. We have x  500  5t and y  4250  43t :
Figure 6
In the above example the unknowns x and y may have to be positive integers. How do we
find the positive integer solution?
This means we need solve the inequalities for t:
x  500  5t  0 and y  4250  43t  0
Solving the first inequality x  500  5t  0 :
500  5t  0  5t  500  t  100
Solving y  4250  43t  0 :
4250
4250  43t  0   43t  4250   t 
 98.83  t  98.83
43
Combining these two results we have
100  t  98.83
This means the only integer solution occurs when t  99 . Substituting t  99 into
x  500  5t and y  4250  43t :
x  500  5  99  5 and y  4250  43  99  7
The given Diophantine equation 172x  20 y  1000 has a unique positive integer
solution - x  5 and y  7 .
Download