Number of nonnegative solutions of equation ax+by=n

112 Views Asked by At

If $a,b$ are natural numbers and $\gcd(a,b) = 1$ then number of nonnegative solutions of equation $ax+by=n$ is equal to $\lfloor $$\frac{n}{ab}$$ \rfloor$ or $\lfloor $$\frac{n}{ab}$$ \rfloor$ + 1

I need to check if this statement is true.

1

There are 1 best solutions below

1
On

Bézout's theorem states that if $\gcd(a,b)=d$, then exists some $p,q \in \mathbb{Z}$ such that:

$$ap+bq=d$$

then, you have to multiply by $\frac{n}{d}$:

$$a\left( \frac{pn}{d} \right) + b\left( \frac{qn}{d} \right) = n$$

and notice that:

$$a\left( \frac{pn}{d}{{\color{red} {-1}}} \right) + b\left( \frac{qn}{d}+{{\color{red} {\frac{a}{b}} }} \right) = n$$