ΘρϵηΠατπ

Congruence
Fix an integer m called the modulus, then say a≡b(mod⁡m) if and only if m|b−a

It is not immediately clear why we prefer the above definition, it's most important property follows below:

congruence iff same remainder
a,b∈ℤ are congruent modulo m if and only if a%m =b%m

note: this means that a and b have the same remainder upon division by m

Suppose that a≡b(mod⁡m), so we know m|b−a, then we can write b=kbm+rb and a=kam+ra so that b−a=m⋅(kb+ka)+kb−ka thus m|kb−ka.

Notice that 0≤ka,kb<|m| also we know that ka≠kb therefore kb−ka≠0 so then −|m|<kb−ka<|m|

Congruence Commutes
Let a,b,m∈ℤ then a≡b(mod⁡m)⟺b≡a(mod⁡m)
Division iff Congruent Mod 0
Let a,b∈ℤ such that a≠0, then a|b⟺b≡0(mod⁡a)
a|b if and only if a|b−0 iff 0≡b(mod⁡a) iff b≡0(mod⁡a) as needed.
Congruence is Transitive
Let a,b,c,m∈ℤ such that a≡b(mod⁡m) and b≡c(mod⁡m), then we have that a≡c(mod⁡m)
TODO
Sum of Two Congruent Numbers are Congruent
Suppose that a≡b(mod⁡m) and that c≡d(mod⁡m) then we know that a+c≡b+d(mod⁡m)
Product of Two Congruent Numbers is Congruent
Suppose that a≡b(mod⁡m) and that c≡d(mod⁡m) then we know that ac≡bd(mod⁡m)

Note that we don't have the same theorem about division, we can observe that in general this is false, because any odd square has remainder 1, upon division by four, so that 52≡32(mod⁡4) but we can see that 5≡3(mod⁡4) is false.

Congruent Numbers raised to Congruent Powers may not be Congruent
Suppose that a≡b(mod⁡n) and c≡d(mod⁡n), then its NOT true that ac≡bd(mod⁡n)
Consider 2≡5(mod⁡3) but then 25≡2 whereas 52≡1 so 25≢52(mod⁡3)
If two Two Numbers are Congruent, they are still Congruent mod a divisor of the Original Mod
Suppose that a≡b(mod⁡n) and m|n then a≡b(mod⁡m)
Since a≡b(mod⁡n) then we know that n|b−a but also m|n so that m|b−a therefore a≡b(mod⁡m) as needed.

Note that if instead we required that n|m then the above would not be true because we see that 3≡6(mod⁡3) but 3≢6(mod⁡6)

If Two Numbers are Congruent Using Two Different Moduli they are Congruent Using the LCM
Suppose that a≡b(mod⁡n) and that a≡b(mod⁡m) then a≡b(mod⁡lcm⁡(n,m))
We have that m,n|a−b but the definition of the LCM then states that lcm(n,m)|a−b
Switching Prime Powers
Let p≠q∈ℙ then pq−1+qp−1≡1(modpq)
FLT tells us that pq−1≡1(modq) and qp−1≡1(modp) but since p−1,q−1≥1 then we know that qp−1≡0(modq) and pq−1≡0(modp) therefore we know that pq−1+qp−1≡1(modq) and qp−1+pq−1≡1(modp) since lcm⁡(p,q)=pq⋅gcd⁡(p,q) and we know that p≠q∈ℙ then gcd⁡(p,q)=1 so that lcm⁡(p,q)=p⋅q then we conclude that pq−1+qp−1≡1(modpq)
a p q
Suppose that a∈ℤ and that p≠q∈ℙ, then apq−ap−aq+a≡0(modpq)
By FLT, we know that apq−ap−aq+a≡(ap)q−ap−aq+a≡aq−a−aq+a=0(modp) and symetrically the same thing occurs mod q therefore apq−ap−aq+a≡0(modpq)
Division by a Common Factor Maintains Congruence
Suppose that a≡b(mod⁡m) then if k|a,b,m then we have that ak≡bk(mod⁡mk)
Recall that ak≡bk(mod⁡mk) iff mk|ak−bk but we know that statement is true because since m|a−b and we by linearity we know that k|a−b therefore it holds true.
Division by a Common Factor Maintains Congruence if Mod is Divided by GCD
Let a,b,m,k∈ℤ such that k≠0 and suppose that a≡b(mod⁡m) then if k|a,b then ak≡bk(mod⁡mgcd⁡(m,k))

