0

Is there a way that we can solve a system of congruences,

$x \equiv m \, (modp)$

$y \equiv n \, (modq)$

while satisfying the condition $x+y=N$, when $m,n,p,q$ and $N$ are known?

Here $p,q$ are primes, $N=p^2 q$ and

case 1: $m=p, n=q$

case 2:$m=n=0$

Thanks a lot in advance.

Bill Dubuque
  • 272,048

1 Answers1

0

Only as long as

$$d = \gcd(p,q) \mid N - m - n \tag{1}\label{eq1A}$$

then there's a way to solve the system of congruences. You have

$$x \equiv m \pmod{p} \iff x - m = ap, \; a \in \mathbb{Z} \tag{2}\label{eq2A}$$

$$y \equiv n \pmod{q} \iff y - n = bq, \; b \in \mathbb{Z} \tag{3}\label{eq3A}$$

Adding \eqref{eq2A} and \eqref{eq3A}, plus using that $x + y = N$, gives

$$\begin{equation}\begin{aligned} x + y - m - n & = ap + bq \\ N - m - n & = ap + bq \end{aligned}\end{equation}\tag{4}\label{eq4A}$$

Note Bézout's identity states there exists integers $x$ and $y$ such that

$$xp + bq = d \tag{5}\label{eq5A}$$

Multiplying both sides by $\frac{N - m - n}{d}$ allows you to assign $a = \frac{x(N - m - n)}{d}$ and $b = \frac{y(N - m - n)}{d}$. From \eqref{eq2A} you have $x = m + ap$, and from \eqref{eq3A} you have $y = n + bq$. You can confirm this also fits \eqref{eq4A} and that $x + y = N$.

John Omielan
  • 47,976
  • Thanks a lot, @JohnOmielan I edited the question a little bit, $p,q$ are primes. So then $gcd(p,q)=1$. We can still follow the above method in the same way, right? – Buddhini Angelika Apr 29 '20 at 07:57
  • @BuddhiniAngelika You're welcome. I didn't see your latest edits when I originally wrote my answer. Nonetheless, with $p$ and $q$ being distinct primes so $d = \gcd(p,q)=1$, then you can still follow the method I outlined above. – John Omielan Apr 29 '20 at 08:23
  • Thank you very much @JohnOmielan I'm considering distinct primes. This is very helpful. – Buddhini Angelika Apr 30 '20 at 10:31