1

Solving $9x \equiv 21 \bmod 30$

My approach:
Finding $gcd(9,30)$: \begin{align} 30 &= 9 \cdot 3 + 3 \\ 9 &= 3 \cdot 3 + 0 \end{align}

So $gcd(9,30)=3$ and since $3 \mid 21$ so the congruence has $3$ incongruent solutions. Express $3$ as a linear combination of $9$ and $30$, we get: $$3 = 30-9 \cdot 3 \ \ \ \ \ \ (1)$$

We have to solve this equation to find $x_0$: $$9x-30y=21 \ \ \ \ \ \ (2)$$

Multiplying $(1)$ by $7$ we get: $$21=30 \cdot7-9 \cdot 21$$

Rewritten in form of $(2)$: $$-9 \cdot (21) + 30 \cdot (7) = 21 $$

So $x_0=21$, the incongruent solutions are: $$21 + 10n, \ \ \ \ \ n = 0,1,2$$

Then $x=21,31,41$. But my answer is wrong, the answer is: $x=9,19,29$. Can you tell me which step is wrong. Thanks for your help!

Bill Dubuque
  • 272,048
  • When you rewrite $21=30\cdot7-9\cdot21$ in the form $9x-30y=21$, it's $9\cdot(-21)-30\cdot(-7)=21$, not $-9\cdot(21)+30\cdot(7)=21$, so $x_0=-21$, not $21$. – Barry Cipra Dec 26 '20 at 17:38
  • See here for how to debug proofs. Applied here: your claims are all true except for the final one - that $,x_0 = 21, $ is a solution, so the error lies in that inference (via a sign error while pattern matching the equations). The prior equation says $\bmod 30!:,\ 21\equiv -9(21) \equiv 9(\color{#c00}{-21}),$ so $,\color{#c00}{x\equiv -21}\equiv 9,$ is a root of the initial congruence that you are attempting to solve here, namely $,9,\color{#c00}x\equiv 21\pmod{!30}\ \ $ – Bill Dubuque Dec 26 '20 at 17:56
  • Thanks for your help! I was wrong about $x_0$, I thought $-9(21)$ is the same as $9(-21)$. –  Dec 26 '20 at 17:59
  • You have $-921$ That is NEGATIVE* $9$. So you have solved $-921 \equiv 21 \pmod{30}$ and $21$ is a solution to $-9x\equiv 21\pmod{30}$. But you want as solution for POSITIVE* $9$. So $-921\equiv 21\mod{30}$ so $9(-21)\equiv 21 \pmod {30}$ so $x_0 = NEGATIVE\ 21$ is the solution you want. And $-21\equiv 9 \pmod{30}$, so $x_0\equiv 9\pmod{30}$ is the solution you want. (Note: $9(-21) + 307 = 21$ and so $9(-21+30) + 30(7 -9) = 99 - 30*2 = 21$.) – fleablood Dec 26 '20 at 18:12
  • $-921$ is* the same as $9(-21)$ but that means the solution to $POSITIVE\ 9x$ is $-21$. Not positive* $21$. Positive $21$ is the solution to $NEGATIVE\ 9x$. – fleablood Dec 26 '20 at 18:18
  • So you have $-9\cdot 21 = 9x$ solve for $x$. That is fine. That is correct. But Write that down on paper and solve thinking very carefully about keeping track of the signs. Using that $-921$ is* the same as $9*(-21)$ you have $9\cdot(-21) = 9 x$ so .... $x = -21$. – fleablood Dec 26 '20 at 18:22
  • This is not a duplicate because it isn't asking for how to do the calculation, it is asking what went wrong. – DanielV Dec 27 '20 at 01:09

3 Answers3

1

$9x\equiv 21\pmod{30}$ means $9x=30k+21$ or $3x=10k+7$ or $3x\equiv 7\pmod{10}$ or $21x\equiv 49\pmod{10}$ or $\color{red}{x\equiv 9\pmod{10}}$.

Jack D'Aurizio
  • 353,855
0

if $9x = 21 + 30 t,$ we see that $3x = 7 + 10 t,$ the reverse also holding. Solve $$ 3x \equiv 7 \pmod {10} $$ for which you need a reciprocal of $3.$ Since $21 \equiv 1 \pmod {10} $ we see that $$ \frac{1}{3} \equiv 7 \pmod {10} , $$

and.......

Will Jagy
  • 139,541
  • Thanks, you are very professional but I'm a newbie to all this, I will learn it. –  Dec 26 '20 at 17:55
  • He means that $7 \bmod 10 $ is the multiplicative inverse of $3 \bmod 10$ since $3 \cdot 7 = 21 \equiv 1 \bmod 10$. $$ 3x\equiv 7 \bmod 10$$ So if we multiply both sides by $7$, we may write on the LHS: $$7\cdot 3x \equiv x \bmod 10 $$ But then we have on the RHS: $$ 7*7 \equiv 49 \bmod 10 \equiv 9 \bmod 10.$$ This leads to the conlusion that $x\equiv 9\bmod 10$. –  Dec 26 '20 at 18:04
0

$$9x-30y=21$$ to $$21=30 \cdot7-9 \cdot 21$$

is the issue, you reverse the terms, so you should get $x \equiv -21 \equiv 9 \pmod {30}$

In other words, when you are solving the initial equation, you are solving it for a positive x less than 30, but you got a negative value.

DanielV
  • 23,556
  • Ok, so if I have negative value for $x$, I will just get the modulo minus $x$ to get $x_0$, thank you! –  Dec 26 '20 at 17:44