unique solution for mod equation

1k Views Asked by At

If I have these equations
$a\equiv b \pmod c$

$d\equiv e \pmod c$
All known except $c$

and $\gcd(b−a,e−d)=1$

how do I find the unique solution for $c$?

and if the gcd!= 1 how do I find some possible solutions?

3

There are 3 best solutions below

2
On

In both cases, $c$ can be any of the (not necessarily prime) divisors of the $gcd$.

So you can simply pick $c=gcd(b-a,e-d)$.

0
On

$$b-a=mc\\d-e=nc\\gcd(b-a,d-e)=c*gcd(m,n)=1\\c=gcd(m,n)=1$$

0
On

$\begin{eqnarray}{\bf Hint}\qquad\quad a\equiv b\!\!\pmod{\! c}\\d\equiv e\!\!\pmod{\! c}\end{eqnarray}\iff $ $\begin{eqnarray} c\mid a-b\\c\mid d-e\end{eqnarray}\iff c\mid\gcd(a-b,d-e)$

This first equivalence is by definition of congruence, and the second is the universal gcd property.