d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Homework Help > Why Does N Mod 10 = N^5 Mod 10?
Add Reply New Topic New Poll
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 22 2015 08:55pm
i noticed it back in freshmen year of college, then a teacher explained it to me in my senior year. we were covering the chinese remainder theorem / modular arithmetic, and i remember it has something to do with 5's relation to another number. but i can't remember the details.

for natural number n, why does n mod 10 = n^5 mod 10?

eg: let n = 2.
2 mod 10 = 2
32 mod 10 = 2

in freshmen year i knew it's true for n = 0 to 9, so it must be true for n > 9 since only the one's digit impacts the one's digit when multiplying. but there was a different explanation.

it's not a homework assignment. just for my own curiosity.
Member
Posts: 16,662
Joined: Nov 24 2007
Gold: 15,245.00
Trader: Trusted
Sep 23 2015 10:49am
I can't think of any simple explanation. The best is just to draw a full list of x^5, for any integer x from 0 to 9, and check the result as you said.

You can avoid all this calculations with some thinking, but, anyhow, a simple idea won't cover all the cases.

For example :

the problem is to show that x^5 = x modulo 10
ie : x^5 - x = 0 modulo (x^5 - x is a multiple of 10).
But x^5 - x = (x²+1).(x-1).x.(x+1)

For this to be a multiple of 10, we must find in this product a multiple of 2, and a multiple of 5.

For any x, it's easy to see that among (x-1) and x, or among x and (x+1), there must be a multiple of 2.

It's easy to see that among (x-1), x and (x+1), there must be a multiple of 5 when x = 0 ; 1 ; 4 ; 5 ; 6 ; 9.

Now the cases 2 ; 3 ; 7 ; 8 remain...
So let's examinate x²+1 for those cases :
2² + 1 = 5 is a multiple of 5. Hence it will also work for 7 (since 7 = 2+5 ).
3² + 1 = 10 is a multiple of 5. Hence it will also work for 8 ( 8 = 3+5 ).

The study of x² = a modulo N is not exactly a simple thing, but you can learn some about it if you're interested.
https://en.wikipedia.org/wiki/Quadratic_residue

Good luck !
Member
Posts: 14,433
Joined: Oct 14 2013
Gold: Locked
Trader: Scammer
Sep 23 2015 11:33am
Ugh modular arithmetic
Member
Posts: 54,265
Joined: Aug 22 2004
Gold: 6,069.00
Sep 23 2015 09:00pm
Quote (JDota72 @ Sep 23 2015 12:33pm)
Ugh modular arithmetic


Not has hard as you'd think. It boils down to remainders in 4th grade.

Not many people realize that it secures transactions over the internet.
Member
Posts: 118
Joined: Jun 30 2014
Gold: 0.00
Sep 24 2015 06:54pm
We can actually show this is true for all n using induction.
edit: ill prove for all natural numbers. (Though it can be proven for all integers)

We have n mod 10 = n^5 mod 10
Proving this is the same as proving that n^5 - n = 10m for some integer m
(show n^5 - n is a multiple of 10)

It obviously holds for k = 0
Assume true for k=n

Now we show it holds for k = n + 1
By expanding we get
(n+1)^5 - (n+1) = (n^5 + 5n^4 + 10n^3 + 10n^2 + 5n + 1) - (n+1)
Cancelling 1
= (n^5 + 5n^4 + 10n^3 + 10n^2 + 5n - n)
rearrange
= (n^5 - n) + 5(n^4 + n) + 10(n^3 + n^2)

We know n^5 - n is a multiple of 10 by our assumption; 10(n^3 + n^2) is also a multiple of 10. We just need 5(n^4 + n) to be a multiple of 10. It has a multiple of 5, so we need n^4 + n to be a multiple of 2

I claim n^4 + n is a multiple of 2.
n^4 is odd if n is odd
(2q + 1)^2 = 4q^2 + 4q + 1 = 2(q^2 + q) + 1 <-- odd

n^4 is even if n is even
(2p)^2 = 4p^2 = 2(2p^2) <-- even

So if n is odd, we get (odd)^4 + odd = odd + odd = even
if n is even, we get (even)^4 + even = even + even = even

And so the proof is complete

