13

Let us find the remainders of $\dfrac{6^n}{7}$,

Remainder of $6^0/7 = 1$
Remainder of $6/7 = 6$
Remainder of $36/7 = 1$
Remainder of $216/7 = 6$
Remainder of $1296/7 = 1$

This pattern of $1,6,1,6...$ keeps on repeating. Why is it so? I'm asking in general, that is for every case of type $a^n/b$'s remainder keeps on repeating as we increase $n$.

P.S: This is a follow up question of my previous question.

user103816
  • 3,831
  • 6
    Start at Fermat's little theorem, then Euler's theorem. – Thomas Jul 28 '15 at 20:34
  • 1
    The remainder (or more precisely modular arithmetic) commute with powers. So, what you're looking at is the image of the remainder in the multiplicative group mod $n$. A group generated by an element is a cyclic group and this is why the sequence of remainders is cyclic. – Michael Burr Jul 28 '15 at 20:36
  • 3
    A related phenomenon is the eventually repeating decimal expansion of any rational number. – hardmath Jul 28 '15 at 20:38
  • @hardmath How is it related? It seems quite a different process to me. – A.P. Jul 28 '15 at 20:41
  • 1
    it is related in that you will eventually run out of digits and then you'll end up repeating the cycle. However it isn't directly related to exponentiation in modular arithmetic. – Tae Hyung Kim Jul 28 '15 at 20:42
  • @Thomas Sorry but I don't know Fermat's little theorem. I' quite new to the modular arithmetic game. – user103816 Jul 28 '15 at 20:43
  • @Thomas Isn't Euler's theorem a bit overkill here? All that is necessary is a proof that if $G$ is a group and $g \in G$, then ${g^n : n \in \Bbb{Z}}$ is a cyclic subgroup of $G$. – A.P. Jul 28 '15 at 20:43
  • 2
    IMO using groups to explain this to someone who doesn't fully understand modular arithmetic is pretty overkill. – Tae Hyung Kim Jul 28 '15 at 20:46
  • 4
    Note that $6$ is one less than $7$. So I'll call $6$ by the name $[-1]$ instead, to emphasize this. And I'll call your remainder $[1]$ instead of $1$. So, curiously, multiplying by $[-1]$ repeatedly bounces back and forth between $[1]$ and $[-1]$. Weird! – pjs36 Jul 28 '15 at 20:47
  • @A.P.: As soon as the remainders of $10^n/7$ begin to repeat, the decimal expansion of $1/7$ will repeat. Something similar is true for any denominator. – hardmath Jul 28 '15 at 20:50
  • @thkim1011 One can use the abstract picture as a guideline to write a more elementary answer, like Noah Schweber did in his fine post. – A.P. Jul 28 '15 at 20:57
  • hmm i guess so. I was referring to invoking group theory directly. – Tae Hyung Kim Jul 28 '15 at 20:58
  • FYI the word you want is remainder. "Reminder" is something that helps you remember something. I know it's a small detail but it looks like it's a repeated mistake here so I thought I'd point it out (and I don't have enough rep to just make a 1-character edit to the post). – Cornstalks Jul 29 '15 at 14:06
  • @Cornstalks Sorry for that. I am too bad at remembering spellings. – user103816 Jul 29 '15 at 14:11

7 Answers7

16

First, let me address a simpler question: why is there a pattern to the remainders at all?

Suppose I have any positive integer $b$ (in your case $b=7$). Then remainders respect multiplication: if $x, x'$ are positive integers which yield the same remainder when divded by $b$, and $y, y'$ are positive integers which yield the same remainder when divded by $b$, then $xy$ and $x'y'$ yield the same remainder when divided by $b$.

This is modular arithmetic: for a positive integer $b$, we can develop arithmetic on the set $R_b=\{0, 1, 2, . . . , b-1\}$ by interpreting elements of $R_b$ as remainders. For instance, any time I multiply two even numbers I get an even number; this is represented as $$0\times 0=0 \quad \mbox{(in $R_2$)}.$$ Because remainders respect multiplication, this makes sense and works the way we want it to.

