ΘρϵηΠατπ

Congruence
Fix an integer m called the modulus, then say ab(modm) if and only if m|ba

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 ab(modm), so we know m|ba, then we can write b=kbm+rb and a=kam+ra so that ba=m(kb+ka)+kbka thus m|kbka.

Notice that 0ka,kb<|m| also we know that kakb therefore kbka0 so then |m|<kbka<|m|

Congruence Commutes
Let a,b,m then ab(modm)ba(modm)
Division iff Congruent Mod 0
Let a,b such that a0, then a|bb0(moda)
a|b if and only if a|b0 iff 0b(moda) iff b0(moda) as needed.
Congruence is Transitive
Let a,b,c,m such that ab(modm) and bc(modm), then we have that ac(modm)
TODO
Sum of Two Congruent Numbers are Congruent
Suppose that ab(modm) and that cd(modm) then we know that a+cb+d(modm)
Product of Two Congruent Numbers is Congruent
Suppose that ab(modm) and that cd(modm) then we know that acbd(modm)

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 5232(mod4) but we can see that 53(mod4) is false.

Congruent Numbers raised to Congruent Powers may not be Congruent
Suppose that ab(modn) and cd(modn), then its NOT true that acbd(modn)
Consider 25(mod3) but then 252 whereas 521 so 25≢52(mod3)
If two Two Numbers are Congruent, they are still Congruent mod a divisor of the Original Mod
Suppose that ab(modn) and m|n then ab(modm)
Since ab(modn) then we know that n|ba but also m|n so that m|ba therefore ab(modm) as needed.

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

If Two Numbers are Congruent Using Two Different Moduli they are Congruent Using the LCM
Suppose that ab(modn) and that ab(modm) then ab(modlcm(n,m))
We have that m,n|ab but the definition of the LCM then states that lcm(n,m)|ab
Switching Prime Powers
Let pq then pq1+qp11(modpq)
FLT tells us that pq11(modq) and qp11(modp) but since p1,q11 then we know that qp10(modq) and pq10(modp) therefore we know that pq1+qp11(modq) and qp1+pq11(modp) since lcm(p,q)=pqgcd(p,q) and we know that pq then gcd(p,q)=1 so that lcm(p,q)=pq then we conclude that pq1+qp11(modpq)
a p q
Suppose that a and that pq, then apqapaq+a0(modpq)
By FLT, we know that apqapaq+a(ap)qapaq+aaqaaq+a=0(modp) and symetrically the same thing occurs mod q therefore apqapaq+a0(modpq)
Division by a Common Factor Maintains Congruence
Suppose that ab(modm) then if k|a,b,m then we have that akbk(modmk)
Recall that akbk(modmk) iff mk|akbk but we know that statement is true because since m|ab and we by linearity we know that k|ab therefore it holds true.
Division by a Common Factor Maintains Congruence if Mod is Divided by GCD
Let a,b,m,k such that k0 and suppose that ab(modm) then if k|a,b then akbk(modmgcd(m,k))

Let g:=gcd(m,k) our goal is to prove that mg|akbk, towards this note that we have ab(modm) which means that m|ab so there is some r such that ab=mr therefore dividing by g0 we have abg=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 k0 then gj0 so j0 thus we divide our previous equation by j to obtain abgj=(mgr)1jabk=(mgr)1j Since k|a,b then k|ab so abk 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 abk=akbk=mgrj where we know the left hand side is an integer, rj is and so is mg therefore mg|akbk so that akbk(modm) as needed.

Multiplicative Cancellation if Mod Prime
Suppose that p is prime and that kakb(modp) and pk then ab(modp)
Since pk 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 m1 x,y[0,m1],(xyx≢y(modm))

Suppose that xy but that xy(modm) for the sake of contradiction, without loss of generality assume that x>y. Since they're congruent we have m|xy but we know that xym10=m1 but if m|xy we have mxym1 so mm1 which is impossible, therefore we must have that x≢y(modm).

Now suppose that x≢y(modm) therefore x % my % m but since x,y[0,,m1] then x=x % m and y=y % m therefore xy as needed.

