This article was co-authored by wikiHow Staff. Our trained team of editors and researchers validate articles for accuracy and comprehensiveness. wikiHow's Content Management Team carefully monitors the work from our editorial staff to ensure that each article is backed by trusted research and meets our high quality standards.
There are 8 references cited in this article, which can be found at the bottom of the page.
This article has been viewed 229,414 times.
Learn more...
Solving a linear Diophantine equation means that you need to find solutions for the variables x and y that are integers only. Finding integral solutions is more difficult than a standard solution and requires an ordered pattern of steps. You must first find the greatest common factor of the coefficients in the problem, and then use that result to find a solution. If you can find one integral solution to a linear equation, you can apply a simple pattern to find infinitely many more.
Steps
Setting up the Equation
-
1Write the equation in standard form. A linear equation is one that has no exponents greater than 1 on any variables. To solve a linear equation in this style, you need to begin by writing it in what is called “standard form.” The standard form of a linear equation looks like , where and are integers.[1]
- If the equation is not already in standard form, you need to use the basic rules of algebra to rearrange or combine the terms to create the standard form. For example, if you begin with , you can combine similar terms to reduce the equation to .
-
2Reduce the equation if possible. When the equation is in standard form, check all three terms and . If there is a common factor in all three terms, then reduce the equation by dividing all terms by that factor. If you reduce evenly across all three terms, then any solution you find for the reduced equation will also be a solution for the original equation.[2]
- For example, if all three terms are even, you can at least divide by 2, as follows:
- (all terms are divisible by 2)
- (all terms now are divisible by 3)
- (this equation is as reduced as possible)
Advertisement - For example, if all three terms are even, you can at least divide by 2, as follows:
-
3Check for the impossibility of a solution. In some cases, you may be able to tell immediately if there is no solution to your problem. If you see a common factor on the left side of the equation that is not shared on the right side, then there can be no solution to the problem.[3]
- For example, if both and are even, then the sum of the left side of the equation would have to be even. But if is odd, then there will be no integer solution to the problem.
- will have no integer solution.
- can have no integer solution, because the left side of the equation is divisible by 5, but the right side is not.
- For example, if both and are even, then the sum of the left side of the equation would have to be even. But if is odd, then there will be no integer solution to the problem.
Using the Euclidean Algorithm
-
1Review the Euclidean algorithm. The Euclidean algorithm is a system of repeated divisions, using the remainder each time as the divisor of a new division. The last divisor that divides evenly is the greatest common factor (GCF) of the two numbers.[4]
- For example, the following steps illustrate the Euclidean algorithm being used to find the GCF of 272 and 36:
- ....divide the larger number (272) by the smaller (36) and note the remainder (20)
- ....divide the previous divisor (36) by the previous remainder (20). Note the new remainder (16).
- ....Repeat. Divide the previous divisor (20) by the previous remainder (16). Note the new remainder (4).
- ....Repeat. Divide the previous divisor (16) by the previous remainder (4). Since the remainder is now 0, conclude that 4 is the GCF of the original two numbers 272 and 36.
- For example, the following steps illustrate the Euclidean algorithm being used to find the GCF of 272 and 36:
-
2Apply the Euclidean algorithm to the coefficients A and B. With your linear equation in standard form, identify the coefficients A and B. Apply the Euclidean algorithm to find their GCF. Suppose you need to find integral solutions for the linear equation .[5]
- The steps of the Euclidean algorithm for the coefficients 87 and 64 are as follows:
- The steps of the Euclidean algorithm for the coefficients 87 and 64 are as follows:
-
3Identify the greatest common factor (GCF). Because the Euclidean algorithm for this pair continues all the way down to dividing by 1, the GCF between 87 and 64 is 1. This is another way of saying that 87 and 64 are relatively prime.[6]
-
4Interpret the result. When you complete the Euclidean algorithm to find the GCF of and , you need to compare that result with the number of the original equation. If the greatest common factor of and is a number that can divide into , then your linear equation will have an integral solution. If not, then there will be no solution.[7]
- For example, the sample problem will have an integral solution, since the GCF of 1 can be evenly divided into 3.
- Suppose, for example, that the GCF had worked out to be 5. The divisor 5 cannot go evenly into 3. In that case, the equation would have no integral solutions.
- As you will see below, if an equation has one integral solution, then it also has infinitely many integral solutions.
Renaming the GCF to find the Solution
-
1Label the steps of the GCF reduction. To find the solution of the linear equation, you will use your work on the Euclidean algorithm as the basis for a repeated process of renaming and simplifying values.[8]
- Begin by numbering the steps of the Euclidean algorithm reduction, as reference points. Thus, you have the following steps:
- Begin by numbering the steps of the Euclidean algorithm reduction, as reference points. Thus, you have the following steps:
-
2Begin with the last step that has a remainder. Rewrite that equation so the remainder stands alone, as equal to the rest of the information in the equation.[9]
- For this problem, Step 6 is the last one that showed a remainder. That remainder was 1. Rewrite the equation in Step 6 as follows:
- For this problem, Step 6 is the last one that showed a remainder. That remainder was 1. Rewrite the equation in Step 6 as follows:
-
3Isolate the remainder of the previous step. This procedure is a step-by-step process of moving “up” the steps. Each time, you will be revising the right side of the equation in terms of the numbers in the higher step.[10]
- You can revise Step 5 to isolate its remainder as:
- or
- You can revise Step 5 to isolate its remainder as:
-
4Perform a substitution and simplify. You should notice that your revision of Step 6 contains the number 2, and your revision of Step 5 is equal to 2. Substitute the equality in Step 5 into the place of the 2 in your Step 6 revision:[11]
- ….. (This is the Step 6 revision.)
- ….. (Substitute in place of the value 2.)
- ….. (Distribution of the negative sign)
- …..(Simplify)
-
5Repeat the process of substitution and simplification. Moving through the Euclidean algorithm steps in reverse, repeat the process. Each time, you will revise the previous step, and substitute its value into your latest result.[12]
- The last step was Step 5. Now revise Step 4 to isolate its remainder as:
- Substitute that value in place of the 3 in your latest simplification step and then simplify:
- The last step was Step 5. Now revise Step 4 to isolate its remainder as:
-
6Continue repeating substitution and simplification. This process will repeat, step by step, until you reach the original step of the Euclidean algorithm. The purpose of this procedure is to wind up with an equation that will be written in terms of 87 and 64, which are the original coefficients of the problem you are trying to solve. Continuing in this manner, the remaining steps are as follows:[13]
-
…..(Substitution from Step 3)
-
…..(Substitution from Step 2)
-
…..(Substitution from Step 1)
-
7Rewrite the result in terms of the original coefficients. When you return to the first step of the Euclidean algorithm, you should notice that the resulting equation contains the two coefficients of the original problem. Rearrange the numbers so they align with the original equation.[14]
- In this case, the original problem you are trying to solve is . Thus, you can rearrange your last step to put the terms in that standard order. Pay particular attention to the 64 term. In the original problem, that term is subtracted, but the Euclidean algorithm treats it as a positive term. To account for the subtraction, you need to change the multiplier 34 to a negative. The final equation looks like this:
- In this case, the original problem you are trying to solve is . Thus, you can rearrange your last step to put the terms in that standard order. Pay particular attention to the 64 term. In the original problem, that term is subtracted, but the Euclidean algorithm treats it as a positive term. To account for the subtraction, you need to change the multiplier 34 to a negative. The final equation looks like this:
-
8Multiply by the necessary factor to find your solutions. Notice that the greatest common divisor for this problem was 1, so the solution that you reached is equal to 1. However, that is not the solution to the problem, since the original problem sets 87x-64y equal to 3. You need to multiply the terms of your last equation by 3 to get a solution:[15]
-
9Identify the integral solution to the equation. The values that must be multiplied by the coefficients are the x and y solutions to the equation.
- In this case, you can identify the solution as the coordinate pair .
Finding Infinitely Many More Solutions
-
1Recognize that infinitely many solutions exist. If a linear equation has one integral solution, then it must have infinitely many integral solutions. Here is a brief algebraic statement of the proof:[16]
- ….. (Adding a B to x while subtracting A from y results in the same solution.)
-
2Identify your original solution values for x and y. The pattern of infinite solutions begins with the single solution that you identified.[17]
- In this case, your solution is the coordinate pair .
-
3Add the y-coefficient B to the x solution. To find a new solution for x, add the value of the coefficient of y.[18]
- In this problem, beginning with the solution x=-75, add the y coefficient of -64, as follows:
- Thus, a new solution for the original equation will have the x value of -139.
- In this problem, beginning with the solution x=-75, add the y coefficient of -64, as follows:
-
4Subtract the x-coefficient A from the y solution. To make the equation remain balanced, when you add to the x term, you must then subtract from the y term.
- For this problem, beginning with the solution y=-102, subtract the x coefficient of 87, as follows:
- Thus, a new solution for the original equation will have the y coordinate of -189.
- The new ordered pair should be .
- For this problem, beginning with the solution y=-102, subtract the x coefficient of 87, as follows:
-
5Check the solution. To verify that your new ordered pair is a solution to the equation, insert the values into the equation and see if it works.[19]
- Because the statement is true, the solution works.
-
6Write a general solution. The values for x will fit a pattern of the original solution, plus any multiple of the B coefficient. You can write this algebraically as follows:[20]
- x(k)=x+k(B), where x(k) represents the series of all x solutions, and x is the original x value that you solved.
- For this problem, you can say:
- y(k)=y-k(A), where y(k) represents the series of all y solutions, and y is the original y value that you solved.
- For this problem, you can say:
- x(k)=x+k(B), where x(k) represents the series of all x solutions, and x is the original x value that you solved.
Community Q&A
-
QuestionHow do you solve the linear congruence of 28x=38(mod42)?Community AnswerIntroduce a second variable to convert the modular equation to an equivalent diophantine equarion. So 28x = 38 + 42y for some integers x and y. Simplify to 14 (2x - 3y) = 38. But 2x - 3y is an integer. The left side is always a multiple of 14, but 38 is not. So that equation has no solutions mod 42.
-
QuestionAre all equations with integral coefficients diophantine equations?Community AnswerNo. Both ordinary and diophantine equations can have any type of integer or non-integer coefficients. Diophantine-ness refers to the domain of the variable(s) - it's those that have to be integers.
-
QuestionHow do I find solutions to word problems involving linear Diophantine equations?Community AnswerFigure out what the question is asking. Cross out any irrelevant information, then put all the values into your equation.
References
- ↑ https://www.khanacademy.org/math/algebra/x2f8bb11595b61c86:forms-of-linear-equations/x2f8bb11595b61c86:summary-forms-of-two-variable-linear-equations/a/forms-of-linear-equations-review
- ↑ https://sites.millersville.edu/bikenaga/number-theory/linear-diophantine-equations/linear-diophantine-equations.html
- ↑ https://brilliant.org/wiki/linear-diophantine-equations-one-equation/
- ↑ https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/the-euclidean-algorithm
- ↑ http://mathworld.wolfram.com/EuclideanAlgorithm.html
- ↑ http://mathworld.wolfram.com/EuclideanAlgorithm.html
- ↑ http://mathworld.wolfram.com/EuclideanAlgorithm.html
- ↑ https://sites.millersville.edu/bikenaga/number-theory/linear-diophantine-equations/linear-diophantine-equations.html
- ↑ https://www.diva-portal.org/smash/get/diva2:530204/FULLTEXT01.pdf
- ↑ https://www.diva-portal.org/smash/get/diva2:530204/FULLTEXT01.pdf
- ↑ https://www.diva-portal.org/smash/get/diva2:530204/FULLTEXT01.pdf
- ↑ https://sites.millersville.edu/bikenaga/number-theory/linear-diophantine-equations/linear-diophantine-equations.html
- ↑ https://sites.millersville.edu/bikenaga/number-theory/linear-diophantine-equations/linear-diophantine-equations.html
- ↑ http://math.stackexchange.com/questions/20717/how-to-find-solutions-of-linear-diophantine-ax-by-c
- ↑ http://math.stackexchange.com/questions/20717/how-to-find-solutions-of-linear-diophantine-ax-by-c
- ↑ https://math.libretexts.org/Courses/Mount_Royal_University/MATH_2150%3A_Higher_Arithmetic/5%3A_Diophantine_Equations/5.1%3A_Linear_Diophantine_Equations
- ↑ https://brilliant.org/wiki/linear-diophantine-equations-one-equation/
- ↑ https://brilliant.org/wiki/linear-diophantine-equations-one-equation/
- ↑ https://brilliant.org/wiki/linear-diophantine-equations-one-equation/
- ↑ https://brilliant.org/wiki/linear-diophantine-equations-one-equation/