Let g:=gcd⁡(m,k) our goal is to prove that mg|ak−bk, towards this note that we have a≡b(mod⁡m) which means that m|a−b so there is some r∈ℤ such that a−b=mr therefore dividing by g≠0 we have a−bg=mgr

Recall that we want k in the denominator, to get there we recall that g|k and so there is some j∈ℤ such that k=gj, since k≠0 then gj≠0 so j≠0 thus we divide our previous equation by j to obtain a−bgj=(mgr)1j⟺a−bk=(mgr)1j Since k|a,b then k|a−b so a−bk∈ℤ thus (mgr)1j∈ℤ and therefore j|mgr.

Note that j|k and mg|m therefore gcd⁡(j,mg)=1 therefore j|r so that rj∈ℤ thus we have the equation a−bk=ak−bk=mgrj where we know the left hand side is an integer, rj is and so is mg therefore mg|ak−bk so that ak≡bk(mod⁡m) as needed.

Multiplicative Cancellation if Mod Prime
Suppose that p is prime and that ka≡kb(mod⁡p) and p∤k then a≡b(mod⁡p)
Since p∤k then we know that gcd⁡(p,k)=1 therefore the result follows from the previous proposition.
n Consecutive Numbers have Unique Remainders Mod n
For any m∈ℕ1 ∀x,y∈[0,…m−1],(x≠y⟺x≢y(mod⁡m))

⟹ Suppose that x≠y but that x≡y(mod⁡m) for the sake of contradiction, without loss of generality assume that x>y. Since they're congruent we have m|x−y but we know that x−y≤m−1−0=m−1 but if m|x−y we have m≤x−y≤m−1 so m≤m−1 which is impossible, therefore we must have that x≢y(mod⁡m).

⟸ Now suppose that x≢y(mod⁡m) therefore x % m≠y % m but since x,y∈[0,…,m−1] then x=x % m and y=y % m therefore x≠y as needed.

When a Linear Modular Equation has a Solution
The equation ax≡b(mod⁡m) has a solution iff gcd⁡(a,m)|b
Note that ax≡b(mod⁡m) iff m|ax−b so there is some k∈ℤ such that ax−b=mk so that ax−mk=b this has a solution iff gcd⁡(a,m)|b
Relatively Prime Modular Equation has a Solution
Suppose that we have the equation: ax≡b(mod⁡m) where gcd⁡(a,m)=1 then it has a solution.
Since gcd⁡(a,m)=1|b it has a solution.
Modular Inverse
Given a,m∈ℤ we say that an integer x∈ℤ is a the modular inverse for a mod m when: a⋅x≡1(mod⁡m)

When a given number has an inverse we say that it is invertible.

When a Rational Can be Converted to a Modular Inverse
Suppose that a,b∈ℤ and m∈ℕ1 such that b is invertible mod m and ab∈ℤ then: a⋅b−1≡ab(modm) where the right hand side is interpreted as division of integers.
Note that since b|a then there is some k∈ℤ such that a=bk therefore a≡bk(modp)⟺b−1a≡k⟺ab−1≡ab(modp)
2p Choose p
Prove that (2pp)≡2(modp)
We have that (2pp)=(p+1)⋯(p+p−1)(2p)p!=(p+1)⋯(p+p−1)2(p−1)!∈ℤ therefore (p+1)⋯(p+p−1)2(p−1)!≡(p+1)⋯(p+p−1)2[(p−1)!]−1≡2(p−1)![(p−1)!]−1≡2(modp)
Every Non Zero Number is Invertible Mod a Prime
For any p∈ℙ a∈ℤ such that p∤a there exists b∈[1,…,p−1] such that ab≡1(modp)
Consider the equation ax≡1(modp), since gcd⁡(a,p)=1 then it has a solution, as needed.
A Linear Modular Equation with a Solution has GCD many Solutions
Suppose that ax≡b(mod⁡m) has a solution x0 , then it has exactly g:=gcd⁡(a,m) solutions mod m. Moreover the unique solutions are given by the remainders of x0,x0+1mg,x0+2mg,…,x0+(g−1)mg when taken mod m

