2

Question 1:
Denote $a \mod b$ as $a \% b$, where $a$ and $b$ are some integers

Evaluate 12^32475 % 21 

The following is what I tried:

12^32475 % 21 = (12^3 % 21)^10825 % 21 = 6^10825 % 21 = ... = 6^433 % 21

But how to continue ?

Question 2:
Question 6: For all n>2, prove that n-1 is it's own inverse under mod n. Solution: n-1 and n are relative prime, since n=1 times n-1 plus 1. Therefore n-1 must have an inverse. n-1=-1 mod n and n-1 times n-1= -1 times -1 =1 mod n . Thus, the inverse of n-1 is n-1 .
I don't understand this: n-1= -1 mod n. Where is this from? And does this line become the next line?

Context: my class is discrete math for computer science. So far for related topics, it covers modular inverse, (extended) GCD algorithm, Fermat's Little Theorem and Chinese Remainder Theorem (CRT).

Bernard
  • 175,478
keanehui
  • 145
  • For question 1, can you find $12^{32475} \pmod 3$ and $12^{32475} \pmod 7$? You might want to use the fact that $5^3 \equiv 6 \equiv -1 \pmod 7$. Then you can use the Chinese remainder theorem. – Toby Mak Nov 25 '19 at 11:27
  • 2
    The notation $a \equiv b \mod c$ means $a-b$ is a multiple of $c$. Now do you understand why $n-1 \equiv -1 \mod (n)$? (What is $(n-1) - (-1)$?) You should already be knowing that if $a \equiv b \mod c$ and $d \equiv e \mod c$ then $ab \equiv de \mod c$ (multiplication of congruences), this step comes in the second line. – Sarvesh Ravichandran Iyer Nov 25 '19 at 11:27
  • Also, what class is this from, and what topics have you already covered in your class? It seems like you do not know much about modular arithmetic, but if you don't tell us, it's hard to tell if you would like an easier or a harder answer. (How to ask a good question) – Toby Mak Nov 25 '19 at 11:29
  • 2
    Kindly explain the $...$ as well, I find it odd you could do the $...$ part and have no trouble, but have trouble in elementary multiplication of congruences. We can sort that out too if there's an issue there. – Sarvesh Ravichandran Iyer Nov 25 '19 at 11:34
  • @TobyMak Should I use repeated squaring to find 12^32475 (mod 3) and 12^32475 (mod 7) ? And how can this be helpful – keanehui Nov 25 '19 at 13:03
  • @TobyMak The class is discrete math for computer science. So far for related topics, it covers modules inverse, GCD algorithm, extended GCD algorithm, Fermat's Little Theorem and Chinese Remainder Theorem (CRT). But I still don't know how CRT is helpful – keanehui Nov 25 '19 at 13:08
  • @астонвіллаолофмэллбэрг for the ... part, I just keep factorising the exponent and use power rule of modules until I got 433 which is a prime number, so I stuck here – keanehui Nov 25 '19 at 13:10
  • @keanehui Ah, then I am sure you'd have done that part right. Did you understand the second question from my comment on product of congruences? – Sarvesh Ravichandran Iyer Nov 25 '19 at 13:44
  • @астонвіллаолофмэллбэрг Yes that was helpful thanks a lot. And BTW, for Question 1, from CRT, that x=a (mod (mn)), does it imply x=a (mod m) and x=a(mod n), where m and n are prime numbers? And what if product of mn is already a prime number? – keanehui Nov 25 '19 at 14:03
  • @keanehui The implication you wrote is true for all m and n. If something is a multiple of mn , it of course is a multiple of both m and n – Sarvesh Ravichandran Iyer Nov 25 '19 at 14:44
  • @Toby Here it is easier to factor out $3$ from the mod than to use CRT - see my answer. – Bill Dubuque Nov 25 '19 at 18:38

4 Answers4

1

We use the fact that $6^{433} \equiv 0 \mod 3$ and $6^{433} \equiv (-1)^{433} \equiv -1\mod 7 $.

Taking $6^{433} = 3k$ ,

$$3k \equiv -1\mod 7 \implies k \equiv 2\mod 7$$

Hence $6^{433} = 3(\,7\lambda + 2\,) = 21 \lambda + 6$.

So $$6 ^{433} \equiv 6 \mod 21$$

1

Question 1. Use the Chinese remainder theorem:

