Maths WorkshopMaths problems with full solutions
Exercise 1486Number theory › Diophantine equationsL1Added 2 Nov 2026

Solving $ax+by=c$

#Diophantine equation#Bézout#solvability criterion

Statement

Let a,b,ca,b,c be integers with a,ba,b not both zero. Show that ax+by=cax+by=c has integer solutions if and only if \divisibility(a,b)∣c\divisibility(a,b)\mid c.

Hint

For the forward direction, note that \divisibility(a,b)\divisibility(a,b) divides every linear combination. For the converse, use Bézout.

Show solutionHide solution

Solution

Necessity. If ax+by=cax+by=c and d=\divisibility(a,b)d=\divisibility(a,b), then d∣ad\mid a and d∣bd\mid b, so d∣ax+by=cd\mid ax+by=c.

Sufficiency. Suppose d∣cd\mid c, say c=dqc=dq. By Bézout, there exist u,vu,v with au+bv=dau+bv=d. Multiplying by qq:
a(uq)+b(vq)=dq=c.a(uq)+b(vq)=dq=c.
So (x,y)=(uq,vq)(x,y)=(uq,vq) is a solution.