So what does this have to do with powers? Well, fix $b$, and consider the sequence $a, a^2, a^3, . . .$. Since $R_b$ is finite there are some $m<n$ such that $a^m$ and $a^n$ leave the same remainder when divided by $b$. Once this happens, the remainders will repeat: the remainder of $a^{n+1}$ when divided by $b$ will be the same as the remainder of $a^{m+1}$ when divided by $b$, etc. So the sequence of remainders of powers of some number will always be eventually repeating.

Note that "eventually" is crucial here: consider $a=3$, $b=27$. Then the sequence of remainders is $3, 9, 0, 0, 0, 0, . . .$. Similarly, if we take $a=2$ and $b=12$ we get $2, 4, 8, 4, 8, 4, 8, . . .$ This happens because $a$ and $b$ share prime factors. Euler's theorem says that if, by contrast, $a$ and $b$ are coprime (have no factors besides $1$ in common), then this pattern is just repeating, full stop, and in fact tells us how long it will take to repeat.

Noah Schweber
  • 245,398
  • What do you mean by respect in the phrase remainders respect multiplication? And why do remainders respect multiplication? – user103816 Jul 29 '15 at 14:44
  • 1
    I mean exactly what follows: if $x, x'$ are positive integers which yield the same remainder when divded by $b$, and $y, y'$ are positive integers which yield the same remainder when divded by $b$, then $xy$ and $x'y'$ yield the same remainder when divided by $b$. As to why this is the case: suppose $x, x'$ yield remainder $r$, and $y, y'$ yield remainder $s$, when divided by $b$. Then we have $x=ib+r$, $x'=jb+r$, $y=kb+s, y'=lb+s$ for some integers $i, j, k, l$. Multiply out: we get $xy=(ikb+is+rk)b+rs$ and $x'y'=(jlb+js+lr)b+rs$. Do you see how to go from here? – Noah Schweber Jul 29 '15 at 19:04
  • Ok, since $x=a^m$ and $x'=a^n$ have same remainders and $y=a$ and $y'=a$ have same remainders, $xy=a^na$ and $x'y'=a^ma$ will also have same remainders. This process will continue for $a^na^2$ and $a^ma^2$ and so on. – user103816 Jul 30 '15 at 09:01
  • From what I see is that all these answers boil down to Euclid division. Yves's answer relies on $a^na \pmod b = r_na \pmod b$ and if for some $m$, $a^m \pmod b = a^n \pmod b = r_n$ then $a^ma \pmod b = a^na \pmod b$ and this will cause repetition for $a^ma^2$,$a^ma^3$ and so on. But your method seems to be more general. – user103816 Jul 30 '15 at 09:14
4

The answer is $$ 6 = -1 \pmod 7. $$ Therefore, you have $(-1)^{n}$ and it depends only on $n$ and it $-1$ or $1$.

More detailed theory you can find following this link: Modular arithmetic

