Sunteți pe pagina 1din 10

Diophantine Equation

A Diophantine equation is an equation in which only integer solutions are allowed.


Hilbert's 10th problem asked if an algorithm existed for determining whether an arbitrary
Diophantine equation has a solution. Such an algorithm does exist for the solution of
first-order Diophantine equations. However, the impossibility of obtaining a general
solution was proven by Yuri Matiyasevich in 1970 (Matiyasevich 1970, Davis 1973,
Davis and Hersh 1973, Davis 1982, Matiyasevich 1993) by showing that the
relation
(where
is the
thFibonacci number) is Diophantine. More
specifically, Matiyasevich showed that there is a polynomial in , , and a number of
other variables , , , ... having the property that
iff there exist integers , , , ...
such that
.
Matiyasevich's result filled a crucial gap in previous work by Martin Davis, Hilary
Putnam, and Julia Robinson. Subsequent work by Matiyasevich and Robinson proved
that even for equations in thirteen variables, no algorithm can exist to determine
whether there is a solution. Matiyasevich then improved this result to equations in only
nine variables (Jones and Matiyasevich 1982).
Ogilvy and Anderson (1988) give a number of Diophantine equations with known and
unknown solutions.
A linear Diophantine equation (in two variables) is an equation of the general form
(1)
where solutions are sought with , , and integers. Such equations can be solved
completely, and the first known solution was constructed by Brahmagupta. Consider the
equation
(2)
Now use a variation of the Euclidean algorithm, letting

and
(3)
(4)
(5)
(6)

Starting from the bottom gives


(7)
(8)
so

(9)
(10)
Continue this procedure all the way back to the top.
Take as an example the equation
(11)
and apply the algorithm above to obtain
(12)

The solution is therefore

The above procedure can be simplified by noting that the two leftmost columns are
offset by one entry and alternate signs, as they must since
(13)
(14)
(15)
so the coefficients of

and

are the same and


(16)

Repeating the above example using this information therefore gives


(17)

and we recover the above solution.


Call the solutions to

(18)
and . If the signs in front of
or
are negative, then solve the above equation
and take the signs of the solutions from the following table:
equation

In fact, the solution to the equation


(19)
is equivalent to finding the continued fraction for
1963). If there are terms in the fraction, take the