When a Linear Modular Equation has a Solution
The equation axb(modm) has a solution iff gcd(a,m)|b
Note that axb(modm) iff m|axb so there is some k such that axb=mk so that axmk=b this has a solution iff gcd(a,m)|b
Relatively Prime Modular Equation has a Solution
Suppose that we have the equation: axb(modm) 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: ax1(modm)

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 m1 such that b is invertible mod m and ab then: ab1ab(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 abk(modp)b1akab1ab(modp)
2p Choose p
Prove that (2pp)2(modp)
We have that (2pp)=(p+1)(p+p1)(2p)p!=(p+1)(p+p1)2(p1)! therefore (p+1)(p+p1)2(p1)!amp;(p+1)(p+p1)2[(p1)!]1amp;2(p1)![(p1)!]1amp;2(modp)
Every Non Zero Number is Invertible Mod a Prime
For any p a such that pa there exists b[1,,p1] such that ab1(modp)
Consider the equation ax1(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 axb(modm) 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+(g1)mg when taken mod m

Since it has a solution, we have an x0 such that ax0b(modm), so therefore m|ax0b so that ax0b=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 axb=ym so that m|axb so that axb(modm), therefore we only need to observe the x component of each of solutions obtained from the equation

With this we observe the solutions: x0mg,x0,x0+1mg,x0+2mg,,x0+(g1)mg,x0+gmg=x0+m, and note that for any t such that tg then t=qg+r where r[0,g1] x0+tmg=x0+qm+rgx0+rg(modm) which is to say that it is congruent to a solution of the form x0+jmg where j[0,,g1] 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+(g1)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+lmgx0+pmg(modm) where l,p[0,,g1] and without loss of generality l>p so that m|lmgpmg=mg(lp) since l,p[0,g1] then lpg1 so that mg(lp)<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 24x60(mod102)

First we verify that the above has a solution, since 102=176, then gcd(24,102)=6 and so gcd(24,102)|60, so we deduce that 24x60(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 4x10(mod17) since 17 is prime, then we know that 4 has an inverse, we can see that 4 works, so that x4011(mod17) so our solutions are given by 11+17k for k[0,,5] mod 102

Chinese Remainder
Suppose that for some l1 we have that xci(modmi) 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 (modi=1lmi)

Set M=i=1lmi, then clearly we have that M0(modmi). 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 Mmjx1(modmj), let this solution be denoted by xj.

As just discussed we obtained a solution xj such that Mmjxj1(modmj), in other words Mmjxjcjcj(modmj) 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 Mmj0(modmi) for any ij so that Mmjxjcj0(modmi) as well, with this fact we see that S:=i=1lMmjxjcj has the following property S0+0+cj+0+0cj(modmj) 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 xy(modi=1lmi)

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

111=715+6 therefore 11161(mod7) therefore 1112k+11 so therefore 1113331(mod7).

Now note that 3333(111)3(1)3(mod7), consider the following 31amp;3(mod7)32amp;2(mod7)33amp;1(mod7) therefore (3)3k+i{3amp; if i=12amp; if i=21amp; if i=0 since the sum of the digits of 111=3 then 3|111 and therefore 31111 therefore 111333+3331111+10 therefore 7|111333+333111 as needed.

Alternating Congruence Again
Prove that 39|(53103+10353)
Note that 53=39+14 thus 5314(mod39), looking at 142=(10+4)14=140+56=196, then since 395=(401)5=2005=195 then we see that 196=395+1 so that 1421(mod39) therefore we have that 14k{14amp; if k odd 1amp; if k even  therefore 531031410314. Now we look at 103=239+25 so that 10325 now 252=625 since we see that 1639=16(401)=(400+240)16=64016=624 then 625=1639+1 so that 2521 so we deduce that 25k{25amp; if k odd 1amp; if k even  therefore 10353255325 so then 53103+1035314+25390 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 61amp;6(mod43)62amp;36(mod43)63amp;336130+36216(mod43)

Note that 216=435+1 therefore 631(mod43) 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 7amp;7(mod43)72amp;496(mod43)73amp;67421(mod43)74amp;177(mod43)75amp;7372(1)6(mod43)76amp;7(6)421(mod43) 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)amp;=(1,6,36,1,6,36,)amp;+(1,6,7,1,6,7,)amp;=(0,0,43,0,0,43,) Since xn0(mod43) 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 i5 we see that 15=35|i! therefore we reduce it to (i=1100i!)i=14i!( % 15) But we know that 1!+2!+3!+4!=333( % 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 ax1(modm) therefore by definition m|(1ax) therefore 1ax=km for some k.

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


We have some s,t such that 1=gcd(a,m)=as+mt so that 1as=mt which means that m|1as so that by definition we have that as1(modm) 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,yR, if xy then x≢y(modn)
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,yR x=yxy(modn)
Suppose that x=y therefore we have that xy(modn). Suppose that xy(modn) we want to show that x=y, but if it was that xy then by the definition of complete system of residues we would have x≢y(modn) 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(mod11) for any z[1,9] since 112z and therefore instead there would exist some x,y[0,9] such that xy and that 2x2y(mod11) therefore 11|2x2y and without loss of generality assume that x>y then 2x2y=2y(2xy1), since 11 is prime then 11|2y or 11|2xy1, we know that 11|2y is impossible as noted before so we must have that 11|2xy1.

We'll show that 11|2xy1 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 xy[0,,9] and the smallest integer such that 2k1 is k=10 then 2xy≢1 and thus is in contradiction with the fact that 11|2xy12xy1(mod11). Therefore our assumption is false and so the former is a complete system of residues.


Following a similar thread we note that 3k≢0(mod11) which is impossible by the uniqueness of the prime factorization. We want to find some x,y[0,9] such that 3x3y(mod11) again without loss of generality assume that x>y and therefore we have 11|3x3y=3y(3xy1) since 11 is prime then it divides one of the factors, but as just noted the factor it divides must be 3xy1 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 xy=5 then 11|3xy1 so let y=1 and x=6 therefore 3631(mod11) 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,,n1] there exists some i[1,n] such that rir(modn) Moreover this mapping f:R[0,,n1] is a bijection.
Suppose that for the sake of contradiction that there exists some r[0,,n1] such that no ri was congruent to, then: X={ri % n:i[1,,n]}[0,,n1] therefore we deduce that |X|<n therefore there must exist some i,j[1,,n] such that ij and ri % n=rj % n but that's a contradiction since the ri's are pairwise incongruent therefore it must be that X=[0,,n1] therefore for any r[0,,n1] there exists some rjX such that rjr(modn)

As per the statement the above mapping is denoted by f:R[0,,n] what we've shown is that im(f)=[0,,n1] 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,arjA such that ij, since R is a complete system of residues, we know that ri≢rj(modn), now suppose for the sake of contradiction that ariarj(modn), then since gcd(a,n)=1 we have rirj(modn1) which is a contradiction, therefore we must have ari≢arj(modn) 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=1n1ri(n1)!(modn)
Recall that there is a unique r[0,,n1] for each ri such that rir. In this case since we've removed rn then there is a unique r[1,,n1], let this mapping be denoted as f:R[1,,n] since it is a bijection then we note that i=1n1riamp;i=1n1f(ri)amp;i=1n1iamp;(n1)! as needed.
There are 22 Possibilities for the Last Two Digits of a Square
As per title.
We compute 02=0amp;0(mod100)12=1amp;1(mod100)22=4amp;4(mod100)32=9amp;9(mod100)42=16amp;16(mod100)52=25amp;25(mod100)62=36amp;36(mod100)72=49amp;49(mod100)82=64amp;64(mod100)92=81amp;81(mod100)102=100amp;0(mod100)112=121amp;21(mod100)122=144amp;44(mod100)132=169amp;69(mod100)142=196amp;96(mod100)152=225amp;25(mod100)162=256amp;56(mod100)172=289amp;89(mod100)182=324amp;24(mod100)192=361amp;61(mod100)202=400amp;0(mod100)212=441amp;41(mod100)222=484amp;84(mod100)232=529amp;29(mod100)242=576amp;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=625amp;25(mod100)262=676amp;76(mod100)272=729amp;29(mod100)282=784amp;84(mod100)292=841amp;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 n1 and k[1,,24] we have (25n+k)2(25nk)2(mod100) this is clear because (25n+k)2=252n2+50kn+k2 whereas (25nk)2=252n250kn+k2 therefore (25n+k)2(25nk)2=100kn0(mod100) this fact allows us to show that given any k25 that k2 % 100LD, 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 % 100LD and show it holds true for all k1

For the base case k=0 then as verified in the huge table we know that for any n[0,24] that n2 % 100LD. Now onto the induction step where we assume that P(k) holds true for some k1 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+25j and since j1 then by the induction hypothesis 25(k+1)j % 100LD so therefore so is 25(k+1)+j as needed.