Fermat's Little Theorem is a key result in number theory that helps simplify powers in modular arithmetic. This cheat sheet covers the theorem, when it applies, and how it is used to find remainders and modular inverses. Students need it because large exponent problems become manageable when powers repeat in predictable cycles.
It is especially useful for contest math, cryptography basics, and advanced algebra topics.
The main idea is that if is prime and is not divisible by , then . This means exponents can often be reduced modulo when working mod . A related form says for any integer .
Applications include computing large remainders, checking divisibility patterns, and finding inverses using .
Key Facts
- If is prime and , then Fermat's Little Theorem states .
- For any integer and prime , the equivalent form is always true.
- When is prime and , exponents can be reduced using where .
- If is prime and , the modular inverse of modulo is .
- The condition is required for the form .
- If , then for any positive integer .
- To compute a large power like , first reduce modulo , then reduce modulo when is prime and .
- Fermat's Little Theorem does not prove that is prime just because holds for one value of .
Vocabulary
- Prime modulus
- A modulus that is a prime number, which is required for the standard form of Fermat's Little Theorem.
- Congruence
- A statement meaning that and have the same remainder when divided by .
- Relatively prime
- Two integers and are relatively prime when .
- Modular inverse
- The modular inverse of modulo is a number such that .
- Exponent reduction
- Exponent reduction is the process of replacing a large exponent with a smaller congruent exponent, often using .
- Remainder class
- A remainder class is the set of all integers that are congruent to the same value modulo .
Common Mistakes to Avoid
- Using when is wrong because the theorem requires for that form.
- Applying Fermat's Little Theorem with a composite modulus is wrong because is guaranteed only when is prime.
- Reducing the exponent modulo instead of modulo is wrong because the power cycle from Fermat's Little Theorem has length dividing .
- Changing to is wrong because for , so an exponent reduction that gives usually means .
- Assuming one successful Fermat test proves primality is wrong because some composite numbers can satisfy for certain bases .
Practice Questions
- 1 Find the remainder when is divided by .
- 2 Find the modular inverse of modulo using Fermat's Little Theorem.
- 3 Compute .
- 4 Explain why Fermat's Little Theorem can be used to reduce the exponent in , but not directly in .
Understanding Fermat's Little Theorem & Applications
A useful way to understand the result is to look at multiplication by a number modulo a prime. Take a nonzero remainder, such as three modulo seven, and multiply every nonzero remainder by three. The results are three, six, two, five, one, and four.
None repeat before every possible nonzero remainder has appeared. This happens because a repeated result would mean that two different numbers have the same remainder after multiplication by three. Since three has an inverse modulo seven, that would force the original numbers to have been equal.
Thus multiplication simply rearranges the nonzero remainders. Comparing the product before and after this rearrangement leads to the power rule.
The repeating pattern of powers can be shorter than the length promised by the theorem. For example, powers of two modulo seven go two, four, one, then repeat. The cycle length is three, even though the prime minus one is six.
This shorter length is called the order of the number modulo the prime. Reducing an exponent by the prime minus one is always safe under the required conditions, but finding the shorter cycle can make hand calculations faster.
Students should first list a few powers when the modulus is small. This reveals patterns and gives a check on any exponent reduction.
Modular inverses turn division into multiplication. Ordinary division is not usually meaningful when only remainders matter. Instead, to divide by a number, find a number whose product with it leaves remainder one.
For instance, the inverse of three modulo seven is five because three times five leaves remainder one upon division by seven. Therefore a congruence involving three times a value can be solved by multiplying both sides by five.
The power method for inverses works for prime moduli, though the extended Euclidean algorithm is often quicker for actual calculations. That algorithm works whenever the number and modulus have greatest common divisor one, even if the modulus is not prime.
The prime condition deserves careful attention. With a composite modulus, nonzero remainders can fail to have inverses. For example, two times three is zero modulo six, even though neither factor is zero modulo six.
This kind of zero product cannot happen modulo a prime. It explains why prime moduli behave so cleanly. In cryptography, large prime numbers are chosen partly because inverse calculations are reliable in these systems.
However, the theorem is not a shortcut for declaring a number prime. Some composite numbers pass the power test for certain bases.
When solving school problems, state the modulus, check whether it is prime, reduce the base first, then decide whether the exponent rule is allowed. These habits prevent most common errors.