Since it has a solution, we have an x0∈ℤ such that ax0≡b(mod⁡m), so therefore m|ax0−b so that ax0−b=mk for some k∈ℤ therefore ax0+m(−k)=b.

Recall that we have a method of obtaining more solutions once we have one, and hence are given by (x0,−k)+(mg,−ag)t, where t∈ℤ Note that for each new solution x,y it satisfies ax+my=b so that ax−b=−ym so that m|ax−b so that ax≡b(mod⁡m), therefore we only need to observe the x component of each of solutions obtained from the equation

With this we observe the solutions: …x0−mg,x0,x0+1mg,x0+2mg,…,x0+(g−1)mg,x0+gmg=x0+m,… and note that for any t∈ℤ such that t≥g then t=qg+r where r∈[0,…g−1] x0+tmg=x0+qm+rg≡x0+rg(mod⁡m) which is to say that it is congruent to a solution of the form x0+jmg where j∈[0,…,g−1] similarly any solution that is of the form x0+nmg where n<0 can be turned into one of these solutions by repetitively adding m.

This shows that the entire solution set mod m is given by x0,x0+1mg,x0+2mg,…,x0+(g−1)mg we'll now verify that every pair of solutions are incongruent mod m to show that there are g total solutions.

So suppose for the sake of contradiction that x0+lmg≡x0+pmg(mod⁡m) where l,p∈[0,…,g−1] and without loss of generality l>p so that m|lmg−pmg=mg(l−p) since l,p∈[0,…g−1] then l−p≤g−1 so that mg(l−p)<mgg=m which means that m divides a number smaller than it, which is impossible so that x0+lmp≢x0+pmg as needed.

Note that modulo a prime, since the gcd is always one, then this shows that every element has a unique inverse mod p.

24 and 60
Find all incongruent solutions of the linear congruence given by 24x≡60(mod102)

First we verify that the above has a solution, since 102=17⋅6, then gcd⁡(24,102)=6 and so gcd⁡(24,102)|60, so we deduce that 24x≡60(mod102) has a solution, call it x0.

Since it has a solution, then we know that it actually has gcd⁡(24,102)=6 solutions explicitly given by x0+(1026)k for k∈[0,…,5]. Now to actually find a solution, we can divide through by 6 which yields 4x≡10(mod17) since 17 is prime, then we know that 4 has an inverse, we can see that −4 works, so that x≡−40≡11(mod17) so our solutions are given by 11+17k for k∈[0,…,5] mod 102

Chinese Remainder
Suppose that for some l∈ℕ1 we have that x≡ci(mod⁡mi) for each i∈[1,…,l] such that for any i<j∈[1,…,l] we have gcd⁡(mi,mj)=1, then there is a unique x satisfying the modular equations (mod⁡∏i=1lmi)

Set M=∏i=1lmi, then clearly we have that M≡0(mod⁡mi). Now recall the following fact, and that it can be extended to finite products by induction which shows that gcd⁡(Mmj,mj)=1 for any j∈[1,…,l]. Therefore we obtain a solution to the equation Mmjx≡1(mod⁡mj), let this solution be denoted by xj.

As just discussed we obtained a solution xj such that Mmjxj≡1(mod⁡mj), in other words Mmjxjcj≡cj(mod⁡mj) and so we've found l different solutions to each of the congruence equations we required, but we need to find one solution to all of them.

Note that Mmj≡0(mod⁡mi) for any i≠j so that Mmjxjcj≡0(mod⁡mi) as well, with this fact we see that S:=∑i=1lMmjxjcj has the following property S≡0+0+⋯cj+0+0≡cj(mod⁡mj) in other words using x=S works.