P.S. $ number \pmod 7 = remainder$

  • 1
    I have read wikipedea. They don't prove or at least explain nothing. – user103816 Jul 28 '15 at 20:48
  • 5
    @user103816 Actually that article explains quite a few things, although it is true that it is quite hard to understand without a few basics. Still, keep in mind that the often best part of the mathematics articles on Wikipedia are actually the references. ;) – A.P. Jul 28 '15 at 20:53
  • 6
    @user103816 Wikipedia is an encyclopedia, not a text book. Their main goal is to record knowledge, not teach it. This is not a bad thing for the professor seeking information. It is often a bad thing for a student seeking help. – Steven Alexis Gregory Jul 29 '15 at 01:52
  • How is $6^n( \mod 7)= (-1)^n( \mod 7)$? Are you using binomial theorem for $6^n=(7-1)^n$, but this will give negative coefficients for $1^n$. We will have something like $(7-1)^n=7(T)-1^n$. What is the reminder of (-1)/7 and how can we prove that rem(a-b)/m = rem(a/m)+rem(-b/m)? – user103816 Jul 29 '15 at 07:37
  • @Steven I strongly recommend you read http://wikipediocracy.com/2013/10/20/elementary-mathematics-on-wikipedia-2/ –  Jul 29 '15 at 15:47
  • @AlonsodelArte OK I read it. You notice that the author states " I don’t really read the mathematics articles carefully, but rather just skim through them until I find the bit I need" and then he points out that the articles on basic subjects suck at the details. I more or less implied that. I agree with the second comment at the end of the article. "It is true that ... the Wikipedia article is of low quality. But there is no malign force at work keeping it from improving – just not enough expert editors. So why don’t you improve it instead of complaining...?" – Steven Alexis Gregory Jul 29 '15 at 17:52
  • @StevenGregory If I was a math expert (which I'm not), my expertise would probably be wasted. Case in point, Arthur Rubin: https://en.wikipedia.org/wiki/Special:Contributions/Arthur_Rubin –  Jul 29 '15 at 19:21
  • 1
    @StevenGregory & AlonzodelArte: Wikipedia is not a text book, but it's not an encyclopedia either! It's a drama board, maybe even an MMPORPG. Maybe you read the modular arithmetic article and decide it's not complete garbage, it just needs some little improvements. Next thing you know, you're sucked in, whining to ArbCom about banned users changing commas around. (I wish that example was fictional!) – Mr. Brooks Jul 29 '15 at 21:21
3

Note that as you find more and more powers, you'll eventually run out of remainders. So you'll come back to a previous number, and since exponentiation is repeated multiplication, you'll generate the cycle again. As an example, let's look at powers of $2$ modulo $7$. We have \begin{align*} 2^1 &\equiv 2 \pmod{7} \\ 2^2 &\equiv 2\cdot 2 \equiv 4 \pmod{7} \\ 2^3 &\equiv 4 \cdot 2 \equiv 1 \pmod{7} \\ 2^4 &\equiv 1 \cdot 2 \equiv 2 \pmod{7} \\ 2^5 &\equiv 2 \cdot 2 \equiv 4 \pmod{7} \\ 2^6 &\equiv 4 \cdot 2 \equiv 1 \pmod{7} \end{align*} Hopefully, this clarifies how multiplication works in modular arithmetic too.

  • Which formula did you use? Are you using 8 (mod 7) = 1? – user103816 Jul 28 '15 at 20:47
  • If $a \equiv x \pmod{m}$ and $b \equiv y \pmod{m}$, then $ab \equiv xy \pmod{m}$. That is, for example, since $2^5 \equiv 4 \pmod 7$ and $2 \equiv 2 \pmod 7 $, we have $2^6 \equiv 2^5 \cdot 2 \equiv 4 \cdot 2 \equiv 8 \equiv 1 \pmod 7$. – Tae Hyung Kim Jul 28 '15 at 20:49
  • Why are we running out of remainders? And I am still confused about how $ab \equiv xy \pmod{m}$. As you shown here $ab$ must be equal to $xy(\mod m)$ not equivalent to. And how in general we'd show that for every number $a$ and $b$ $a^n \over b$'s reminders will repeat? – user103816 Jul 28 '15 at 21:17
  • Note that the only possible remainders are 0,1,2,3,4,5,6. So you'll eventually have to repeat one of them. This is a variant of the pigeonhole principle. – Tae Hyung Kim Jul 28 '15 at 23:56
  • "since exponentiation is repeated multiplication": this is not enough as an explanation. –  Jul 29 '15 at 10:08
2

The reason is simple: a remainder can be expressed as a function of the previous remainder alone.

Indeed, let $r_n=6^n\bmod 7$, i.e. $6^n=7q_n+r_n$.

Then $\color{blue}{r_{n+1}}=6^{n+1}\bmod 7=(6\cdot6^n)\bmod 7=(42q_n+6r_n)\bmod 7=\color{blue}{(6r_n)\bmod 7}.$

As there is a finite number of possible remainders, the sequence must be periodic.

$$\begin{align}1&&\to1\\6&\to6\cdot1&\to6\\36&\to6\cdot6&\to1\\216&\to6\cdot1&\to6\\1296&\to6\cdot6&\to1\\\cdots\end{align}$$ or if you prefer $$\begin{align}1&\to1\\6\cdot1&\to6\\6\cdot6&\to1\\6\cdot1&\to6\\6\cdot6&\to1\\\cdots\end{align}$$

  • I understood upto $r_{n+1}=(6r_n) \mod 7.$ But then you say "there is a finite number of possible remainders". Why are there only finite number of remainders. – user103816 Jul 29 '15 at 11:12
  • $0,1,2,3,4,5,6$. –  Jul 29 '15 at 11:22
  • But why? ${}{}{}{}{}$ – user103816 Jul 29 '15 at 11:24
  • 1
    Check the definition of the remainder. –  Jul 29 '15 at 11:25
  • I've read it. a=bq+r where r is the remiander of a/b. And r<b. Ok Remiander must be less than 7. – user103816 Jul 29 '15 at 11:26
  • But why are only 1 and 6 showing up? why are 0,2,3,4,5 aren't showing? – user103816 Jul 29 '15 at 11:28
  • Why should they ? –  Jul 29 '15 at 11:38
  • Because reminder<denominator, here denominator = 7, so every number less than 7 is possible. – user103816 Jul 29 '15 at 11:47
  • 1
    Yes, every number is possible, but not required. A cycle can be shorter. Consider the extreme case of $7^n/7$. –  Jul 29 '15 at 12:08
  • I'm not getting it. Even 1 and 6 are not required this way because 0 can be the remainder too for $6^n/7$. There would be some reason which causes 1 and 6 to be the only remainders. – user103816 Jul 29 '15 at 12:15
  • No, $6^n/7$ cannot yield $0$, by the recurrence relation. The only possible remainders are $1$ and $6$. –  Jul 29 '15 at 12:20
  • I don't know what is recurrence relation. Could you tell in simple terms why are 1 and 6 only possible remainders. – user103816 Jul 29 '15 at 12:21
  • $r_{n+1}=(6r_n)\bmod7$ together with $r_0=1$. Please compute $r_n$ for $n=0,1,2,3, 4,5, 6\cdots$, and stop as soon as you reach $r_n=0$. –  Jul 29 '15 at 12:22
  • This gives $r_1=6 \mod7 = 6$, $r_2=36 \mod 7=1$, $r_3=6 \mod7=6$. Yes it will repeat the same pattern because $r_2=r_0$. Perhaps I'm getting it. Does this method work for all cases ,e.g. $a^n/b$'s remainder. – user103816 Jul 29 '15 at 12:29
  • Exactly, and there is no way that the sequence could deviate from $1,6,1,6,1,6\cdots$ as a remainder only depends on its predecessor. The answer for $a^n/b$ should now be obvious. Why don't you try $5^n/7$ ? I am taking care of $7^n/7$: $1,0, 0, 0, 0, 0, 0\cdots$. –  Jul 29 '15 at 12:36
  • Yes $5^n/7$'s remainder are $(5,4,6,2,3,1),(5,4,6,2,3,1)...$. The remainder must be less than $b$ for $a^n/b$. At the very time hit upon an old remainder the sequence will start repeating immediately. Thanks a lot. I now understand it completely. Could you help me a little with how the modular function follows distributivity over negative numbers here – user103816 Jul 29 '15 at 13:18
  • Ask the author. –  Jul 29 '15 at 13:43
  • No problem. Since he didn't reply I thought you could help. Perhaps I could work it out on my own. – user103816 Jul 29 '15 at 13:45
2

For me the most intuitive way to answer this question is to work modulo 7, so we are looking at powers of $-1$, which renders the alternating pattern familiar immediately. But perhaps you have never seen modulo arithmetic before. I tell a lie here: if you are used to the time 5 hours after 10 o'clock being 3 o'clock then you are already well familiar with modulo 12. But perhaps modulo 7 is less familiar to you. I tell a lie again: what is the day seven days after Monday? What is the day twenty-eight days after Monday? What is the day twenty-nine days after Monday? So perhaps you already know modulo 7 too, albeit you didn't realise it.

But I shall suggest a different way of looking at the problem, which is to write the number in a different base system. You are used to the number 437 base 10 being made of four hundreds i.e. $4 \times 10^2$, three tens i.e. $3 \times 10^1$ and seven units i.e. $7 \times 10^0$. To write numbers in base 10 we occupy those place-value columns for $10^0, \, 10^1, \, 10^2, \, \dots$ with digits between 0 and 9. If instead we work in base 7 we fill place-value columns for $7^0, \, 7^1, \, 7^2, \, \dots$ with digits from 0 to 6. So the number $251_7$ (the subscript is to inform us of the base) is

$$\color{red}{2}\color{blue}{5}\color{orange}{1}_7 = \color{red}{2} \times 7^2 + \color{blue}{5} \times 7^1 + \color{orange}{1} \times 7^0 = \color{red}{2} \times 49 + \color{blue}{5} \times 7 + \color{orange}{1} \times 1 = 134$$ when we work in base 10. To get a bit of familiarity with how the system works, let's do some counting in base 7: $0_7$, $1_7$, $2_7$, $3_7$, $4_7$, $5_7$, $6_7$, $10_7$, $11_7$, $12_7$, $13_7$, $14_7$, $15_7$, $16_7$, $20_7$, $21_7$, $22_7$, $23_7$, $24_7$, $25_7$, $26_7$, $30_7$ ... which gets us as far as the number we'd write as $3 \times 7 = 21$ when we are working in base 10.

Now here is the six times table, with answers in base 7, as far as $7 \times 6$. In fact we really only need to go as far as $6 \times 6$ to be able to do long multiplication base 7, for the same reason we only need to go up to $9 \times 9$ to do long multiplication in base 10: the highest digit we will encounter in base 7 is a "6", like the highest digit in base 10 is a "9".

$$ \\0 \times 6 = 00 = 0 \times 7 + 0 = 00_7 \\1 \times 6 = 06 = 0 \times 7 + 6 = 06_7 \\2 \times 6 = 12 = 1 \times 7 + 5 = 15_7 \\3 \times 6 = 18 = 2 \times 7 + 4 = 24_7 \\4 \times 6 = 24 = 3 \times 7 + 3 = 33_7 \\5 \times 6 = 30 = 4 \times 7 + 2 = 42_7 \\6 \times 6 = 36 = 5 \times 7 + 1 = 51_7 \\7 \times 6 = 42 = 6 \times 7 + 0 = 60_7 $$

Note how multiplying by 7 just appends a zero in base 7, the same as multiplying by 10 just appends a zero in base 10. The similarity is even more extreme when I point out that 7, when written in base 7, is simply $10_7$! And you may spot the pattern of digits increasing in one column and decreasing in the next resembles how the nine times table works when written in base 10: this pattern in the multiplication tables occurs because both numbers are one less than the base we are writing in. (We don't actually need the leading zeroes in 00 and 06 but I have put them there to help the alignment, and remind us that when we are doing long multiplication we need not carry anything to the next place-value column.)

We should now be able to perform long-multiplication by six while working in base 7! For instance let us try $251_7 \times 6_7$, which is equivalent to $134 \times 6$ when we work in base 10. The digit $1$, times $6$, makes $6$ with nothing to carry. The digit $5$, times $6$, makes $42_7$ so we need to write a $2$ and carry $4$. The digit $2$, times $6$, makes $15_7$ but we must add the four that we carried to get $22_7$. The final answer will be therefore be $2226_7$. We can check this in base 10: our answer is $2 \times 7^3 + 2 \times 7^2 + 2 \times 7^1 + 6 \times 7^0 = 804$, which is indeed $134 \times 6$.

A useful observation is that the final digit, base 7, is simply the remainder when our number is divided by 7. This works for the same reason that the final digit, base 10, is simply the remainder when our number is divided by 10. This is why I wanted to work base 7 in the first place: it makes it far easier to spot the remainders than when we worked base 10.

Since we can multiply by six in base 7, and we know how to spot the remainder when our number is divided by 7, we can now look at the remainders of the powers of six.

For starters there is ${6_7}^1 = 6_7$ which has remainder $6$.

Next comes ${6_7}^2= 6_7 \times 6_7 = 51_7$ which has remainder $1$.

Then we have ${6_7}^3= 6_7 \times 51_7 = 426_7$ which has remainder $6$ again.

One more for luck: ${6_7}^4= 6_7 \times 426_7 = 3531_7$ which reverts to remainder $1$.

Now if you were doing those long multiplications by hand, you'd have spotted that the final digit on each power of six only depended on the final digit of the previous power of six. This is why the remainders are in a cycle: if the final digit base 7 of $6^n$ is $6$ then the final digit of $6^{n+1}$ base 7 is $1$, and vice versa. Since the next final digit only depended on the previous final digit, and it was only the final digits I cared about (since they told me the remainder), I might as well only have bothered writing the final digits down: by doing so I would essentially be working modulo 7, like the other answers. But I thought I would show you how the question looks much more "obvious" if we switch the base of the number system we use to write the question in.

Here are some questions you should now be able to answer for yourself by considering multiplication base 10 (i.e. what you've already been used to). Can you see why the final digit of $21^n$ is always one, or the final digit of $65^n$ is always five, for positive integers $n$? Can you therefore see that the remainder of $21^n$, when divided by ten, is always one? Or that the remainder of $65^n$, when divided by ten, is always five? Or if you want to see a short cycle, can you see what happens to the remainder of $4^n$ when it is divided by ten?

Silverfish
  • 1,620
  • 21
  • 33
  • I stuck at 06=00=07 + 5.. – user103816 Jul 29 '15 at 12:20
  • @user103816 You have spotted a typo! I introduced it when I copy-and-pasted... it should be fixed now. – Silverfish Jul 29 '15 at 12:24
  • How can we prove in general that in a number system with base $N$, the last digit of the number $(Tb\times ab)$ is same as that of $(b^2)$, $T$ and $a$ can be more than one digit. I tried $Tb \times ab = (TN+ b)(aN+b) = ....$ But lost. – user103816 Jul 29 '15 at 12:47
  • @user103816 Good idea! Remember that any term with an $N$ or $N^2$ in it will have zero in the final place-value column when you write it in base $N$. (For instance, that $10_7$ is actually $7$, and that $100_7$ is actually $7^2 = 49$, perhaps a point I should have made more clear in my answer.) – Silverfish Jul 29 '15 at 12:51
  • Yeah got it. $Tb \times ab = N^2aT+N(Tb+ab)+b^2$. Since $T$'s will have 0 at last the final digit of $b^2$ will match with the final digit of $Tb \times ab$. Now how can we make the base switching argument more rigorous? We are kind of using binomial expansion method. $6^n=6 \times 6^{n-1}$ by breaking $6^{n-1}$ into $7q_n+r_n$. The underlying concept seems quite similar to Yves's answer. But how can we generelize it for, for example $a^n/b$ where $a>b$. – user103816 Jul 29 '15 at 13:01
  • @user103816 Yes, with a bit of work you can see that it really boils down to modulo arithmetic anyway. You can apply an argument by induction to prove that it cycles between the 1 and 6 if you would like something more formal. – Silverfish Jul 29 '15 at 13:18
  • I meant for example if I take $a>b$, say $a=8$ and $b=7$ then for finding the reminder of $8^n/7$ we would have to write $8$ in 7-base system. Would that work as did you do in your answer? – user103816 Jul 29 '15 at 13:30
  • Yes it works, 8=$(11)_7$. The last digit of $(11)_7)^n$ will remain $1$ so the remiander will also remain 1. The method works for all $a$ and $b$. – user103816 Jul 29 '15 at 13:34
1

Looking at remainders after division by 7 is called arithmetic modulo 7.

You are regarding powers of 6, modulo 7. But $6$ is $-1$, modulo $7$. This is written: $$6 \equiv -1 \pmod 7$$

But the powers of $-1$, that is the numbers $(-1)^n$, simply alternate: $1,-1,1,-1,1,\ldots$.

Jeppe Stig Nielsen
  • 5,109
  • 21
  • 29
  • why is 6 mod 7 = (-1)mod 7. I know that 6=(7-1), but why does modulo operation follow distributivity for negative numbers? – user103816 Jul 29 '15 at 11:31
1

Using your example, there are only $6$ possible remainders. I am excluding $0$ because $6^n$ will never be a multiple of $7$.

So you start with $6^0 = 1$.

Then $6^1 \equiv (6^0)\times 6 \equiv 1\times 6 \equiv 6 \pmod 7$

Then $6^2 \equiv (6^1)\times 6 \equiv 6\times 6 \equiv 1 \pmod 7$

And we are back to $1$ and we are now forced into a repeating pattern. Since there are only $6$ possible remainders, we are going to have to repeat a remainder by at most the $6$'th computation. From that point on, we must have a repeating pattern.