Difference between revisions of "Modular arithmetic/Introduction"
(→Addition rule) |
(→Summary of Useful Facts) |
||
(43 intermediate revisions by 31 users not shown) | |||
Line 3: | Line 3: | ||
− | == | + | ==Introductory Video== |
− | + | https://youtu.be/7an5wU9Q5hk?t=777 | |
+ | ==Understand Modular Arithmetic== | ||
+ | Let's use a clock as an example, except let's replace the <math>12</math> at the top of the clock with a <math>0</math>. | ||
+ | |||
+ | <asy>picture pic; | ||
+ | path a; | ||
+ | a = circle((0,0), 100); | ||
+ | draw (a); | ||
+ | draw((0,0), linewidth(4)); | ||
+ | |||
+ | pair b; | ||
+ | b = (0,100); | ||
+ | |||
+ | for (int i = 0; i < 12; ++i) | ||
+ | { | ||
+ | label (pic, (string) i, b); | ||
+ | b = rotate(-30,(0,0)) * b; | ||
+ | } | ||
+ | pic = scale(0.8) * pic; | ||
+ | add(pic); | ||
+ | |||
+ | draw ((0,0) -- 50*dir(90)); | ||
+ | draw ((0,0) -- 70*dir(90));</asy> | ||
+ | |||
+ | Starting at noon, the hour hand points in order to the following: | ||
<math>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, \ldots </math> | <math>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, \ldots </math> | ||
Line 29: | Line 53: | ||
This just relates each integer to its [[remainder]] from the [[Division Theorem]]. While this may not seem all that useful at first, counting in this way can help us solve an enormous array of [[number theory]] problems much more easily! | This just relates each integer to its [[remainder]] from the [[Division Theorem]]. While this may not seem all that useful at first, counting in this way can help us solve an enormous array of [[number theory]] problems much more easily! | ||
+ | |||
+ | ==Residue== | ||
+ | We say that <math>a</math> is the modulo-<math>m</math> <b>residue</b> of <math>n</math> when <math>n\equiv a\pmod m</math>, and <math>0\le a<m</math>. | ||
== Congruence == | == Congruence == | ||
− | There is a mathematical way of saying that all of the integers are the same as one of the modulo 5 residues. For instance, we say that 7 and 2 are '''[[congruent]]''' modulo 5. We write this using the symbol <math> | + | There is a mathematical way of saying that all of the integers are the same as one of the modulo 5 residues. For instance, we say that 7 and 2 are '''[[congruent]]''' modulo 5. We write this using the symbol <math>\equiv</math>: In other words, this means in base 5, these integers have the same residue modulo 5: |
+ | <center><math>2\equiv 7\equiv 12 \pmod{5}. </math></center> | ||
− | |||
− | + | The '''(mod 5)''' part just tells us that we are working with the integers modulo 5. In modulo 5, two integers are congruent when their difference is a [[multiple]] of 5. | |
− | The '''(mod 5)''' part just tells us that we are working with the integers modulo 5. In modulo 5, two integers are congruent when their difference is a [[multiple]] of 5. | + | In general, two integers <math>a</math> and <math>b</math> are congruent modulo <math>n</math> when <math>a - b</math> is a multiple of <math>n</math>. In other words, <math>a \equiv b \pmod{n}</math> when <math>\frac{a-b}{n}</math> is an integer. Otherwise, <math>a \not\equiv b \pmod{n}</math>, which means that <math>a</math> and <math>b</math> are '''not congruent''' modulo <math>n</math>. |
− | |||
− | In general, two integers <math> | ||
=== Examples === | === Examples === | ||
− | * <math> | + | * <math>31 \equiv 1 \pmod{10}</math> because <math>31 - 1 = 30</math> is a multiple of <math>10</math>. |
− | * <math> | + | * <math>43 \equiv 22 \pmod{7}</math> because <math>\frac{43 - 22}{7} = \frac{21}{7} = 3</math>, which is an integer. |
− | * <math> | + | * <math>8 \not\equiv -8 \pmod{3}</math> because <math>8 - (-8) = 16</math>, which is not a multiple of <math>3</math>. |
− | * <math> | + | * <math>91 \not\equiv 18 \pmod{6}</math> because <math>\frac{91 - 18}{6} = \frac{73}{6}</math>, which is not an integer. |
=== Sample Problem === | === Sample Problem === | ||
− | Find the modulo <math> | + | Find the modulo <math>4</math> residue of <math>311</math>. |
==== Solution: ==== | ==== Solution: ==== | ||
− | Since <math> | + | Since <math>311 \div 4 = 77</math> R <math>3</math>, we know that |
− | <center><math> | + | <center><math>311 \equiv 3 \pmod{4}</math></center> |
− | and <math> | + | and <math>3</math> is the modulo <math>4</math> residue of <math>311</math>. |
+ | ==== Another Solution: ==== | ||
+ | Since <math> 311 = 300 + 11 </math>, we know that | ||
+ | <center><math>311 \equiv 0+11 \pmod{4}</math></center> | ||
+ | We can now solve it easily | ||
+ | <center><math>11 \equiv 3 \pmod{4}</math></center> | ||
+ | and <math>3</math> is the modulo <math>4</math> residue of <math>311</math> | ||
+ | ==== Another Solution: ==== | ||
+ | We know <math>308</math> is a multiple of <math>4</math> since <math>8</math> is a multiple of <math>4</math>. Thus, <math>311-308=3</math> and <math>3</math> is the modulo <math>4</math> residue of <math>311</math>. | ||
== Making Computation Easier == | == Making Computation Easier == | ||
− | We don't always need to perform tedious computations to discover solutions to interesting problems. If all we need to know about are remainders when integers are divided by <math> | + | We don't always need to perform tedious computations to discover solutions to interesting problems. If all we need to know about are remainders when integers are divided by <math>n</math>, then we can work directly with those remainders in modulo <math>n</math>. This can be more easily understood with a few examples. |
=== Addition === | === Addition === | ||
Line 74: | Line 107: | ||
− | <center><math> | + | <center><math>2403 + 791 + 688 + 4339.</math></center> |
− | We could find their sum, which is <math> | + | We could find their sum, which is <math>8221</math>, and note that the units digit is <math>1</math>. However, we could find the units digit with far less calculation. |
==== Solution ==== | ==== Solution ==== | ||
− | We can simply add the units digits of the | + | We can simply add the units digits of the addends: |
− | <center><math> | + | <center><math>3 + 1 + 8 + 9 = 21.</math></center> |
− | The units digit of this sum is <math> | + | The units digit of this sum is <math>1</math>, which ''must'' be the same as the units digit of the four-digit sum we computed earlier. |
==== Why we only need to use remainders ==== | ==== Why we only need to use remainders ==== | ||
− | We can rewrite each of the integers in terms of multiples of <math> | + | We can rewrite each of the integers in terms of multiples of <math>10</math> and remainders:<br> |
− | <math> | + | <math>2403 = 240 \cdot 10 + 3</math><br> |
− | <math> | + | <math>791 = 79 \cdot 10 + 1</math><br> |
− | <math> | + | <math>688 = 68 \cdot 10 + 8</math><br> |
− | <math> | + | <math>4339 = 433 \cdot 10 + 9</math>.<br> |
When we add all four integers, we get | When we add all four integers, we get | ||
Line 102: | Line 135: | ||
− | At this point, we already see the units digits grouped apart and added to a multiple of <math> | + | At this point, we already see the units digits grouped apart and added to a multiple of <math>10</math> (which will not affect the units digit of the sum): |
<center><math>= 820 \cdot 10 + 21 = 8200 + 21 = 8221</math>.</center> | <center><math>= 820 \cdot 10 + 21 = 8200 + 21 = 8221</math>.</center> | ||
Line 108: | Line 141: | ||
==== Solution using modular arithmetic ==== | ==== Solution using modular arithmetic ==== | ||
Now let's look back at this solution, using modular arithmetic from the start. Note that<br> | Now let's look back at this solution, using modular arithmetic from the start. Note that<br> | ||
− | <math> | + | <math>2403 \equiv 3 \pmod{10}</math><br> |
− | <math> | + | <math>791 \equiv 1 \pmod{10}</math><br> |
− | <math> | + | <math>688 \equiv 8 \pmod{10}</math><br> |
− | <math> | + | <math>4339 \equiv 9 \pmod{10}</math><br> |
− | Because we only need the modulo <math> | + | Because we only need the modulo <math>10</math> residue of the sum, we add just the residues of the summands: |
− | <center><math> | + | <center><math>2403 + 791 + 688 + 4339 \equiv 3 + 1 + 8 + 9 \equiv 21 \equiv 1 \pmod{10},</math></center> |
− | so the units digit of the sum is just <math> | + | so the units digit of the sum is just <math>1</math>. |
==== Addition rule ==== | ==== Addition rule ==== | ||
Line 126: | Line 159: | ||
And as we did in the problem above, we can apply more pairs of equivalent integers to both sides, just repeating this simple principle. | And as we did in the problem above, we can apply more pairs of equivalent integers to both sides, just repeating this simple principle. | ||
− | Proof of the addition rule | + | ====Proof of the addition rule==== |
− | Let <math>a-c=m\cdot k</math>, and <math>b-d=m\cdot l</math> | + | Let <math>a-c=m\cdot k</math>, and <math>b-d=m\cdot l</math> where <math>l</math> and <math>k</math> are integers. |
Adding the two equations we get: | Adding the two equations we get: | ||
− | < | + | <cmath> |
− | |||
\begin{eqnarray*} | \begin{eqnarray*} | ||
mk+ml&=&(a-c)+(b-d)\\ | mk+ml&=&(a-c)+(b-d)\\ | ||
m(k+l)&=&(a+b)-(c+d) | m(k+l)&=&(a+b)-(c+d) | ||
− | \end{ | + | \end{eqnarray*} |
− | </ | + | </cmath> |
− | |||
Which is equivalent to saying <math>a+b\equiv c+d\pmod{m}</math> | Which is equivalent to saying <math>a+b\equiv c+d\pmod{m}</math> | ||
Line 145: | Line 176: | ||
==== Problem ==== | ==== Problem ==== | ||
− | Find the remainder when the difference between <math> | + | Find the remainder when the difference between <math>60002</math> and <math>601</math> is divided by <math>6</math>. |
==== Solution ==== | ==== Solution ==== | ||
− | Note that <math> | + | Note that <math>60002 = 10000 \cdot 6 + 2</math> and <math>601 = 100 \cdot 6 + 1</math>. So,<br> |
− | <math> | + | <math>60002 \equiv 2 \pmod{6}</math><br> |
− | <math> | + | <math>601 \equiv 1 \pmod{6}</math><br> |
Thus, | Thus, | ||
− | <center><math> | + | <center><math>60002 - 601 \equiv 2 - 1 \equiv 1 \pmod{6}, </math></center> |
− | so 1 is the remainder when the difference is divided by <math> | + | so 1 is the remainder when the difference is divided by <math>6</math>. (Perform the subtraction yourself, divide by <math>6</math>, and see!) |
==== Subtraction rule ==== | ==== Subtraction rule ==== | ||
− | When <math> | + | When <math>a, b, c</math>, and <math>d</math> are integers and <math>m</math> is a positive integer such that<br> |
− | <center><math> | + | <center><math>a \equiv c \pmod{m} </math></center> |
− | <center><math> | + | <center><math>b \equiv d \pmod{m} </math></center> |
the following is always true: | the following is always true: | ||
− | <center><math> | + | <center><math>a - b \equiv c - d \pmod{m} .</math></center> |
− | |||
=== Multiplication === | === Multiplication === | ||
Line 168: | Line 198: | ||
==== Problem ==== | ==== Problem ==== | ||
− | Jerry has 44 boxes of soda in his truck. The cans of soda in each box are packed oddly so that there are 113 cans of soda in each box. Jerry plans to pack the sodas into cases of 12 cans to sell. After making as many complete cases as possible, how many sodas will Jerry have leftover? | + | Jerry has <math>44</math> boxes of soda in his truck. The cans of soda in each box are packed oddly so that there are <math>113</math> cans of soda in each box. Jerry plans to pack the sodas into cases of <math>12</math> cans to sell. After making as many complete cases as possible, how many sodas will Jerry have leftover? |
==== Solution ==== | ==== Solution ==== | ||
− | First, we note that this [[word problem]] is asking us to find the remainder when the product <math> | + | First, we note that this [[word problem]] is asking us to find the remainder when the product <math>44 \cdot 113</math> is divided by <math>12</math>. |
− | Now, we can write each <math> | + | Now, we can write each <math>44</math> and <math>113</math> in terms of multiples of <math>12</math> and remainders:<br> |
− | <math> | + | <math>44 = 3 \cdot 12 + 8</math><br> |
− | <math> | + | <math>113 = 9 \cdot 12 + 5</math><br> |
This gives us a nice way to view their product: | This gives us a nice way to view their product: | ||
− | < | + | <cmath>44 \cdot 113 = (3 \cdot 12 + 8)(9 \cdot 12 + 5)</cmath> |
− | < | + | Using [[FOIL]], we get that this equals |
+ | <cmath>(3 \cdot 9) \cdot 12^2 + (3 \cdot 5 + 8 \cdot 9) \cdot 12 + (8 \cdot 5)</cmath> | ||
− | We can already see that each part of the product is a multiple of <math> | + | We can already see that each part of the product is a multiple of <math>12</math>, except the product of the remainders when each <math>44</math> and <math>113</math> are divided by 12. That part of the product is <math>8 \cdot 5 = 40</math>, which leaves a remainder of <math>4</math> when divided by <math>12</math>. So, Jerry has <math>4</math> sodas leftover after making as many cases of <math>12</math> as possible. |
==== Solution using modular arithmetic ==== | ==== Solution using modular arithmetic ==== | ||
First, we note that<br> | First, we note that<br> | ||
− | <math> | + | <math>44 \equiv 8 \pmod{12}</math><br> |
− | <math> | + | <math>113 \equiv 5 \pmod{12}</math><br> |
Thus, | Thus, | ||
− | <center><math> | + | <center><math>44 \cdot 113 \equiv 8 \cdot 5 \equiv 40 \equiv 4 \pmod{12},</math></center> |
− | meaning there are <math> | + | meaning there are <math>4</math> sodas leftover. Yeah, that was much easier. |
==== Multiplication rule ==== | ==== Multiplication rule ==== | ||
− | When <math> | + | When <math>a, b, c</math>, and <math>d</math> are integers and <math>m</math> is a positive integer such that<br> |
− | <center><math> | + | <center><math>a \equiv c \pmod{m} </math></center> |
− | <center><math> | + | <center><math>b \equiv d \pmod{m} </math></center> |
The following is always true: | The following is always true: | ||
− | <center><math> | + | <center><math>a \cdot b \equiv c \cdot d \pmod{m} </math>.</center> |
Line 208: | Line 239: | ||
==== Problem #1==== | ==== Problem #1==== | ||
− | What | + | What is the last digit of <math>(...((7)^7)^7)...)^7</math> if there are 1000 7s as exponents and only one 7 in the middle? |
− | We | + | We can solve this problem using mods. This can also be stated as <math>7^{7^{1000}}</math>. After that, we see that 7 is congruent to -1 in mod 4, so we can use this fact to replace the 7s with -1s, because 7 has a pattern of repetitive period 4 for the units digit. <math>(1)^{1000}</math> is simply 1, so therefore <math>7^1=7</math>, which really is the last digit. |
==== Problem #2==== | ==== Problem #2==== | ||
− | What are the tens and units digits of <math> | + | What are the tens and units digits of <math>7^{1942}</math>? |
We could (in theory) solve this problem by trying to compute <math>7^{1942}</math>, but this would be extremely time-consuming. Moreover, it would give us much more information than we need. Since we want only the tens and units digits of the number in question, it suffices to find the remainder when the number is divided by <math>100</math>. In other words, all of the information we need can be found using arithmetic mod <math>100</math>. | We could (in theory) solve this problem by trying to compute <math>7^{1942}</math>, but this would be extremely time-consuming. Moreover, it would give us much more information than we need. Since we want only the tens and units digits of the number in question, it suffices to find the remainder when the number is divided by <math>100</math>. In other words, all of the information we need can be found using arithmetic mod <math>100</math>. | ||
Line 230: | Line 261: | ||
Therefore, by the definition of congruence, <math>7^{1942}</math> differs from <math>49</math> by a multiple of <math>100</math>. Since both integers are positive, this means that they share the same tens and units digits. Those digits are <math>4</math> and <math>9</math>, respectively. | Therefore, by the definition of congruence, <math>7^{1942}</math> differs from <math>49</math> by a multiple of <math>100</math>. Since both integers are positive, this means that they share the same tens and units digits. Those digits are <math>4</math> and <math>9</math>, respectively. | ||
+ | |||
+ | ==== Problem #3==== | ||
+ | |||
+ | Can you find a number that is both a multiple of <math>2</math> but not a multiple of <math>4</math> and a perfect square? | ||
+ | |||
+ | No, you cannot. Rewriting the question, we see that it asks us to find an integer <math>n</math> that satisfies <math>4n+2=x^2</math>. | ||
+ | |||
+ | Taking mod <math>4</math> on both sides, we find that <math>x^2\equiv 2\pmod{4}</math>. Now, all we are missing is proof that no matter what <math>x</math> is, <math>x^2</math> will never be a multiple of <math>4</math> plus <math>2</math>, so we work with cases: | ||
+ | |||
+ | <math>x\equiv 0\pmod{4}\implies x^2\equiv 0\pmod{4}</math> | ||
+ | |||
+ | <math>x\equiv 1\pmod{4}\implies x^2\equiv 1\pmod{4}</math> | ||
+ | |||
+ | <math>x\equiv 2\pmod{4}\implies x^2\equiv 4\equiv 0\pmod{4}</math> | ||
+ | |||
+ | <math>x\equiv 3\pmod{4}\implies x^2\equiv 9\equiv 1\pmod{4}</math> | ||
+ | |||
+ | This assures us that it is impossible to find such a number. | ||
== Summary of Useful Facts == | == Summary of Useful Facts == | ||
Line 241: | Line 290: | ||
* Exponentiation: <math>a^e\equiv b^e\pmod {m}</math> where <math>e</math> is a positive integer. | * Exponentiation: <math>a^e\equiv b^e\pmod {m}</math> where <math>e</math> is a positive integer. | ||
+ | == Problem Applications == | ||
+ | https://artofproblemsolving.com/wiki/index.php/2011_AMC_8_Problems/Problem_22 | ||
== Applications of Modular Arithmetic == | == Applications of Modular Arithmetic == | ||
Line 251: | Line 302: | ||
== Resources == | == Resources == | ||
− | * The AoPS [http://www.artofproblemsolving.com/ | + | * The AoPS [http://www.artofproblemsolving.com/Store/viewitem.php?item=intro:nt Introduction to Number Theory] by [[Mathew Crawford]]. |
− | * The AoPS [http://www.artofproblemsolving.com/ | + | * The AoPS [http://www.artofproblemsolving.com/School/courseinfo.php?course_id=intro:numbertheory Introduction to Number Theory Course]. Thousands of students have learned more about modular arithmetic and [[problem solving]] from this 12 week class. |
− | |||
== See also == | == See also == |
Latest revision as of 07:56, 10 July 2024
Modular arithmetic is a special type of arithmetic that involves only integers. This goal of this article is to explain the basics of modular arithmetic while presenting a progression of more difficult and more interesting problems that are easily solved using modular arithmetic.
Contents
Introductory Video
https://youtu.be/7an5wU9Q5hk?t=777
Understand Modular Arithmetic
Let's use a clock as an example, except let's replace the at the top of the clock with a .
Starting at noon, the hour hand points in order to the following:
This is the way in which we count in modulo 12. When we add to , we arrive back at . The same is true in any other modulus (modular arithmetic system). In modulo , we count
We can also count backwards in modulo 5. Any time we subtract 1 from 0, we get 4. So, the integers from to , when written in modulo 5, are
where is the same as in modulo 5. Because all integers can be expressed as , , , , or in modulo 5, we give these integers their own name: the residue classes modulo 5. In general, for a natural number that is greater than 1, the modulo residues are the integers that are whole numbers less than :
This just relates each integer to its remainder from the Division Theorem. While this may not seem all that useful at first, counting in this way can help us solve an enormous array of number theory problems much more easily!
Residue
We say that is the modulo- residue of when , and .
Congruence
There is a mathematical way of saying that all of the integers are the same as one of the modulo 5 residues. For instance, we say that 7 and 2 are congruent modulo 5. We write this using the symbol : In other words, this means in base 5, these integers have the same residue modulo 5:
The (mod 5) part just tells us that we are working with the integers modulo 5. In modulo 5, two integers are congruent when their difference is a multiple of 5.
In general, two integers and are congruent modulo when is a multiple of . In other words, when is an integer. Otherwise, , which means that and are not congruent modulo .
Examples
- because is a multiple of .
- because , which is an integer.
- because , which is not a multiple of .
- because , which is not an integer.
Sample Problem
Find the modulo residue of .
Solution:
Since R , we know that
and is the modulo residue of .
Another Solution:
Since , we know that
We can now solve it easily
and is the modulo residue of
Another Solution:
We know is a multiple of since is a multiple of . Thus, and is the modulo residue of .
Making Computation Easier
We don't always need to perform tedious computations to discover solutions to interesting problems. If all we need to know about are remainders when integers are divided by , then we can work directly with those remainders in modulo . This can be more easily understood with a few examples.
Addition
Problem
Suppose we want to find the units digit of the following sum:
We could find their sum, which is , and note that the units digit is . However, we could find the units digit with far less calculation.
Solution
We can simply add the units digits of the addends:
The units digit of this sum is , which must be the same as the units digit of the four-digit sum we computed earlier.
Why we only need to use remainders
We can rewrite each of the integers in terms of multiples of and remainders:
.
When we add all four integers, we get
At this point, we already see the units digits grouped apart and added to a multiple of (which will not affect the units digit of the sum):
Solution using modular arithmetic
Now let's look back at this solution, using modular arithmetic from the start. Note that
Because we only need the modulo residue of the sum, we add just the residues of the summands:
so the units digit of the sum is just .
Addition rule
In general, when , and are integers and is a positive integer such that
the following is always true:
And as we did in the problem above, we can apply more pairs of equivalent integers to both sides, just repeating this simple principle.
Proof of the addition rule
Let , and where and are integers. Adding the two equations we get:
Which is equivalent to saying
Subtraction
The same shortcut that works with addition of remainders works also with subtraction.
Problem
Find the remainder when the difference between and is divided by .
Solution
Note that and . So,
Thus,
so 1 is the remainder when the difference is divided by . (Perform the subtraction yourself, divide by , and see!)
Subtraction rule
When , and are integers and is a positive integer such that
the following is always true:
Multiplication
Modular arithmetic provides an even larger advantage when multiplying than when adding or subtracting. Let's take a look at a problem that demonstrates the point.
Problem
Jerry has boxes of soda in his truck. The cans of soda in each box are packed oddly so that there are cans of soda in each box. Jerry plans to pack the sodas into cases of cans to sell. After making as many complete cases as possible, how many sodas will Jerry have leftover?
Solution
First, we note that this word problem is asking us to find the remainder when the product is divided by .
Now, we can write each and in terms of multiples of and remainders:
This gives us a nice way to view their product:
Using FOIL, we get that this equals
We can already see that each part of the product is a multiple of , except the product of the remainders when each and are divided by 12. That part of the product is , which leaves a remainder of when divided by . So, Jerry has sodas leftover after making as many cases of as possible.
Solution using modular arithmetic
First, we note that
Thus,
meaning there are sodas leftover. Yeah, that was much easier.
Multiplication rule
When , and are integers and is a positive integer such that
The following is always true:
Exponentiation
Since exponentiation is just repeated multiplication, it makes sense that modular arithmetic would make many problems involving exponents easier. In fact, the advantage in computation is even larger and we explore it a great deal more in the intermediate modular arithmetic article.
Note to everybody: Exponentiation is very useful as in the following problem:
Problem #1
What is the last digit of if there are 1000 7s as exponents and only one 7 in the middle?
We can solve this problem using mods. This can also be stated as . After that, we see that 7 is congruent to -1 in mod 4, so we can use this fact to replace the 7s with -1s, because 7 has a pattern of repetitive period 4 for the units digit. is simply 1, so therefore , which really is the last digit.
Problem #2
What are the tens and units digits of ?
We could (in theory) solve this problem by trying to compute , but this would be extremely time-consuming. Moreover, it would give us much more information than we need. Since we want only the tens and units digits of the number in question, it suffices to find the remainder when the number is divided by . In other words, all of the information we need can be found using arithmetic mod .
We begin by writing down the first few powers of mod :
A pattern emerges! We see that (mod ). So for any positive integer , we have (mod ). In particular, we can write
(mod ).
By the "multiplication" property above, then, it follows that
(mod ).
Therefore, by the definition of congruence, differs from by a multiple of . Since both integers are positive, this means that they share the same tens and units digits. Those digits are and , respectively.
Problem #3
Can you find a number that is both a multiple of but not a multiple of and a perfect square?
No, you cannot. Rewriting the question, we see that it asks us to find an integer that satisfies .
Taking mod on both sides, we find that . Now, all we are missing is proof that no matter what is, will never be a multiple of plus , so we work with cases:
This assures us that it is impossible to find such a number.
Summary of Useful Facts
Consider four integers and a positive integer such that and . In modular arithmetic, the following identities hold:
- Addition: .
- Subtraction: .
- Multiplication: .
- Division: , where is a positive integer that divides and .
- Exponentiation: where is a positive integer.
Problem Applications
https://artofproblemsolving.com/wiki/index.php/2011_AMC_8_Problems/Problem_22
Applications of Modular Arithmetic
Modular arithmetic is an extremely flexible problem solving tool. The following topics are just a few applications and extensions of its use:
Resources
- The AoPS Introduction to Number Theory by Mathew Crawford.
- The AoPS Introduction to Number Theory Course. Thousands of students have learned more about modular arithmetic and problem solving from this 12 week class.