you have to compute $12^{32475}\bmod 3\equiv 0^{32475}\bmod 3\equiv 0$ and, using lil' Fermat, $$12^{32475}\bmod 7\equiv 12^{32475\bmod 6}\equiv 12^3\equiv 4\cdot 12\equiv48\equiv -1\mod 7$$ Now a Bézout's relation between $7$ and $3$ is $\;7-2\cdot 3$, so the solution is $$0\cdot 7-(-1)\cdot 2\cdot 3=6\mod 21.$$

Added. On the use of the Chinese remainder theorem: When the moduli $a$ and $b$ are coprime, let $ua+vb=1$ be a Bézout's relation between $a$ and $b$. Then, a system of congruences $$\begin{cases} x\equiv \color{blue}\alpha\mod \color{blue}a,\\x\equiv \color{red}\beta\mod \color{red}b, \end{cases}$$ has a unique solution modulo $\operatorname{lcm}(a,b)=ab$: $$x\equiv \color{red}\beta\,\color{blue}{ua}+\color{blue}\alpha\, \color{red}{vb}\mod ab. $$

Question 2: it is simply that in $n-1$, $n$ is $0$ (mod $n$).

Bernard
  • 175,478
  • Could you explain more about the Chinese Remainder Theorem? The only thing I know about it is, given x = a (mod m) and x = b (mod n), it can be used to solve for x. How can we utilise this theorem? – keanehui Nov 25 '19 at 13:19
  • definition of mod is $$y\equiv b\bmod m \implies y=mx+b$$ so write out the two as equal and solve. In this case: $$3x+0=7z-1\to 3x+1=7z$$$$\to 3x+1=2\cdot 3\cdot z +z\to 3(x-2z)+1 =z$$ which letting $a=x-2z$ implies $z$ is of form $3a+1$ substitution into the original gives then gives $21a+6$ so they combine to give the equivalent of 6 mod 21 by our previous definition. –  Nov 25 '19 at 14:03
  • @keanehui For problems like these it is easier to avoid CRT and simply pull a factor out of the mod, e.g. see my answer. – Bill Dubuque Nov 25 '19 at 17:52
  • @keanehui: I've added an explanation on the formula I used. – Bernard Nov 25 '19 at 19:17
  • @Bernard So you split up 12^{32475} = x (mod 21) into 12^{32475} = x (mod 3) and 12^{32475} = x (mod 7), and how do you know that the first piece is 0. Also, can you tell me more about how is it helpful to split it up into 2 pieces? What does it tell us if the first piece equals 0. – keanehui Nov 26 '19 at 06:24
  • The first piece is $0$ for the very simple reason that $12$ is $0$ mod $3$. It doesn't necessarily simplify much, but here a the factors of the modulus are small, it's easier to compute by hand since, to apply Fermat, the exponents are reduced to a smaller value ($\varphi(21)=12$, whereas $\varphi(7)=6$). If a piece is $0$, the general formula in the edit reduces to a single term. – Bernard Nov 26 '19 at 09:27
1

It is easier to apply $ $ mod Distributive Law $\,\rm= mDL\,$ vs. $\,\rm CRT\,$ in cases like this, i.e.