, with and relatively prime (Olds


th convergent
. But
(20)

so one solution is

, with a general solution


(21)
(22)

with an arbitrary integer. The solution in terms of smallest positive integers is given by
choosing an appropriate .
Now consider the general first-order equation of the form
(23)
The greatest common divisor

can be divided through yielding


(24)

where
,
, and
. If
, then is not an integer and the equation
cannot have a solution in integers. A necessary and sufficient condition for the general
first-order equation to have solutions in integers is therefore that
. If this is the case,
then solve
(25)
and multiply the solutions by , since

(26)
D. Wilson has compiled a list of the smallest th powers of positive integers that are the
sums of the th powers of distinct smaller positive integers. The first few are 3, 5, 6, 15,
12, 25, 40, ...(Sloane's A030052):
(27)
(28)
(29)
(30)
(31)
(32)
(33)
(34)

(35)

SOLVING LINEAR DIOPHANTINE EQUATION


When the first week of the GSoC comes to an end, I was able to finish implementing solver for the
linear Diophantine equations. A linear Diophantine equation is an equation of the form,
where

and c are all integers and

are integer variables.

Case 1: n = 2
If the linear Diophantine equations has only two variables (n = 2), extended Euclids algorithmcan be
used to find the solutions. If solvable, we will have to introduce one parameter. The general form of
the equation when n = 2 can be expressed as ax + by = c. This is solvable if and only if gcd(a, b)
divides c. i.e gcd(c, gcd(a, b)) = gcd(a, b). Here gcd stands for greatest common
divisor. Let x0 and y0 be a solution, then it can be easily noticed that, x0 + bt and y0 -at are also
solutions. We can use this fact to find all the solutions when an initial solution has been found.
Solution of 10x + 14y = 10
We start by dividing both sides of the equation by gcd(a, b). If gcd(a, b) does not divide c, then there
are no solutions. gcd(4, 6) = 2 and 2 divides 10 so this is solvable and dividing by 2 yields,5x + 7y =
5. Now we should apply extended Euclids algorithm. What the algorithm does is finding three

values x0, y0 and d such that ax0 + by0 = d. Here d = gcd(a, b). Since we divided the equation
by gcd(a, b) at the very beginning, d will always be 1 in our case. Below is a simplified version of the
algorithm used in the solver.
def extended_euclid(a, b):
if b == 0:
return (1, 0, a)
else:
x0, y0, d = extended_euclid(b, a%b)
x, y = y0, x0 (a//b) * y0
return x, y, d
extended_euclid(5, 7) returns (3, -2 , 1), i.e 5*3 7*2 = 1. Following is the procedure if you were
work this out manually.
7 = 5*1 + 2
5 = 2*2 + 1
2 = 1*2 + 0
Now starting from the line before the last one we can start going back, 1 = 5 2*2 = 5 2*(7 5*1) =
3*5 2*7 which gives the desired result. Multiplying 5*3 +7*(-2) = 1 by 5 we get 5*15 +7*(-10) =
5 which implies that 15 and -10 are solutions of the initial equation. So all the solutions can be
expressed as, x = 15+7t, y = -10-5t where t is an integer.

Case 2: n > 2
If n > 2, we can express two of the variables using the rest of the variables and a parameter. Below
is an example for this case.
Solution of 2x + 3y + 4z = 5
Lets set x = x and assume y = ax + bm + c and z = dx + em + f where a, b, c, d, e, f are constants to
be found. m is the introduced parameter. Plug in these in original equation,
2x + 3(ax + bm + c) + 4(dx + em + f) = 5
By comparing the two sides we get the set of equations, 3c + 4f = 5, 2 + 3a + 4d = 0 and 3b + 4e =
0 all of which are two variable linear DEs. If these can be solved, these will yield infinite number of
solutions and any pair of values will be acceptable for (a, d), (b, e) and (c, f). In this example all three

equations are solvable and (a, d) = (2, -2) , (b, e) = (4, -3) and (e, f) = (3, -1)would do the trick. Then
the general solution is, x = x, y = 2x + 4m + 3 and z = -2x 3m 1
In the solver module when more than two variables are involved it is rearranged leaving two variable
in one side and all the other variables and constant term in the other side. For example2x + 3y + 4z
= 5 is assumed to be in the form 2x + 3y = 5 4z. Then it finds a separate solution for each of the
two equations 2x + 3y = 5 >(1) and 2x + 3y = -4z >(2). First equation returns a parametric
solution as discussed in case 1 and the solutions for second one can be found by finding a basic
solution(not parametric) for 2x + 3y = -4 and multiplying it by z. Adding the two solutions
for (1) and (2) yields the solution of the original equation.

Diophantine equations
A diophantine equation is an equation where only integer
solutions are accepted. This implies that diophantine
equations becomes harder (or even impossible) to solve than
equations that do not have this restriction. We will show that
diophantine equations of the type

a, b ,c, x, y integean be solved by Euclid's algorithm (assuming


that there is a solution). The method of solution depends of the
coefficientsa, b and c. We have three different variants that we
treat in the examples below:
Example 1: Solve the equation

First we examine gcd(97,35). We have

This means that gcd(97,35)=1. Now we go backwards and


express gcd(97,35) as a linear combination of 97 and 35:

that is

If we multiply this equation by 13 we get

which means that one solution of the diophantine equation


is x=169, y=-468. This is however not the only solution. We can
exactly as inpart 3 add and subtract the least common multiple

such that

We thus have infinitely many solutions

Example 2: Solve the equation

First we examine gcd(98,35). We have

This implies that gcd(98,35)=7, which means that every linear


combination of 98 and 35 must contain the factor 7. Then
also 98x+35ymust be a multiple of 7. But since the right hand
side 13 does not contain the factor 7, there are no integer
solutions to this equation.
Example 3: Solve the equation

We had from example 2 that gcd(98,35)=7. If we go backwards


and express gcd(98,35) as a linear combination of 98 and 35 we
get:

that is

If we multiply this equation by 2 we get

which implies that one solution to the diophantine equation


is x=-2, y=-6. This is however not the only solution. We can
exactly as in part 3 add and subtract the least common multiple

such that

We thus have infinitely many solutions

S-ar putea să vă placă și