We now show that the solution is unique. Suppose that y is another solution to all of the modular equations then we'll prove that x≡y(mod⁡∏i=1lmi)

Seven Divides Ones and Threes
Show that 7|(111333+333111)

111=7⋅15+6 therefore 111≡6≡−1(mod⁡7) therefore 1112k+1≡−1 so therefore 111333≡−1(mod⁡7).

Now note that 333≡3(111)≡3(−1)≡−3(mod⁡7), consider the following −31≡−3(mod⁡7)−32≡2(mod⁡7)−33≡1(mod⁡7) therefore (−3)3k+i≡{−3 if i=12 if i=21 if i=0 since the sum of the digits of 111=3 then 3|111 and therefore 3111≡1 therefore 111333+333111≡−1+1≡0 therefore 7|111333+333111 as needed.

Alternating Congruence Again
Prove that 39|(53103+10353)
Note that 53=39+14 thus 53≡14(mod⁡39), looking at 142=(10+4)14=140+56=196, then since 39⋅5=(40−1)5=200−5=195 then we see that 196=39⋅5+1 so that 142≡1(mod⁡39) therefore we have that 14k≡{14 if k odd 1 if k even  therefore 53103≡14103≡14. Now we look at 103=2⋅39+25 so that 103≡25 now 252=625 since we see that 16⋅39=16(40−1)=(400+240)−16=640−16=624 then 625=16⋅39+1 so that 252≡1 so we deduce that 25k≡{25 if k odd 1 if k even  therefore 10353≡2553≡25 so then 53103+10353≡14+25≡39≡0 therefore we know that 39|53103+10353
43 Divides a Sum of Powers of 6 and 7
Show that 43|(6n+2+72n+1)
Note that 61≡6(mod⁡43)62≡36(mod⁡43)63≡3⋅36≡130+36≡216(mod⁡43)

Note that 216=43⋅5+1 therefore 63≡1(mod⁡43) therefore the modular power sequence is given by (6,36,1,6,36,1,…). Therefore if we look at an=6n+2 then (an)=(1,6,36,1,6,36,…)

Now we'll look at 7 power sequence mod 43 we have 7≡7(mod⁡43)72≡49≡6(mod⁡43)73≡6⋅7≡42≡−1(mod⁡43)74≡−1⋅7≡−7(mod⁡43)75≡7372≡(−1)6(mod⁡43)76≡7(−6)≡−42≡1(mod⁡43) therefore it's power sequence mod 43 is (bn)=(7,6,−1,−7,−6,1,7,6,−1,−7,−6,1,…), therefore the power sequence of 72n+1 is given by (cn)=(−1,−6,7,−1,−6,7,…), therefore xn=6n+2+72n+1 is given by (xn)=(1,6,36,1,6,36,…)+(−1,−6,7,−1,−6,7,…)=(0,0,43,0,0,43,…) Since xn≡0(mod⁡43) for every n as needed.

Remainder of a Sum of Powers
Find (∑i=1100i5) % 4
For i odd, then recall that i2 is an odd perfect square and thus i2 % 4=1 therefore i5=i2i2i=i, also when i is even, then i5 % 4=0 therefore we know that (∑i=1100i5)≡1+3+5+…+2(50)−1=502 using this fact since 50 % 4=2 then we know that 502 % 4=0 so we deduce that (∑i=1100i5) % 4=0
Remainder of a Sum of Factorials
Determine (∑i=1100i!) % 15
Observe that for any i≥5 we see that 15=3⋅5|i! therefore we reduce it to (∑i=1100i!)≡∑i=14i!( % 15) But we know that 1!+2!+3!+4!=33≡3( % 15) so that (∑i=1100i!)≡3( % 15)
Modular Inverse iff GCD 1
Suppose that a,m∈ℤ and that a has a modular inverse mod m, iff gcd⁡(a,m)=1.

⟹ We know that a⋅x≡1(mod⁡m) therefore by definition m|(1−a⋅x) therefore 1−ax=k⋅m for some k∈ℤ.

Therefore xa−km=1, so now suppose that g=gcd⁡(a,m), so by definition g|a and g|m so that g|xa−km=1 which implies that g=1 as needed.


⟸ We have some s,t∈ℤ such that 1=gcd⁡(a,m)=as+mt so that 1−as=mt which means that m|1−as so that by definition we have that as≡1(mod⁡m) which means that s is a's inverse mod m.

Not Relatively Prime iff No Modular Inverse
gcd⁡(a,m)≠1 iff a doesn't have an inverse mod m
This follows by the contra-positive of the above.
Complete System of Residues Modulo n
A collection of R={r1,…,rn}⊆ℤ is said to be a complete system of residues modulo n if they are pairwise incongruent modulo n, meaning that for any x,y∈R, if x≠y then x≢y(mod⁡n)
Equality is the Same as Congruent in a Complete System of Residues Modulo n
Suppose that R⊆ℤ is a complete system of residues modulo n, then for any x,y∈R x=y⟺x≡y(mod⁡n)
⟹ Suppose that x=y therefore we have that x≡y(mod⁡n). ⟸ Suppose that x≡y(mod⁡n) we want to show that x=y, but if it was that x≠y then by the definition of complete system of residues we would have x≢y(mod⁡n) which would be a contradiction, therefore x=y
Complete and Incomplete Systems Modulo n
Prove that 0,21,…,29 is a complete system of residues modulo 11 but 0,31,…,39 is not.

Suppose for the sake of contradiction that the former was not a complete system, before doing anything else note that 0≢2z(mod⁡11) for any z∈[1,…9] since 11∤2z and therefore instead there would exist some x,y∈[0,…9] such that x≠y and that 2x≡2y(mod⁡11) therefore 11|2x−2y and without loss of generality assume that x>y then 2x−2y=2y(2x−y−1), since 11 is prime then 11|2y or 11|2x−y−1, we know that 11|2y is impossible as noted before so we must have that 11|2x−y−1.

We'll show that 11|2x−y−1 also leads to a contradiction, because if we look at 2's power sequence modulo 11 we see that it is (2,4,8,5,−1,−2,−4,−8,−5,1) therefore since x−y∈[0,…,9] and the smallest integer such that 2k≡1 is k=10 then 2x−y≢1 and thus is in contradiction with the fact that 11|2x−y−1⟺2x−y≡1(mod⁡11). Therefore our assumption is false and so the former is a complete system of residues.


Following a similar thread we note that 3k≢0(mod⁡11) which is impossible by the uniqueness of the prime factorization. We want to find some x,y∈[0,…9] such that 3x≡3y(mod⁡11) again without loss of generality assume that x>y and therefore we have 11|3x−3y=3y(3x−y−1) since 11 is prime then it divides one of the factors, but as just noted the factor it divides must be 3x−y−1 by looking at 3's power sequence modulo 11 we get some insight 3,9,5,4,1,3,9,5,4,1,… so if x−y=5 then 11|3x−y−1 so let y=1 and x=6 therefore 36≡31(mod⁡11) and we've proven that the latter is not a complete system of residues.

A Complete System of Residues Modulo n Hits all Possible Residues
Suppose that r1,r2,…,rn is a complete system of residues modulo n, then prove that for each r∈[0,…,n−1] there exists some i∈[1,…n] such that ri≡r(mod⁡n) Moreover this mapping f:R→[0,…,n−1] is a bijection.
Suppose that for the sake of contradiction that there exists some r∈[0,…,n−1] such that no ri was congruent to, then: X={ri % n:i∈[1,…,n]}⊂[0,…,n−1] therefore we deduce that |X|<n therefore there must exist some i,j∈[1,…,n] such that i≠j and ri % n=rj % n but that's a contradiction since the ri's are pairwise incongruent therefore it must be that X=[0,…,n−1] therefore for any r∈[0,…,n−1] there exists some rj∈X such that rj≡r(mod⁡n)

As per the statement the above mapping is denoted by f:R→[0,…,n] what we've shown is that im⁡(f)=[0,…,n−1] and since |dom⁡(f)|=|im⁡(f)|=|ran⁡(f)| then f is a bijection.

Note the mapping f(ri) is simply ri % n.

The Multiples of a Complete System of Residues Mod n is still a Complete System of Residues Mod n
Suppose that R={r1,r2,…rn} is a complete system of residues modulo n and a∈ℤ such that gcd⁡(a,n)=1 then A={ar1,ar2,…,arn} is a complete system of residues modulo n
Let ari,arj∈A such that i≠j, since R is a complete system of residues, we know that ri≢rj(mod⁡n), now suppose for the sake of contradiction that ari≡arj(mod⁡n), then since gcd⁡(a,n)=1 we have ri≡rj(mod⁡n1) which is a contradiction, therefore we must have ari≢arj(mod⁡n) as needed.
Product of Non-Zero Residues Yields Factorial
Suppose that R={r1,r2,…rn} is a complete system of residues modulo n such that rn % n=0, then ∏i=1n−1ri≡(n−1)!(mod⁡n)
Recall that there is a unique r∈[0,…,n−1] for each ri such that ri≡r. In this case since we've removed rn then there is a unique r∈[1,…,n−1], let this mapping be denoted as f:R→[1,…,n] since it is a bijection then we note that ∏i=1n−1ri≡∏i=1n−1f(ri)≡∏i=1n−1i≡(n−1)! as needed.
There are 22 Possibilities for the Last Two Digits of a Square
As per title.
We compute 02=0≡0(mod100)12=1≡1(mod100)22=4≡4(mod100)32=9≡9(mod100)42=16≡16(mod100)52=25≡25(mod100)62=36≡36(mod100)72=49≡49(mod100)82=64≡64(mod100)92=81≡81(mod100)102=100≡0(mod100)112=121≡21(mod100)122=144≡44(mod100)132=169≡69(mod100)142=196≡96(mod100)152=225≡25(mod100)162=256≡56(mod100)172=289≡89(mod100)182=324≡24(mod100)192=361≡61(mod100)202=400≡0(mod100)212=441≡41(mod100)222=484≡84(mod100)232=529≡29(mod100)242=576≡76(mod100) this shows that there are in total there are 25 elements in the list above, 0 is counted two times two many, and 25 is counted once too many therefore there are exactly 22 unique endings in the above, and lets denote the collection of unique last two digits as LD Notice that if we continued we would have 252=625≡25(mod100)262=676≡76(mod100)272=729≡29(mod100)282=784≡84(mod100)292=841≡41(mod100) notice that after 25 the order in which the endings arrive is in a mirrored fashion. Notice that every time a multiple of 25 is reached some special is happening. Specifically we claim that for any n∈ℕ1 and k∈[1,…,24] we have (25n+k)2≡(25n−k)2(mod100) this is clear because (25n+k)2=252n2+50kn+k2 whereas (25n−k)2=252n2−50kn+k2 therefore (25n+k)2−(25n−k)2=100kn≡0(mod100) this fact allows us to show that given any k≥25 that k2 % 100∈LD, we do it by induction based on where it lies with respect to consecutive multiples of 25.

We use the predicate : P(k):∀n∈[25k,…,25k+24],n2 % 100∈LD and show it holds true for all k∈ℕ1

For the base case k=0 then as verified in the huge table we know that for any n∈[0,…24] that n2 % 100∈LD. Now onto the induction step where we assume that P(k) holds true for some k∈ℕ1 and then we prove that P(k+1) hold true, so suppose that n∈[25(k+1),…,25(k+1)+24], in other words n=25(k+1)+j where j∈[0,…,24] if it so happens that j=0 then n=25(k+1) and so when you square it it ends in 25, on the other hand if j∈[1,…,24] then we know that (25(k+1)+j)2≡(25(k+1)−j)2 but 25(k+1)−j=25k+25−j and since j≥1 then by the induction hypothesis 25(k+1)−j % 100∈LD so therefore so is 25(k+1)+j as needed.