$\begin{align}\text{by applying}\ \ \color{#c00}ab\bmod \color{#c00}ac\ \,&\smash[b]{\underset{\textstyle\uparrow}=}\,\ \color{#c00}a(b\bmod c)\, = \text{mDL,}\ \text{ to factor out}\,\ \color{#c00}{a = 3}\\ \ \ \ \ \,(\color{#c00}3\cdot 4)^{\large\color{#0a0}{3+6k}}\bmod \color{#c00}{3}\cdot 7\ \, &\smash[t]{\overset{\textstyle\downarrow}=}\ \, \color{#c00}3(4\cdot\!\! \underbrace{12^{\large 2+6k}\!\bmod 7}_{\large (-2)^{\Large 2} (-2)^{\Large 6k}\,\equiv\ \ \color{#b8f}{4(1)}\!\!\!\!\!\!\!}\!) = 3(4\cdot \color{#b8f}4\bmod 7) = {3(2)}\end{align}$


Note $\,N = 32475 = 3j\ $ by $\bmod 3\!:\ N\equiv 3\!+\!(2\!+\!4)\!+\!(7\!+\!5)\equiv 0\,$ by casting out threes.

Thus $\,N = \color{#0a0}{3\!+\!6k},\,$ by $\,N\bmod 6 = 3j\bmod 6 = 3\underbrace{(j\bmod 2)}_{1\ {\rm by\ } N\rm\ odd\ }= 3(1),\, $ again by $\,\rm mDL$.


For $(2)$ by definition $\bmod n\!:\,\ n\!-\!1\equiv -1\iff n\mid (n\!-\!1)-(-1) = n;\ $ it's true $\,n\mid n$

More conceptually: $\ \bmod n\!:\ \color{#c00}{n\equiv 0}\,\Rightarrow\, \color{#c00}n-1\equiv \color{#c00}0-1\equiv -1\, $ by the Congruence Sum Rule

Therefore we conclude that $ \,(n-1)(n-1)\equiv (-1)(-1)\equiv 1\ $ by the Congruence Product Rule

Or $\ \, \color{#c00}{n- 1\equiv -1}\,\Rightarrow\, (\color{#c00}{n-1})^2\equiv (\color{#c00}{-1})^2\equiv 1\ $ by the Congruence Power Rule

Bill Dubuque
  • 272,048
  • There are simpler ways to show $,32475\equiv \color{#0a0}{3\pmod{!6}},,$ but I used mDL to give some more practice with it (and generally it will be much more efficient for larger numbers). – Bill Dubuque Nov 26 '19 at 03:15
1

I see by your comments that you haven't learned the Chinese Remainder Th and you probably haven't learned Euler's Theorem either. (Crash course and end of post)

Without them it's harder but

$12^{32475}\pmod {21} \equiv N$ means there is an integer $k$ so that

$12^{32475} = N + k21$. So

$\frac {12^{32475}}3 = \frac N3 + k\frac {21}3$

$4*12^{32474} = \frac N3 + 7k$ and $3|N$ so let $N = 3N'$

$4*12^{32474} = N' + 7k$ Now as $12 \equiv 5 \pmod 7$ we can conclude

$N' \equiv 4*5^{32474} \pmod 7$.

Now $5^2 = 25 \equiv 4 \pmod 7$ so

$N' \equiv 4*4^{16237} \equiv 4^{16238} \pmod 7$.

And $4^2 \equiv 16 \equiv 2 \pmod 7$ so

$4^{16238}\equiv 2^{8119} \pmod 7$

And $2^3 \equiv 8 \equiv 1 \pmod 7$ so

$N' \equiv 8^{2703}*2 \equiv 1^{2703}*2 \equiv 2 \pmod 7$.

So $N = 3N' =6$ so $N \equiv 6\pmod{21}$.

=====

Chinese remainder Theorem.

If you have $x = a \pmod m$ and $x \equiv b \pmod n$ and $\gcd(m,n)=1$. Then there is unique solution what $x\pmod{mn}$.

For example if $x \equiv 2 \pmod 6$ and $x \equiv 5 \pmod 7$ then there is only one possible value for $x\pmod{42}$ where $x = 2 + 6k = 4 + 7j$ and that is $x \equiv 32 \pmod{42}$.

So if $12^{32475} \equiv 0 \pmod 3$. And $12^{32475} \equiv N \pmod 7$ whe can figure out if $x \equiv 0 \pmod 3$ and $x \equiv N \pmod 7$ then we will be able to solve $x \pmod{21}$.

Now Fermat's Little Theorem. If $p$ is a prime and $\gcd(a,p) = 1$ then $a^{p-1} \equiv 1 \pmod p$.

So $12^6\equiv 1 \pmod 7$.

So $12^{32475} = 12^{6*5412 + 3}\equiv (12^6)^{5412}*12^3\pmod 7$

$\equiv 12^3 \equiv 5^3 \equiv 25*5\pmod 7$

$\equiv 4*5 \equiv 20\equiv 6\pmod 7$.

So we have $12^{32475}\equiv 0 \pmod 3$ and $12^{32475}\equiv 6\pmod 7$.

So $x \equiv 0 \pmod 3$ and $x \equiv 6 \pmod 7$ so $x = 0+3k = 6 + 7j$ and the only solution (between $0$ and $41$) is $12^{32475}\equiv 6\pmod {21}$

======

I don't understand this: n-1= -1 mod n. Where is this from? And does this line become the next line?

Bear in mind that if $a \equiv b \pmod n$ then for any multiple of $k$ we know $a + nk\equiv a \equiv b \pmod n$.

$-1 \equiv -1 \pmod n$

So $-1 + n \equiv -1 \pmod n$

And $n-1 \equiv -1 \pmod n$.

It is certainly the case that $n|(n-1) -(-1) = n$ and that is the definition of $n-1\equiv -1\pmod n$.

The alternative definition is that there exist an integer $k$ so that $n-1 = -1 + kn$ and that is certainly true.

So $n-1 \equiv -1 \pmod n$ so $(n-1)*(n-1)\equiv (-1)*(-1) \pmod n \equiv 1\pmod n$.

Bernard
  • 175,478
fleablood
  • 124,253