NUMBER THEORY INTEGERS AND PROOFS
Congruences
Suppose we put 17 counters into packets of 5. Three full packets use 15 counters, and 2 remain. If we start with 22 counters, four full packets use 20, and again 2 remain. The totals are different. But if our question is only “how many remain?”, those two totals give the same answer.
Can we use that smaller piece of information without calculating a large total first? For example, can we find the last digit of 7 multiplied by itself 2026 times? We will build the method from these packets, explain exactly which calculations it allows, and then use it to find all possible answers—or prove there cannot be any.
You only need ordinary addition, subtraction and multiplication to begin. We will explain the integer notation, division with remainder, and proof tools where we use them. The pictures help us inspect examples; they do not replace the arguments about every integer.
What do we keep after making equal groups?
Let’s keep the 17 counters and packets of 5. Each outlined blue packet below contains five counters. The dashed gold packet contains only the two left over. It is not another complete packet of five.
The 5 tells us the size of a full group; we call it the divisor here. The 3 or 4 counts full groups and is called the quotient. The 2 left over is the remainder. A remainder must be at least zero and smaller than the group size. If five or more counters remained, we could make another complete packet, so the grouping would not yet be finished.
We use letters so that one sentence can cover different totals. Let be an integer: one of …, , …, without a fractional part. We write to say “ is an integer”. Let be our fixed positive group size, at least 2. Then is an integer quotient and is the remainder:
The letters next to one another in mean multiplication: . Negative totals cannot be pictured as physical packets of counters. A number line lets us keep the same equation: choose a multiple at or to the left of , then move units to the right. For example, . We start at and move four units right to . The quotient is , but the remainder is 4, not .
Place one integer, then keep only its remainder
The gold point is . Blue labels mark multiples of . Each small tick is one unit; the picture follows , so zero need not stay on screen. Change or , then use Next step. Nothing moves while you are reading.
Step 1 of 3 — First locate on this part of the number line.
We chose and .
Why there is exactly one remainder
The picture found a remainder for a few integers. Before building rules on it, we need two guarantees: every integer has such a description, and two different remainders cannot both be correct. We prove those separately.
First, find a description for every integer
If is nonnegative, start at and repeatedly subtract while at least remains. Each subtraction removes a full group. The remainder falls by at least 1 each time and never becomes negative, so this process must stop: there are only nonnegative integers from 0 to . If we subtracted exactly times, the final number satisfies and .
If is negative, write with positive, and apply the process to . Suppose . When , changing the sign gives . When , initially becomes . To make the remainder positive, subtract one more full from the multiple and give it back in the remainder:
Expanding the right side gives , so the number has not changed. Since , subtracting from gives . Thus the new remainder is allowed. These two cases cover every negative integer, so existence is proved.
Next, rule out two different answers
Suppose someone gives two descriptions and , with both and between 0 and . Subtract the second description from the first. The values cancel because they are the same integer:
Because and are both in that range, their difference lies strictly between and . But an integer multiple of is either zero or has size at least : a nonzero integer multiplier has size at least 1. Therefore the only possible multiple here is zero. So , hence ; then , hence . We have proved that the quotient and allowed remainder are unique.
The restriction matters. Without it, and would both be descriptions. The second is a correct equality, but 7 is not the allowed remainder on division by 5.
Give “the same remainder” a precise meaning
Return to 17 and 22. Their difference is , exactly one full packet. Adding or removing full packets changes the total but not the remainder. We want a notation for that precise agreement. We write , read “ is congruent to modulo ”, to mean that and have the same remainder on division by . The fixed number is called the modulus.
All integers sharing one remainder form one remainder class. We can name that whole class using any one of its members, called a representative. For example, the class containing 2 modulo 5 contains …, , … because each is 5 times an integer plus 2. Using the representative 2 does not mean the class contains only that one integer.
The sign here does not mean the integers are equal, nor that they are approximately equal. It means exactly that their remainders agree for the stated modulus. The modulus cannot be omitted from the reasoning: 17 and 22 have the same remainder modulo 5, but modulo 3 their remainders are 2 and 1.
There is another description that will be easier to calculate with. The notation means “ divides ”: equals times an integer. It is not a division sign. We now prove, in both directions, that having the same remainder is equivalent to the difference being a multiple of .
First suppose the remainders agree. Write and . Subtracting gives . Because is an integer, the difference is an integer multiple of .
Conversely, suppose for an integer . Write the allowed remainders separately: . Substitute these expressions, and move the multiple of to the other side:
Again lies strictly between and . Again it is a multiple of . The argument in the uniqueness proof forces it to be zero, so . Both directions are now proved. The double arrow means that either statement implies the other.
This also explains three small moves we will use. Every number is congruent to itself because . We may reverse a congruence because gives . We may join two congruences with the same modulus: if and , adding gives . Thus and imply , always with that same modulus.
Which calculations preserve the remainder?
If we know only remainders, can we still add or multiply? Let and . The difference description we just proved lets us write and , where and are integers. These equations say exactly how much information was removed: whole multiples of .
Addition and subtraction
The quantities and are integers. Therefore both displayed differences are multiples of . By our proved description, , and . In particular, adding the same integer to both sides is allowed: that integer is congruent to itself.
Multiplication
For multiplication, we must include every term, including the product of the two removed multiples. Expanding the brackets shows these terms; gathering the ones that contain shows that their sum is a multiple of :
The bracket contains only sums and products of integers, so it is an integer. Hence . This is why we may reduce the factors first. For example, modulo because , and because . Thus . Checking the full product gives . The smaller calculation kept exactly the remainder we wanted.
Positive integer powers
The notation , for a positive integer , means copies of a multiplied together. If , the multiplication rule gives . Applying it to and gives . Why does this cover any positive , rather than only two examples? The starting case is our given congruence. Whenever the claim holds at , multiplying that congruence by proves it at . Starting at 1 and taking this step repeatedly reaches every positive integer . This start-and-next-step argument is called induction.
We have proved rules for addition, subtraction and multiplication, and therefore positive integer powers. We have not proved a rule allowing arbitrary division. It would be a mistake to add division to the list just because the other operations work.
Why ordinary cancellation can lose answers
Consider . The ordinary equation has only . But our new statement is different: it asks for to be a multiple of 6. Both and work, since , and . Yet 1 and 4 are not congruent modulo 6, because is not a multiple of 6.
Can multiplication merge different remainder groups?
The first column lists every possible starting remainder . The middle column multiplies it by ; the last column keeps only the remainder modulo . Gold rows reach the same final remainder as the chosen . Change , keeping fixed, to see when different rows meet.
In the diagram, the left column is the starting remainder and the right column is the resulting remainder. Each line performs “multiply by , then keep the remainder”. Gold lines end at the same right-hand point. The table below supplies the exact calculation behind each line.
| Remainder modulo | ||
|---|---|---|
| 0 | 0 | |
| 1 ← chosen | 2 | |
| 2 | 4 | |
| 3 | 0 | |
| 4 | 2 | |
| 5 | 4 |
Starting remainders with this same result: 1, 4.
In the initial table, the input remainders 1 and 4 both become 2 after multiplying by 2 modulo 6. Once those two inputs have merged, the output alone cannot tell us which one we started with. This is the information that an unjustified cancellation loses.
We can still divide a genuine equality. Write , where is an integer. Divide every term of this equality by 2: . This says , not modulo 6. Reversing the steps shows that every such works. Thus all integer solutions are : …, , …. The modulus has changed together with the cancelled factor.
When can we keep the old modulus, and how should we change it otherwise? To answer completely, we need a way to make the number 1—or a larger common divisor—out of integer multiples. We will build that tool next, rather than assume it.
Find the integer combination we need
Take positive integers and . A positive common divisor is a positive integer dividing both. There is always at least one, namely 1. There are only finitely many: if with and positive integers, then , so . Thus every positive divisor lies in the finite list 1, 2, …, A. The largest is called the greatest common divisor, written . We will show both how to find it and why it is an integer combination .
Replacing a pair without changing its common divisors
Divide by and write . If a positive integer divides and , write and . Then , so divides . In the other direction, if and , then , so divides . Therefore the pair and the pair have exactly the same positive common divisors.
Repeat this replacement while the remainder is nonzero. Each new remainder is a nonnegative integer smaller than the preceding divisor, so the positive remainders cannot decrease forever. Eventually we reach a pair . Every positive divisor of divides 0 too, since 0 equals that divisor times 0. The largest common divisor of this final pair is itself. Because each replacement preserved all common divisors, is also . This process is the Euclidean algorithm.
Keep track of how each remainder was made
At the start, and are already integer combinations of and . Suppose two current numbers are and . Subtracting times the second from the first gives , still with integer coefficients. Thus every new remainder is such a combination. We start with this property and preserve it at every step, so the final retained nonzero number also has it, even if it was one of the starting numbers:
This is Bézout’s identity. The coefficients and may be negative; “integer combination” allows subtraction as well as addition. We have proved its existence, rather than assuming that suitable coefficients can always be guessed.
Work the numbers: combine 7 and 12 to make 1
For 7 and 12, start by dividing the larger number by the smaller. At each following line, use the preceding divisor and remainder:
The last nonzero remainder is 1, so . To write this 1 using the original numbers, read the earlier equations backwards. First isolate . Replace each 2 with , then each 5 with . We keep all the intermediate expansions:
Checking gives . We have not divided by 7. We have found an integer multiplier of 7 whose result differs from 1 by a multiple of 12. That is exactly the sort of replacement for division we were looking for.
Cancel with the right modulus; then find inverses
We first handle the case where the multiplier and modulus have greatest common divisor 1. Such two positive integers are called coprime; this says only that their sole positive common divisor is 1. Bézout gives integers and with . Suppose . Write , then multiply the Bézout equation by :
The bracket is an integer, so divides . Hence . We chose the Bézout equation because its left side can become , while its right side uses the known multiple . This proves cancellation when the multiplier and modulus are coprime.
What changes when there is a common divisor?
Let , with positive. Divide both by and call the results and . These are integers. They are coprime: if a positive divided both, then would divide both and ; since is the greatest common divisor, , and division by the positive gives . Thus can only be 1.
To prove the forward direction, write and divide this equality by . It becomes . Since and are coprime, the cancellation argument just proved gives . Conversely, if for an integer , multiply by : . This is a multiple of , so the original congruence follows. Both directions hold.
There is one boundary case to explain. If , division by 1 always has remainder zero: for every integer . Thus all integers are congruent modulo 1, and the reduced statement imposes no restriction. The proof still works, since 1 divides every integer. We began with , but cancellation can lead to this case.
Undo multiplication with another multiplication
In ordinary arithmetic, multiplying by undoes multiplying by . Here we want an integer with . Such a is called a multiplicative inverse of modulo . It is an integer remainder-class inverse, not the ordinary fraction . If , multiplying by gives ; since , another use of the multiplication rule gives .
An inverse exists exactly when . If the is 1, Bézout gives , so , proving . Conversely, if , then , so . Every positive common divisor of and must divide this combination, hence must divide 1. If with and positive integers, forces ; hence the only positive divisor of 1 is 1. So the is 1. That proves both the existence condition and its necessity.
Our worked identity says that is an inverse of 7 modulo 12. Adding 12 gives the representative 7. Check it: . An inverse is not a unique integer—adding a multiple of 12 keeps the property—but it is a unique remainder modulo 12. Indeed, if and , the proved cancellation gives .
Find every solution of a linear congruence
We can now solve , where is a positive integer, is any integer, , and is the unknown integer. “Linear” means appears multiplied by , rather than squared or raised to another power. We need to answer three questions: does any solution exist, how do we get one, and how do we know we have all of them?
First decide whether a solution is possible
Put . If is a solution, there is an integer with . Move terms to get . Since and , this becomes . Everything in the bracket is an integer, so must divide . For example, is impossible: every is a multiple of 3, but is not.
Now suppose does divide , so with integer . Bézout gives . Multiply that whole equality by : . Rearranging gives . Thus is a solution, because its difference from after multiplying by is a multiple of . We have proved both directions of the existence criterion:
Then find every solution, without losing or adding any
Suppose is one solution and is any other solution. Subtract from . The subtraction rule gives . Apply the corrected cancellation with : . This means for an integer . Therefore every solution must have the following form:
We still must check that every integer of this form really works. Substitute it: . The first term is a multiple of because is a solution; the second is a multiple because and are integers. Their sum is a multiple of . So this formula gives all solutions and only solutions.
Why there are different answer classes modulo
The integer solutions are infinite, but their remainders modulo are not. In the formula above, use , …, . These answers represent distinct remainders. To see this, if the answers for and were congruent modulo , their difference would equal . Dividing the equality by the positive gives . But , so the uniqueness argument forces .
These classes also include every other integer . Divide by , writing with ; when , the remainder is 0. Then . The final term does not change the remainder modulo , so the answer is in the class already represented by . There are exactly classes whenever solutions exist.
A complete example:
The divisions and give . Since 2 divides the right side 2, solutions exist. Back-substitution gives . Here , so is one solution. The spacing is , hence every solution is .
We may start the same list at 2, because , and still runs through all integers. Writing makes the two representatives modulo 6 easy to read: 2 and 5. Direct substitution checks the whole family, not just those two numbers:
Every integer makes this a multiple of 6. Conversely, the argument above proved every solution has this form. This is the two-way check a complete solution needs.
Check the candidates, then explain the whole answer
We seek integer with . A candidate works exactly when is a multiple of . Next step checks the next starting remainder; Reset restores . The formula after the table uses the proof above, rather than guessing a pattern from the rows.
The remainder is not zero: this candidate does not work.
| Divisible by ? | ||
|---|---|---|
| 0 | -2 | No |
| 1 | — | Not checked yet |
| 2 | — | Not checked yet |
| 3 | — | Not checked yet |
| 4 | — | Not checked yet |
| 5 | — | Not checked yet |
Here is the Euclidean calculation for the chosen and . A possible first line with quotient zero just swaps the smaller and larger number. The final nonzero number retained before the zero remainder is ; it may be one of the starting numbers when a division is exact. The following integer coefficients certify that is a combination of and .
Because , multiply the displayed coefficient of a by this number. This gives one solution . The spacing is . Replacing by its remainder 2 at this spacing describes the same integers.
Representatives modulo the original : 2, 5.
The table only checks starting remainders 0 through , but that is enough after our proof: any integer can be written , and . The two candidates and therefore either both work or both fail. Here a finite table covers all cases for a reason; it is not an unproved guess about an infinite list.
Large powers and decimal digits
Let’s return to the large multiplication in the introduction. A nonnegative decimal integer has a last digit between 0 and 9. The other digits count complete tens, so . Thus its last digit is exactly its remainder modulo 10. We need the remainder of , not its enormous full value.
Keep the last digit after each multiplication by 7
The first row is the number 7 itself. Next step multiplies the previous remainder by 7, then removes complete tens. Earlier rows stay visible. This small table suggests a cycle; the argument below proves that the cycle continues.
Exponent 1:
Before choosing any factor, we start the multiplication with 1; gives the first factor.
| Exponent | Remainder of modulo 10 |
|---|---|
| 1 | 7 |
Four rows alone would not prove that the pattern always repeats. The reason it repeats is the multiplication rule: multiplying any power by multiplies its remainder by 1, so . The identity comes from putting together factors of 7 and four more factors.
Now divide the number of factors by four: . We can arrange the 2026 factors into 506 blocks of four and two remaining factors. Each block of four has remainder 1, and the last two factors have remainder 9. Therefore:
The last digit is 9. Notice that we reduced the exponent using a proved cycle length, 4, not by replacing 2026 with its remainder modulo 10. The modulus for the values and the length of a repeating pattern are different numbers.
Why the digit-sum test for divisibility by 9 works
A four-digit number with digits , , and means . This is the meaning of decimal place value: counts thousands, hundreds, tens, and units. Since , we have . The power rule gives and . The multiplication and addition rules now give:
For a number with more or fewer digits, each additional place has weight 10 to a positive integer power, and that weight again has remainder 1. The units place already has weight 1. Repeated addition therefore proves the same conclusion for any finite number of digits. A number is divisible by 9 exactly when its remainder is zero, so it is divisible by 9 exactly when its digit sum is divisible by 9.
For 2349, the digit sum is , so its remainder is zero; direct division confirms . For 2026, the sum is , so its remainder is 1; indeed . The rule now has a reason, and it tells us the remainder as well as answering yes or no.
Use all remainder cases to prove impossibility
Congruences can also show that a proposed integer equation has no answer. Consider with integer and . Instead of trying more and more values, ask what remainder each side could have modulo 4. Every integer has exactly one remainder among 0, 1, 2 and 3. If , the proved multiplication rule gives . We can therefore cover every integer by these four cases:
| Remainder of | Square and division by 4 | Remainder of |
|---|---|---|
| 0 | 0 | |
| 1 | 1 | |
| 2 | 0 | |
| 3 | 1 |
Thus an integer square has remainder 0 or 1 modulo 4, never 2. The right side always has remainder 2, including when is negative, because is an integer quotient and . Equal integers must have the same unique remainder. Our two sides cannot, so no integer pair satisfies the equation.
Passing a remainder check does not prove a solution exists. For example, 17 has remainder 1 modulo 4, which is allowed for a square. Yet has no integer solution: . Squaring nonnegative integers increases strictly, because . So no nonnegative integer can have square 17, and a negative integer has the same square as its positive opposite. A congruence can rule out an answer; when it does not, we may still need more reasoning.
Try the reasoning yourself, then check every step
Try writing an equation or an integer multiple for each answer before opening its explanation. A correct final remainder is useful, but the written reason is what lets someone else check the argument.
1. What is the allowed remainder of on division by 7?
We need a multiple of 7 at or to the left of . Since is to its right, use . The distance to is . Thus , with . The quotient is and the remainder is 5, so .
2. Find the remainder of modulo 5 without first finding the full product.
Since and , their remainders are 3 and 2. The proved multiplication rule gives . We must reduce once more, because 6 is not an allowed remainder: . The final remainder is 1. As a check, the full product is .
3. Solve , giving all integers and all remainder classes modulo 9.
The divisions and show the is 3, and 3 divides the right side. Write and divide the equality by 3: . Thus . Since , multiplying by 2 gives . Hence for integer . Modulo 9 the three representatives are 2, 5 and 8, using . Substituting the whole family gives , a multiple of 9. The earlier cancellation proves every solution is in this family.
4. Why does changing the right side to 4 make impossible?
If a solution existed, for integers , . Move 4 and to get . This would make 4 a multiple of 3. But has remainder 1, not zero. The unique remainder cannot be both 0 and 1, so the supposed solution cannot exist.
5. Find an inverse of 3 modulo 7, then solve .
From we get . Thus is an inverse of 3 modulo 7. Its nonnegative representative is 5 because . Check: . Multiply by 5: . Since and , this becomes . All solutions are . Substitution gives , so all work; cancellation with shows there are no others.
6. What is the last digit of ? Explain why the cycle you use continues.
The first four remainders modulo 10 are 3, 9, 7 and 1: ; ; . Multiplying any power by therefore multiplies its remainder by 1, so the four-step repetition is proved. Now , giving . The last digit is 7.
7. Prove that has no integer solutions.
Each integer square has remainder 0 or 1 modulo 4, as proved by all four cases in the preceding section. The two squares therefore give the four possible remainder sums and . None has remainder 3. But always has remainder 3 because is an integer and . Equal integers must have equal remainders, so the equation is impossible for every integer triple . This includes negative integers because the remainder proof included them.
We began with two counters left after making packets. We can now explain why keeping a remainder is legitimate, why some cancellations lose information, how to recover every solution of a linear congruence, and how a short complete list of remainders can prove that an integer equation is impossible. In the Diophantine equations lesson, we keep the integers that a congruence hides: becomes the genuine equation with two integer unknowns and .
