WOLFRAM|DEMONSTRATIONS PROJECT

Solving a Linear Diophantine Equation in Two Variables by the Euclidean Algorithm

​
a
173
b
44
show more steps
2
3
4
5
c
30
show solutions
equation
ax+bygcd(a,b)g1
173
=
3
×
44
+
41
44
=
1
×
41
+
3
41
=
13
×
3
+
2
3
=
1
×
2
+
1
2
=
2
×
1
+
0
41
=
a-3b
3
=
-a+4b
2
=
14a-55b
1
=
-15a+59b
one solution
{x,y}{-15,59}
all solutions
{x,y}{44k-15,59-173k}
equation
ax+by0
solution
{x,y}{44k,-173k}
equation
ax+byc
solution
{x,y}{44k-450,1770-173k}
This Demonstration shows the solutions of Diophantine equations of the form
ax+by=gcd(a,b)
,
ax+by=0
and
ax+by=c
using the Euclidean algorithm.