2

I’m looking for a method to solve pairs of simultaneous linear modular equations, such as

323x + 37y = 0 Mod 243; -397x + 683y = 0 Mod 32

I’ve simplified this to 80x+37y = 243g; 19x+11y = 32h

Although I can produce results by brute force, whatever I try just produces further equations. I’m not even sure if I should try to solve one equation first, or both together.

I’ve found plenty of examples, even a calculator, for ax + by = c, but can’t see how to expand from here.

I’ve also found examples of pairs of two variable modular equations, but with a common modulus.

Old Peter
  • 1,357
  • @user236182 I just ran a program to check and could not find any additional solutions, so you just need an argument as to why that is true! – almagest May 18 '16 at 16:52
  • Yes, for $\gcd(y,6)\ne1$ you still have the solutions $x=6679y\bmod7776$. So for some reason it is ok to drop the condition that $\gcd(y,6)=1$. – almagest May 18 '16 at 17:13

1 Answers1

1

Here's a full solution. You're solving $\begin{cases}80x\equiv 206y\pmod{3^5}\\ 19x\equiv 21y \pmod{2^5}\end{cases}$

Now find the Modular Multiplicative Inverse of $80$ mod $3^5$ and of $19$ mod $2^5$. You can apply the Extended Euclidean Algorithm (EEA).

We have $\gcd\left(80,3^5\right)=\gcd\left(19,2^5\right)=1$. By Bézout's lemma this means there exist $r,s,t,u\in\mathbb Z$ such that $80r+3^5s=1$ and $19t+2^5u=1$. We can find the $r,s,t,u$ using EEA.

Here's how you can use EEA. Subtract consecutive equations: $$243=80(0)+243(1)\\80=80(1)+243(0)\\3=80(-3)+243(1)\\2=80(79)+243(-26)\\1=80(-82)+243(27)$$

$$32=19(0)+32(1)\\19=19(1)+32(0)\\13=19(-1)+32(1)\\6=19(2)+32(-1)\\1=19(-5)+32(3)$$

Therefore $80(-82)\equiv 1\pmod{243}$, so $80^{-1}\equiv -82\pmod{243}$.

Also $19(-5)\equiv 1\pmod{32}$, so $19^{-1}\equiv -5\pmod{32}$.

Therefore your system of linear modular equations is equivalent to:

$$\begin{cases}x\equiv (206)(-82)y\equiv 118y\equiv -1097y\pmod{3^5}\\x\equiv (21)(-5)y\equiv 23y\equiv -1097y\pmod{2^5}\end{cases}$$

$$\iff \begin{cases}3^5\mid x-(-1097y)\\2^5\mid x-(-1097y)\end{cases}$$

$$\iff \text{lcm}\left(3^5,2^5\right)=2^5\cdot 3^5\mid x-(-1097y)$$

$$\iff x\equiv -1097y\pmod{2^5\cdot 3^5=7776}$$

I used the property that the system $a\mid c$, $b\mid c$ is equivalent to $\text{lcm}(a,b)\mid c$. Some people might call this property "the universal $\text{lcm}$ property" (see, e.g., here) but it is quite trivial.

You could've also used the Chinese Remainder Theorem instead of this property.

Answer: $(x,y)\equiv (-1097k,k)\pmod{7776}$ for any $k\in\mathbb Z$.

user236182
  • 13,324
  • @almagest I didn't have it in mind in this solution. The system $a\equiv b\pmod{n}$, $a\equiv b\pmod{m}$ is equivalent to the system $n\mid a-b$, $m\mid a-b$, which is equivalent to $\text{lcm}(n,m)\mid a-b$ (what some consider "the universal property of $\text{lcm}$", e.g., see here), i.e. $a\equiv b\pmod{\text{lcm}(n,m)}$ (here $a=x$, $b=-1097y$, $n=3^5$, $m=2^5$). – user236182 May 18 '16 at 17:51
  • Thank you all, very much, for bothering to take the time to answer my question. The answer (x,y)≡(−1097k,k)(mod7776) for any k, certainly generates the first few hundred of the solutions that interest me. I’m new to this site, and unsure of the etiquette; it’ll take me some time to study the method and try a new example, so, if I have problems, do I raise them here or raise a new question? Do I tick any boxes to thank contributors? – Old Peter May 18 '16 at 19:15
  • @OldPeter If you're fully satisfied with an answer and don't need any new answers, then tick the answer (new answers are still allowed to appear, but people might be less interesting in writing one). After you have enough reputation, you can also upvote or downvote any answers/questions (15 for upvoting, 125 for downvoting). If you have any problems with trying this method, then write a comment here on my answer and I'll try to answer it here in the comments. – user236182 May 18 '16 at 19:42
  • @user236182 I’ve taken your solution and interpreted it as x = -1097k +7776g y = k + 7776h for integers g, h, k. Although this certainly gives me all the results I expect, I wonder if I could have made a better choice of equations? Could I have managed with just two parameters? EG, (x, y) given by (k, g, h) is the same as that given by (k+7776, g+1097, h-1). I suspect that keeping abs(k) under 7776 would get around this, but am not certain if this would miss results. Is it OK to ask here, or do I need a new question? Sorry if I’ve not seen the obvious, or made a silly mistake. – Old Peter May 20 '16 at 19:11
  • @user236182 Yes, I did miss the obvious! x = -1097k + 7776g; y = k for integers g, k. – Old Peter May 21 '16 at 08:38
  • @OldPeter You're right. Ask here in the comments if there's another question. – user236182 May 21 '16 at 09:52