This post was edited by cdexswzaq on Sep 24 2015 07:01pm
Member
Posts: 996
Joined: Oct 18 2012
Gold: Locked
Trader: Scammer
Sep 24 2015 07:47pm
Let x = 10y + m for some natural numbers y and m with m < 10 (so x can be any natural number), then use the binomial theorem:

x^n mod 10 = m^n + (sum of natural numbers multiplied by 10^k for k=1,...,n) mod 10 = m^n mod 10

Now brute force the last digit of m^n for n=1,...,5 for all possible m (i.e. just find m^n mod 10, which I proved = x^n mod 10)

1: 1 1 1 1 1
2: 2 4 8 6 2
3: 3 9 7 1 3
4: 4 6 4 6 4
5: 5 5 5 5 5
6: 6 6 6 6 6
7: 7 9 3 1 7
8: 8 4 2 6 8
9: 9 1 9 1 9

For each natural number x, we have x^5 mod 10 = m^5 mod 10 = m mod 10 = 10y + m mod 10 = x mod 10.

This post was edited by Amaston on Sep 24 2015 08:15pm
Member
Posts: 118
Joined: Jun 30 2014
Gold: 0.00
Sep 24 2015 09:13pm
Quote (carteblanche @ Sep 22 2015 10:55pm)
i noticed it back in freshmen year of college, then a teacher explained it to me in my senior year. we were covering the chinese remainder theorem / modular arithmetic, and i remember it has something to do with 5's relation to another number. but i can't remember the details.

for natural number n, why does n mod 10 = n^5 mod 10?

eg: let n = 2.
2 mod 10 = 2
32 mod 10 = 2

in freshmen year i knew it's true for n = 0 to 9, so it must be true for n > 9 since only the one's digit impacts the one's digit when multiplying. but there was a different explanation.

it's not a homework assignment. just for my own curiosity.


Did not read this first time through. I just thought you just wanted a proof of why its true.
You probably used Fermat's Little Theorem which states is p is prime then a^p ≡ a mod p
So in our case we have n^5 ≡ n mod 5
we can also use n^2 ≡ n mod 2

We can say n^5 ≡ n mod 2
Quick proof.
n^5 - n = 2k for some integer k
n(n^4-1) = 2k
this is true for all n. Use similar approach as I did with my proof in my last post to see why.

Since we have n^5 ≡ n mod5 and n^5 ≡ n mod2
we can say n^5 ≡ n mod 10

Proof
We know from the two congruent relations above that 5 | n^5 - n and 2 | n^5 - n
Which means 5k = n^5 - n and 2m = n^5 - n for some k,m integers.
That means 5k = 2m => 5k/2 = m
Since m is an integer, and gcd(5,2) = 1; 2 must divide k. Let k = 2p for some p integer
5k = 5(2p) = 10p

We know 5 divides n^5 - n so 10 must also divide n^5 - n

so we get n^5 ≡ n mod 10
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 24 2015 09:39pm
Quote (cdexswzaq @ Sep 24 2015 11:13pm)
Did not read this first time through. I just thought you just wanted a proof of why its true.
You probably used Fermat's Little Theorem which states is p is prime then a^p ≡ a mod p
So in our case we have n^5 ≡ n mod 5
we can also use n^2 ≡ n mod 2

We can say n^5 ≡ n mod 2
Quick proof.
n^5 - n = 2k for some integer k
n(n^4-1) = 2k
this is true for all n. Use similar approach as I did with my proof in my last post to see why.

Since we have n^5 ≡ n mod5 and n^5 ≡ n mod2
we can say n^5 ≡ n mod 10


Proof
We know from the two congruent relations above that 5 | n^5 - n and 2 | n^5 - n
Which means 5k = n^5 - n and 2m = n^5 - n for some k,m integers.
That means 5k = 2m => 5k/2 = m
Since m is an integer, and gcd(5,2) = 1; 2 must divide k. Let k = 2p for some p integer
5k = 5(2p) = 10p

We know 5 divides n^5 - n so 10 must also divide n^5 - n

so we get n^5 ≡ n mod 10


bold'd looks very familiar. i believe that's what he did! the first induction proof actually made more sense to me since i'm more comfortable with it.

thank you very much!
Go Back To Homework Help Topic List
Add Reply New Topic New Poll