MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I posted on StackOverflow looking for a reasonably fast algorithm to solve systems of linear Diophantine inequalities and was pointed to this article by Cheng-Zhi Gao and Yu-Lin Dong. The problem is, they give the algorithm on pages 350-351, but part of step (3) appears to be missing.

My question for MathOverflow is, therefore, whether anyone knows either of another such algorithm or has an idea as to what the missing part of Gao and Dong's algorithm is.

share|cite|improve this question
@Joseph O'Rourke: The question you linked to is on systems of linear + quadratic Diophantine equations, whereas this one restricts to linear Diophantine equations. – j.c. Jul 11 '11 at 1:56
Please review: "Algorithms for solving systems of linear Diophantine inequalities," a previous MO question:… , whose title differs by just one character (pluralizing 'Algorithm'). – Joseph O'Rourke Jul 11 '11 at 1:58
@jc: Point taken! – Joseph O'Rourke Jul 11 '11 at 1:59
What's the complexity of their algorithm? – Michael Wehar Feb 15 '15 at 23:31
up vote 4 down vote accepted

Mathematica implements an algorithm: see the manual here:

(Added in response to a comment query.)

The paper

Hochbaum, Dorit S., and Anu Pathria. "Can a System of Linear Diophantine Equations be Solved in Strongly Polynomial Time?." (1994). (PDF download link)

says that "no strongly polynomial algorithm exists for the problem of finding the set of solutions to a system of linear diophantine equations in the complexity model allowing the operations $\{ +, -, \times, /, \bmod, < \}$." But if one assumes the gcd can be found quickly, then the system can be solved in strongly polynomial time.

share|cite|improve this answer
Thank you for this source. :) – Michael Wehar Feb 16 '15 at 0:50
Do you happen to know about the complexity of determining whether or not a system of inequalities has integer solutions? – Michael Wehar Feb 16 '15 at 0:57
Awesome! Thank you very much. I appreciate it. :) – Michael Wehar Feb 16 '15 at 4:31

GAP provides a function NullspaceIntMat which solves systems of linear diophantine equations. The documentation says:

25.1-2 SolutionIntMat

* SolutionIntMat( mat, vec ) ───────────────────────────────────── operation

If  mat  is  a  matrix  with integral entries and vec a vector with integral
entries,  this  function  returns  a vector x with integer entries that is a
solution  of  the  equation x * mat = vec. It returns fail if no such vector

────────────────────────────────  Example  ─────────────────────────────────
  gap> mat:=[[1,2,7],[4,5,6],[7,8,9],[10,11,19],[5,7,12]];;
  gap> SolutionMat(mat,[95,115,182]);
  [ 47/4, -17/2, 67/4, 0, 0 ]
  gap> SolutionIntMat(mat,[95,115,182]);
  [ 2285, -5854, 4888, -1299, 0 ]

The source code can be found in the file lib/ included in the GAP distribution.

There is also a function SolutionNullspaceIntMat which additionally computes a basis of the integral nullspace of the given matrix.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.