Skip to content

Number Theory

1. Divisibility

1.1 The Division Algorithm

Theorem 1.1 (Division Algorithm). For any integers aa and bb with b>0b > 0There exist unique Integers qq and rr such that a=bq+ra = bq + r with 0r<b0 \leq r \lt b.

Proof. Consider the set S=abk:kZ, abk0S = \\{a - bk : k \in \mathbb{Z},\ a - bk \geq 0\\}. This set is non-empty (by the Archimedean property, choosing kk sufficiently negative). By the well-ordering principle, SS has a least element r=abqr = a - bq. If rbr \geq bThen rb=a(q+1)bSr - b = a - (q+1)b \in S with rb<rr - b \lt rContradicting minimality. So 0r<b0 \leq r \lt b. For uniqueness, if a=bq1+r1=bq2+r2a = bq_1 + r_1 = bq_2 + r_2Then b(q1q2)=r2r1b(q_1 - q_2) = r_2 - r_1. Since r2r1<b|r_2 - r_1| \lt bWe must Have q1=q2q_1 = q_2 and r1=r2r_1 = r_2. \blacksquare

1.2 Divisibility

We write dad \mid a (read ”dd divides aa”) if there exists kZk \in \mathbb{Z} with a=dka = dk.

Proposition 1.2. For all a,b,cZa, b, c \in \mathbb{Z}:

  1. If aba \mid b and bcb \mid cThen aca \mid c.
  2. If aba \mid b and aca \mid cThen a(mb+nc)a \mid (mb + nc) for all m,nZm, n \in \mathbb{Z}.
  3. If aba \mid b and b0b \neq 0Then ab|a| \leq |b|.
  4. a0a \mid 0 for all aaBut 0a0 \mid a only when a=0a = 0.

Proof. (1) aba \mid b means b=akb = ak and bcb \mid c means c=b=akc = b\ell = ak\ellSo aca \mid c. (2) aba \mid b means b=akb = ak and aca \mid c means c=ac = a\ellSo mb+nc=a(mk+n)mb + nc = a(mk + n\ell). (3) aba \mid b means b=akb = akSo b=aka|b| = |a| \cdot |k| \geq |a|. (4) 0=a00 = a \cdot 0So a0a \mid 0. If 0a0 \mid aThen a=0k=0a = 0 \cdot k = 0. \blacksquare

1.3 Worked Examples of the Division Algorithm

Problem. Apply the division algorithm to write 237=14q+r-237 = 14q + r with 0r<140 \leq r \lt 14.

Solution

We compute 237÷14=16.93237 \div 14 = 16.93\ldotsSo 1416=22414 \cdot 16 = 224 and 1417=238>23714 \cdot 17 = 238 > 237. Thus for positive 237237: q=16q = 16, r=13r = 13Giving 237=1416+13237 = 14 \cdot 16 + 13.

For a=237a = -237: we need qq such that r=23714qr = -237 - 14q satisfies 0r<140 \leq r \lt 14. 237=14(17)+1-237 = 14(-17) + 1: check 14(17)=23814 \cdot (-17) = -238And 238+1=237-238 + 1 = -237. Here q=17q = -17 and r=1r = 1 with 01<140 \leq 1 \lt 14. \blacksquare

Problem. Find all integers nn such that n3(mod7)n \equiv 3 \pmod{7} and n2(mod5)n \equiv 2 \pmod{5}.

Solution

From n3(mod7)n \equiv 3 \pmod{7}We have n=7k+3n = 7k + 3 for some kZk \in \mathbb{Z}. Substituting into n2(mod5)n \equiv 2 \pmod{5}: 7k+32(mod5)7k + 3 \equiv 2 \pmod{5}So 7k14(mod5)7k \equiv -1 \equiv 4 \pmod{5}Giving 2k4(mod5)2k \equiv 4 \pmod{5}Hence k2(mod5)k \equiv 2 \pmod{5}.

So k=5m+2k = 5m + 2And n=7(5m+2)+3=35m+17n = 7(5m + 2) + 3 = 35m + 17. The solutions are n17(mod35)n \equiv 17 \pmod{35}. \blacksquare

1.4 Uniqueness of the Greatest Common Divisor

Theorem 1.3. Let a,bZa, b \in \mathbb{Z}Not both zero. The greatest common divisor of aa and bb Exists and is unique.

Proof. The set D=dN:da and db"D = \\{d \in \mathbb{N} : d \mid a \mathrm{\ and\ } d \mid b\\}" is non-empty since aD|a| \in D (if a0a \neq 0) or bD|b| \in D (if b0b \neq 0). By the well-ordering principle, DD has A least element gg. We claim g=gcd(a,b)g = \gcd(a, b). By definition gag \mid a and gbg \mid b. If cac \mid a And cbc \mid bThen ccgc \leq |c| \leq g (since gg is the least positive common divisor). For Uniqueness: if g1g_1 and g2g_2 are both greatest common divisors, then g1g2g_1 \mid g_2 and g2g1g_2 \mid g_1 So g1=g2g_1 = g_2 (since both are positive). \blacksquare ### 1.5 Least Common Multiple Definition. The least common multiple of positive integers aa and bbWritten lcm(a,b)\mathrm{lcm}(a, b)Is the smallest positive integer mm such that ama \mid m and bmb \mid m. Theorem 1.4 (GCD—LCM Identity). For all positive integers aa and bb gcd(a,b)lcm(a,b)=ab\gcd(a, b) \cdot \mathrm{lcm}(a, b) = ab Proof. Write a=i=1kpiαia = \prod_{i=1}^k p_i^{\alpha_i} and b=i=1kpiβib = \prod_{i=1}^k p_i^{\beta_i} where αi,βi0\alpha_i, \beta_i \geq 0. Then gcd(a,b)=i=1kpimin(αi,βi)\gcd(a, b) = \prod_{i=1}^k p_i^{\min(\alpha_i, \beta_i)} and lcm(a,b)=i=1kpimax(αi,βi)\mathrm{lcm}(a, b) = \prod_{i=1}^k p_i^{\max(\alpha_i, \beta_i)}. Since min(αi,βi)+max(αi,βi)=αi+βi\min(\alpha_i, \beta_i) + \max(\alpha_i, \beta_i) = \alpha_i + \beta_i for each iiWe have gcd(a,b)lcm(a,b)=i=1kpiαi+βi=ab\gcd(a,b) \cdot \mathrm{lcm}(a,b) = \prod_{i=1}^k p_i^{\alpha_i + \beta_i} = ab \qquad \blacksquare Proposition 1.5. For all positive integers a,ba, b: 1. lcm(a,b)=ab/gcd(a,b)\mathrm{lcm}(a, b) = ab / \gcd(a, b). 2. gcd(a,lcm(b,c))=lcm(gcd(a,b),gcd(a,c))\gcd(a, \mathrm{lcm}(b, c)) = \mathrm{lcm}(\gcd(a, b), \gcd(a, c)). ### 1.6 Worked Example: LCM Computation Problem. Compute lcm(252,105)\mathrm{lcm}(252, 105) and verify the gcd—lcm identity.

SolutionFirst, gcd(252,105)\gcd(252, 105). Using the Euclidean algorithm: 252=2105+42252 = 2 \cdot 105 + 42, 105=242+21105 = 2 \cdot 42 + 21, 42=221+042 = 2 \cdot 21 + 0. So gcd(252,105)=21\gcd(252, 105) = 21. By the identity: lcm(252,105)=252105/21=2525=1260\mathrm{lcm}(252, 105) = 252 \cdot 105 / 21 = 252 \cdot 5 = 1260. Verification: 1260/252=51260 / 252 = 5 and 1260/105=121260 / 105 = 12Both integers. \blacksquare
## 2. The Greatest Common Divisor ### 2.1 Definition and Existence Definition. The greatest common divisor of aa and bb (not both zero) is the largest Positive integer dd such that dad \mid a and dbd \mid b. We write d=gcd(a,b)d = \gcd(a, b). Theorem 2.1 (Bézout”s Identity). For any a,bZa, b \in \mathbb{Z} not both zero, there exist x,yZx, y \in \mathbb{Z} such that gcd(a,b)=ax+by\gcd(a, b) = ax + by Proof. Let S=ax+by:x,yZ, ax+by>0S = \\{ax + by : x, y \in \mathbb{Z},\ ax + by > 0\\}. By the well-ordering principle, SS has a least element d=ax0+by0d = ax_0 + by_0. We show d=gcd(a,b)d = \gcd(a, b). First, dad \mid a: write a=dq+ra = dq + r with 0r<d0 \leq r \lt d. Then r=adq=a(ax0+by0)q=a(1x0q)+b(y0q)r = a - dq = a - (ax_0 + by_0)q = a(1 - x_0 q) + b(-y_0 q). If r>0r > 0Then rSr \in S with r<dr \lt dContradicting minimality. So r=0r = 0Giving dad \mid a. Similarly dbd \mid b. For any Common divisor cc of aa and bb: c(ax0+by0)=dc \mid (ax_0 + by_0) = dSo cdc \leq d. \blacksquare ### 2.2 The Euclidean Algorithm To compute gcd(a,b)\gcd(a, b) with ab>0a \geq b > 0: a=bq1+r1,0<r1<ba = bq_1 + r_1, \quad 0 \lt r_1 \lt b b=r1q2+r2,0<r2<r1b = r_1 q_2 + r_2, \quad 0 \lt r_2 \lt r_1 \vdots rn1=rnqn+1+0r_{n-1} = r_n q_{n+1} + 0 Then gcd(a,b)=rn\gcd(a, b) = r_n. The algorithm terminates because b>r1>r2>0b > r_1 > r_2 > \cdots \geq 0. Proposition 2.2. gcd(a,b)=gcd(b,r)\gcd(a, b) = \gcd(b, r) where r=amodbr = a \bmod b. Proof. Write a=bq+ra = bq + r. If dad \mid a and dbd \mid bThen d(abq)=rd \mid (a - bq) = r. Conversely, if dbd \mid b and drd \mid rThen d(bq+r)=ad \mid (bq + r) = a. So the set of common Divisors of (a,b)(a, b) equals the set of common divisors of (b,r)(b, r)Hence their greatest Common divisors are equal. \blacksquare ### 2.3 The Extended Euclidean Algorithm The extended Euclidean algorithm computes gcd(a,b)\gcd(a, b) and finds integers x,yx, y such that ax+by=gcd(a,b)ax + by = \gcd(a, b) simultaneously by back-substituting through the Euclidean algorithm steps. Problem. Find gcd(252,105)\gcd(252, 105) and express it as a linear combination of 252252 and 105105.
SolutionWe perform the Euclidean algorithm and back-substitute: 252=2105+4242=2522105252 = 2 \cdot 105 + 42 \quad \Rightarrow \quad 42 = 252 - 2 \cdot 105 105=242+2121=105242105 = 2 \cdot 42 + 21 \quad \Rightarrow \quad 21 = 105 - 2 \cdot 42 42=221+042 = 2 \cdot 21 + 0 So gcd(252,105)=21\gcd(252, 105) = 21. Back-substituting: 21=1052(2522105)=1052252+4105=5105225221 = 105 - 2(252 - 2 \cdot 105) = 105 - 2 \cdot 252 + 4 \cdot 105 = 5 \cdot 105 - 2 \cdot 252 Verification: 51052252=525504=215 \cdot 105 - 2 \cdot 252 = 525 - 504 = 21. \blacksquare
Problem. Find integers x,yx, y such that 1073x+313y=gcd(1073,313)1073x + 313y = \gcd(1073, 313).
SolutionEuclidean algorithm: 1073=3313+1341073 = 3 \cdot 313 + 134 313=2134+45313 = 2 \cdot 134 + 45 134=245+44134 = 2 \cdot 45 + 44 45=144+145 = 1 \cdot 44 + 1 44=441+044 = 44 \cdot 1 + 0 So gcd(1073,313)=1\gcd(1073, 313) = 1. Back-substituting from 1=45441 = 45 - 44: 44=13424544 = 134 - 2 \cdot 45So 1=45(134245)=3451341 = 45 - (134 - 2 \cdot 45) = 3 \cdot 45 - 134 45=313213445 = 313 - 2 \cdot 134So 1=3(3132134)134=331371341 = 3(313 - 2 \cdot 134) - 134 = 3 \cdot 313 - 7 \cdot 134 134=10733313134 = 1073 - 3 \cdot 313So 1=33137(10733313)=24313710731 = 3 \cdot 313 - 7(1073 - 3 \cdot 313) = 24 \cdot 313 - 7 \cdot 1073 Therefore x=7x = -7 and y=24y = 24: (7)(1073)+24(313)=7511+7512=1(-7)(1073) + 24(313) = -7511 + 7512 = 1. \blacksquare
### 2.4 Coprime Integers Integers aa and bb are coprime (or relatively prime) if gcd(a,b)=1\gcd(a, b) = 1. Proposition 2.3 (Euclid’s Lemma). If pp is prime and pabp \mid abThen pap \mid a or pbp \mid b. Proof. If pap \nmid aThen gcd(p,a)=1\gcd(p, a) = 1. By Bézout’s identity, 1=px+ay1 = px + ay for some x,yZx, y \in \mathbb{Z}. Multiplying by bb: b=pbx+abyb = pbx + aby. Since pabyp \mid abyWe get pbp \mid b. \blacksquare Corollary 2.4. If pp is prime and pa1a2anp \mid a_1 a_2 \cdots a_nThen paip \mid a_i for some ii. Proposition 2.5. If gcd(a,b)=1\gcd(a, b) = 1 and abca \mid bcThen aca \mid c. Proof. Since gcd(a,b)=1\gcd(a, b) = 1By Bézout’s identity there exist x,yx, y with ax+by=1ax + by = 1. Multiplying by cc: acx+bcy=cacx + bcy = c. Since abca \mid bcWe have abcya \mid bcyAnd aacxa \mid acx So aca \mid c. \blacksquare Proposition 2.6. If gcd(a,b)=1\gcd(a, b) = 1 and gcd(a,c)=1\gcd(a, c) = 1Then gcd(a,bc)=1\gcd(a, bc) = 1. Proof. By Bézout, ax1+by1=1ax_1 + by_1 = 1 and ax2+cz2=1ax_2 + cz_2 = 1. Multiplying: (ax1+by1)(ax2+cz2)=a(ax1x2+x1cz2+by1x2)+(by1)(cz2)=1(ax_1 + by_1)(ax_2 + cz_2) = a(ax_1 x_2 + x_1 c z_2 + by_1 x_2) + (by_1)(cz_2) = 1. This expresses 11 as a linear combination of aa and bcbcSo gcd(a,bc)=1\gcd(a, bc) = 1. \blacksquare ## 3. Prime Numbers ### 3.1 The Fundamental Theorem of Arithmetic Theorem 3.1 (Fundamental Theorem of Arithmetic). Every integer n>1n > 1 can be written uniquely (including order) as a product of primes: n=p1a1p2a2pkakn = p_1^{a_1} p_2^{a_2} \cdots p_k^{a_k} Where p1<p2<<pkp_1 \lt p_2 \lt \cdots \lt p_k are primes and ai1a_i \geq 1. Proof (existence). Suppose for contradiction that some integer n>1n > 1 cannot be factored into Primes. Let nn be the smallest such integer. If nn is prime, we are done. Otherwise n=abn = ab with 1<a,b<n1 \lt a, b \lt n. By minimality of nnBoth aa and bb factor into primes, so n=abn = ab also Factors into primes, a contradiction. \blacksquare Proof (uniqueness). Suppose n=p1pr=q1qsn = p_1 \cdots p_r = q_1 \cdots q_s where all pi,qjp_i, q_j are prime. Since p1q1qsp_1 \mid q_1 \cdots q_sBy Euclid’s lemma (applied inductively), p1qjp_1 \mid q_j for some jj. Since qjq_j is prime, p1=qjp_1 = q_j. Cancel to get p2pr=q1q^jqsp_2 \cdots p_r = q_1 \cdots \hat{q}_j \cdots q_s. Continue by induction. \blacksquare ### 3.2 The Infinitude of Primes Theorem 3.2 (Euclid). There are infinitely many primes. Proof. Suppose p1,p2,,pnp_1, p_2, \ldots, p_n is a complete list of all primes. Consider N=p1p2pn+1N = p_1 p_2 \cdots p_n + 1. Then N>1N > 1So by the fundamental theorem, NN has a prime divisor pp. But pNp \mid N and pp1pnp \mid p_1 \cdots p_n implies p(Np1pn)=1p \mid (N - p_1 \cdots p_n) = 1Which is Impossible. Contradiction. \blacksquare ### 3.3 The Prime Number Theorem Theorem 3.3 (Prime Number Theorem). Let π(x)\pi(x) denote the number of primes x\leq x. Then limxπ(x)x/lnx=1\lim_{x \to \infty} \frac{\pi(x)}{x / \ln x} = 1 This tells us that primes thin out as numbers grow larger, with the density near xx being Approximately 1/lnx1/\ln x. Proposition 3.3a (Chebyshev estimates). There exist positive constants c1,c2c_1, c_2 such that c1xlnxπ(x)c2xlnxc_1 \frac{x}{\ln x} \leq \pi(x) \leq c_2 \frac{x}{\ln x} For all sufficiently large xx. Intuition. Chebyshev proved π(x)=O(x/lnx)\pi(x) = O(x/\ln x) and π(x)=Ω(x/lnx)\pi(x) = \Omega(x/\ln x) using properties Of the binomial coefficient (2nn)\binom{2n}{n}. The prime number theorem strengthens this to π(x)x/lnx\pi(x) \sim x/\ln x. Proposition 3.3b. For n2n \geq 2The nn-th prime pnp_n satisfies nlnn<pn<2nlnnn \ln n \lt p_n \lt 2n \ln n. This follows from the prime number theorem and the estimate π(x)x/lnx\pi(x) \sim x/\ln x. ### 3.4 Worked Examples of Prime Factorization Problem. Find the prime factorization of N=2016N = 2016 and determine σ(2016)\sigma(2016) and τ(2016)\tau(2016).
Solution2016=21008=22504=23252=24126=2563=2579=253272016 = 2 \cdot 1008 = 2^2 \cdot 504 = 2^3 \cdot 252 = 2^4 \cdot 126 = 2^5 \cdot 63 = 2^5 \cdot 7 \cdot 9 = 2^5 \cdot 3^2 \cdot 7. So 2016=2532712016 = 2^5 \cdot 3^2 \cdot 7^1. τ(2016)=(5+1)(2+1)(1+1)=632=36\tau(2016) = (5+1)(2+1)(1+1) = 6 \cdot 3 \cdot 2 = 36. σ(2016)=261213313172171=63138=6552\sigma(2016) = \frac{2^6 - 1}{2-1} \cdot \frac{3^3 - 1}{3-1} \cdot \frac{7^2 - 1}{7-1} = 63 \cdot 13 \cdot 8 = 6552. \blacksquare
Problem. Prove that 2\sqrt{2} is irrational using the fundamental theorem of arithmetic.
SolutionSuppose 2=a/b\sqrt{2} = a/b where a,bNa, b \in \mathbb{N} with gcd(a,b)=1\gcd(a, b) = 1. Then 2b2=a22b^2 = a^2 So 2a22 \mid a^2Hence 2a2 \mid a. Write a=2ca = 2c. Then 2b2=4c22b^2 = 4c^2So b2=2c2b^2 = 2c^2Giving 2b22 \mid b^2 and hence 2b2 \mid b. But then 2gcd(a,b)=12 \mid \gcd(a, b) = 1Contradiction. \blacksquare
### 3.5 The Sieve of Eratosthenes The Sieve of Eratosthenes is an ancient algorithm for finding all primes up to a given bound NN. Algorithm. Start with the list 2,3,4,,N\\{2, 3, 4, \ldots, N\\}. For each prime pNp \leq \sqrt{N}Mark All multiples of pp (starting from p2p^2) as composite. The remaining unmarked numbers are prime. Proposition 3.4. The sieve of Eratosthenes correctly identifies all primes up to NN in O(NloglogN)O(N \log \log N) arithmetic operations. Proof. Every composite nNn \leq N has a prime factor pnNp \leq \sqrt{n} \leq \sqrt{N}. When the sieve Reaches this prime ppIt marks nn as composite (since n=pmn = p \cdot m with mpm \geq pSo np2n \geq p^2 and nn is a multiple of pp at least p2p^2). Conversely, no prime is ever marked since The only multiples of pp marked are kpkp for k2k \geq 2. \blacksquare Problem. Use the sieve of Eratosthenes to find all primes up to 5050.
SolutionStart with 2,3,4,,50\\{2, 3, 4, \ldots, 50\\}. Mark multiples of 22 (from 44): remove 4,6,8,10,,504, 6, 8, 10, \ldots, 50. Mark multiples of 33 (from 99): remove 9,12,15,18,,489, 12, 15, 18, \ldots, 48. Mark multiples of 55 (from 2525): remove 25,30,35,40,4525, 30, 35, 40, 45. Mark multiples of 77 (from 4949): remove 4949. We stop at 50=7\lfloor\sqrt{50}\rfloor = 7. The primes up to 5050 are: 2,3,5,7,11,13,17,19,23,29,31,37,41,43,472, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47. \blacksquare
### 3.6 Bertrand’s Postulate Theorem 3.5 (Bertrand’s Postulate, Chebyshev 1852). For every integer n>1n > 1There exists at Least one prime pp with n<p<2nn \lt p \lt 2n. Proof (sketch). Let θ(x)=pxlnp\theta(x) = \sum_{p \leq x} \ln p (Chebyshev’s function). The …/1-number-and-algebra/3_proof-and-logic proceeds In three main steps: 1. Show θ(n)<2nln2\theta(n) \lt 2n \ln 2 for all n1n \geq 1 by induction using properties of binomial coefficients. Specifically, (2nn)\binom{2n}{n} is divisible by every prime pp with n<p2nn \lt p \leq 2n and (2nn)4n\binom{2n}{n} \leq 4^nSo n<p2np4n\prod_{n \lt p \leq 2n} p \leq 4^n. 2. Strengthen the bound to show that if no prime pp satisfies n<p2nn \lt p \leq 2nThen θ(2n)=θ(n)\theta(2n) = \theta(n)Leading to a contradiction with the bound for sufficiently large nn. 3. The remaining small values of nn are checked directly. \blacksquare Remark. This was famously conjectured by Bertrand in 1845 and proved by Chebyshev in 1852. Erdős published an elegant …/1-number-and-algebra/3_proof-and-logic in 1932. Problem. Verify Bertrand’s postulate for n=20n = 20: find a prime pp with 20<p<4020 \lt p \lt 40.
SolutionThe primes in the range (20,40)(20, 40) are: 23,29,31,3723, 29, 31, 37. There are four such primes, Confirming the postulate. \blacksquare
Remark. Bertrand’s postulate has been significantly strengthened. The prime number theorem Implies that for large nnThere are approximately n/lnnn/\ln n primes between nn and 2n2n. ## 4. Congruences ### 4.1 Basic Properties We write ab(modm)a \equiv b \pmod{m} (read ”aa is congruent to bb modulo mm”) if m(ab)m \mid (a - b). Proposition 4.1. Congruence modulo mm is an equivalence relation on Z\mathbb{Z}. Proposition 4.2. If ab(modm)a \equiv b \pmod{m} and cd(modm)c \equiv d \pmod{m}Then: 1. a+cb+d(modm)a + c \equiv b + d \pmod{m}. 2. acbd(modm)ac \equiv bd \pmod{m}. 3. anbn(modm)a^n \equiv b^n \pmod{m} for all n1n \geq 1. Proposition 4.3. If acbc(modm)ac \equiv bc \pmod{m} and gcd(c,m)=d\gcd(c, m) = dThen ab(modm/d)a \equiv b \pmod{m/d}. In particular, if gcd(c,m)=1\gcd(c, m) = 1We can cancel: ab(modm)a \equiv b \pmod{m}. ### 4.2 Solving Linear Congruences Theorem 4.4. The congruence axb(modm)ax \equiv b \pmod{m} has a solution if and only if gcd(a,m)b\gcd(a, m) \mid b. When solutions exist, there are exactly gcd(a,m)\gcd(a, m) incongruent solutions Modulo mm. Proof. axb(modm)ax \equiv b \pmod{m} is equivalent to axmy=bax - my = b for some yZy \in \mathbb{Z}. By Bézout’s identity, solutions exist iff gcd(a,m)b\gcd(a, m) \mid b. If d=gcd(a,m)d = \gcd(a, m) and x0x_0 is one Solution, then x0+k(m/d)x_0 + k(m/d) for k=0,1,,d1k = 0, 1, \ldots, d-1 gives dd incongruent solutions modulo mm. \blacksquare ### 4.3 Worked Example Problem. Solve 14x6(mod33)14x \equiv 6 \pmod{33}. Solution. gcd(14,33)=1\gcd(14, 33) = 1So a unique solution exists. Using the extended Euclidean algorithm: 33=214+533 = 2 \cdot 14 + 5, 14=25+414 = 2 \cdot 5 + 4, 5=14+15 = 1 \cdot 4 + 1. Back-substituting: 1=54=5(1425)=3514=3(33214)14=3337141 = 5 - 4 = 5 - (14 - 2 \cdot 5) = 3 \cdot 5 - 14 = 3(33 - 2 \cdot 14) - 14 = 3 \cdot 33 - 7 \cdot 14. So 14(7)1(mod33)14(-7) \equiv 1 \pmod{33}Giving x4224(mod33)x \equiv -42 \equiv 24 \pmod{33}. \blacksquare ### 4.4 Additional Properties of Congruences Proposition 4.5. For any a,b,mZa, b, m \in \mathbb{Z} with m>0m > 0: 1. ab(modm)a \equiv b \pmod{m} if and only if aa and bb leave the same remainder when divided by mm. 2. If ab(modm)a \equiv b \pmod{m} and dmd \mid mThen ab(modd)a \equiv b \pmod{d}. 3. If ab(modmi)a \equiv b \pmod{m_i} for i=1,,ki = 1, \ldots, kThen ab(modlcm(m1,,mk))a \equiv b \pmod{\mathrm{lcm}(m_1, \ldots, m_k)}. Proof of (1). Write a=mq1+r1a = mq_1 + r_1 and b=mq2+r2b = mq_2 + r_2 with 0r1,r2<m0 \leq r_1, r_2 \lt m. Then ab=m(q1q2)+(r1r2)a - b = m(q_1 - q_2) + (r_1 - r_2). So m(ab)m \mid (a - b) iff m(r1r2)m \mid (r_1 - r_2)Which Happens iff r1=r2r_1 = r_2 (since r1r2<m|r_1 - r_2| \lt m). \blacksquare Proof of (2). m(ab)m \mid (a - b) and dmd \mid mSo d(ab)d \mid (a - b). \blacksquare Proof of (3). We have mi(ab)m_i \mid (a - b) for each iiSo lcm(m1,,mk)(ab)\mathrm{lcm}(m_1, \ldots, m_k) \mid (a-b) By definition of the lcm. Hence ab(modlcm(m1,,mk))a \equiv b \pmod{\mathrm{lcm}(m_1, \ldots, m_k)}. \blacksquare Proposition 4.6. If ab(modm)a \equiv b \pmod{m} and f(x)=ckxk++c1x+c0f(x) = c_k x^k + \cdots + c_1 x + c_0 is a Polynomial with integer coefficients, then f(a)f(b)(modm)f(a) \equiv f(b) \pmod{m}. Proof. By Proposition 4.2, ajbj(modm)a^j \equiv b^j \pmod{m} for all j0j \geq 0And cjajcjbj(modm)c_j a^j \equiv c_j b^j \pmod{m}. Summing over jj gives the result. \blacksquare Corollary 4.6a. If ab(modm)a \equiv b \pmod{m}Then akbk(modm)a^k \equiv b^k \pmod{m} for all k0k \geq 0. In Particular, the last dd digits of aa and bb (in base 1010) determine the last dd digits of aka^k And bkb^k. ### 4.5 More Worked Examples Problem. Solve 12x9(mod15)12x \equiv 9 \pmod{15}.
Solutiongcd(12,15)=3\gcd(12, 15) = 3And 393 \mid 9So solutions exist. There are exactly 33 incongruent Solutions modulo 1515. Divide through by 33: 4x3(mod5)4x \equiv 3 \pmod{5}. Now gcd(4,5)=1\gcd(4, 5) = 1So 4x3(mod5)4x \equiv 3 \pmod{5} Gives x413(mod5)x \equiv 4^{-1} \cdot 3 \pmod{5}. Since 44=161(mod5)4 \cdot 4 = 16 \equiv 1 \pmod{5}We get x43=122(mod5)x \equiv 4 \cdot 3 = 12 \equiv 2 \pmod{5}. The solutions modulo 1515 are x2,7,12(mod15)x \equiv 2, 7, 12 \pmod{15}. \blacksquare
Problem. Find the last two digits of 719477^{1947}.
SolutionWe need 71947mod1007^{1947} \bmod 100. Since ϕ(100)=ϕ(4)ϕ(25)=220=40\phi(100) = \phi(4)\phi(25) = 2 \cdot 20 = 40 and gcd(7,100)=1\gcd(7, 100) = 1Euler’s theorem gives 7401(mod100)7^{40} \equiv 1 \pmod{100}. 1947=4840+271947 = 48 \cdot 40 + 27So 71947=(740)48727727(mod100)7^{1947} = (7^{40})^{48} \cdot 7^{27} \equiv 7^{27} \pmod{100}. 72=497^2 = 49, 74=24011(mod100)7^4 = 2401 \equiv 1 \pmod{100}. So 727=(74)6731634343(mod100)7^{27} = (7^4)^6 \cdot 7^3 \equiv 1^6 \cdot 343 \equiv 43 \pmod{100}. The last two digits of 719477^{1947} are 4343. \blacksquare
### 4.6 Wilson’s Theorem Theorem 4.7 (Wilson’s Theorem). An integer p2p \geq 2 is prime if and only if (p1)!1(modp)(p - 1)! \equiv -1 \pmod{p} Proof. (\Rightarrow) Suppose pp is prime. In (Z/pZ)(\mathbb{Z}/p\mathbb{Z})^*Every element aa has a Unique multiplicative inverse a1a^{-1}. The elements 11 and p1p - 1 are self-inverse since 1111 \cdot 1 \equiv 1 and (p1)2=p22p+11(modp)(p-1)^2 = p^2 - 2p + 1 \equiv 1 \pmod{p}. For 2ap22 \leq a \leq p-2We have aa1a \neq a^{-1} (if a21a^2 \equiv 1Then p(a1)(a+1)p \mid (a-1)(a+1)So p(a1)p \mid (a-1) or p(a+1)p \mid (a+1) Giving a1a \equiv 1 or ap1a \equiv p-1). Thus the elements 2,3,,p2\\{2, 3, \ldots, p-2\\} pair up into (p3)/2(p-3)/2 pairs of mutually inverse elements. The product of all elements in each pair is 11 modulo ppSo (p1)!=1(p1)a=2p2a1(p1)1(p3)/21(modp)(p-1)! = 1 \cdot (p-1) \prod_{a=2}^{p-2} a \equiv 1 \cdot (p-1) \cdot 1^{(p-3)/2} \equiv -1 \pmod{p} (\Leftarrow) If n2n \geq 2 is composite, then n=abn = ab with 1<ab<n1 \lt a \leq b \lt n. If aba \neq b Both aa and bb appear in (n1)!(n-1)!So n(n1)!n \mid (n-1)! and (n1)!0(modn)(n-1)! \equiv 0 \pmod{n}. If a=ba = b (i.e., n=a2n = a^2), then n>4n > 4 implies a>2a > 2And both aa and 2a<a2=n2a \lt a^2 = n appear in (n1)!(n-1)!So again (n1)!0(modn)(n-1)! \equiv 0 \pmod{n}. The case n=4n = 4 gives 3!=62(mod4)13! = 6 \equiv 2 \pmod{4} \neq -1. \blacksquare Problem. Use Wilson’s theorem to find 8!mod118! \bmod 11.
SolutionBy Wilson’s theorem, (111)!=10!1(mod11)(11 - 1)! = 10! \equiv -1 \pmod{11}. 10!=1098!10! = 10 \cdot 9 \cdot 8!So 1098!1(mod11)10 \cdot 9 \cdot 8! \equiv -1 \pmod{11}. 902(mod11)90 \equiv 2 \pmod{11}So 28!1(mod11)2 \cdot 8! \equiv -1 \pmod{11}. Multiplying by 66 (the inverse of 22 mod 1111): 8!65(mod11)8! \equiv -6 \equiv 5 \pmod{11}. \blacksquare
## 5. The Chinese Remainder Theorem ### 5.1 Statement and Proof Theorem 5.1 (Chinese Remainder Theorem). Let m1,m2,,mkm_1, m_2, \ldots, m_k be pairwise coprime Positive integers. Then for any integers a1,a2,,aka_1, a_2, \ldots, a_kThe system of congruences xai(modmi),i=1,2,,kx \equiv a_i \pmod{m_i}, \quad i = 1, 2, \ldots, k Has a unique solution modulo M=m1m2mkM = m_1 m_2 \cdots m_k. Proof. Let Mi=M/miM_i = M/m_i. Since gcd(mi,Mi)=1\gcd(m_i, M_i) = 1There exist bib_i with biMi1(modmi)b_i M_i \equiv 1 \pmod{m_i} (by Bézout). Set x=i=1kaibiMix = \sum_{i=1}^k a_i b_i M_i. Then xaibiMiai1ai(modmi)x \equiv a_i b_i M_i \equiv a_i \cdot 1 \equiv a_i \pmod{m_i} since Mj0(modmi)M_j \equiv 0 \pmod{m_i} for jij \neq i. For uniqueness: if xx and xx' are both solutions, then xxx - x' is divisible by each mim_iHence by MMSo xx(modM)x \equiv x' \pmod{M}. \blacksquare ### 5.2 Worked Example Problem. Solve x2(mod3)x \equiv 2 \pmod{3}, x3(mod5)x \equiv 3 \pmod{5}, x2(mod7)x \equiv 2 \pmod{7}. Solution. M=357=105M = 3 \cdot 5 \cdot 7 = 105. M1=35M_1 = 35, M2=21M_2 = 21, M3=15M_3 = 15. 352=701(mod3)35 \cdot 2 = 70 \equiv 1 \pmod{3}So b1=2b_1 = 2. 211=211(mod5)21 \cdot 1 = 21 \equiv 1 \pmod{5}So b2=1b_2 = 1. 151=151(mod7)15 \cdot 1 = 15 \equiv 1 \pmod{7}So b3=1b_3 = 1. x=2235+3121+2115=140+63+30=23323(mod105)x = 2 \cdot 2 \cdot 35 + 3 \cdot 1 \cdot 21 + 2 \cdot 1 \cdot 15 = 140 + 63 + 30 = 233 \equiv 23 \pmod{105}. Verification: 23=73+22(mod3)23 = 7 \cdot 3 + 2 \equiv 2 \pmod{3}. 23=45+33(mod5)23 = 4 \cdot 5 + 3 \equiv 3 \pmod{5}. 23=37+22(mod7)23 = 3 \cdot 7 + 2 \equiv 2 \pmod{7}. \blacksquare ### 5.3 More Worked Examples Problem. Solve the system: x3(mod7)x \equiv 3 \pmod{7}, x5(mod11)x \equiv 5 \pmod{11}, x2(mod13)x \equiv 2 \pmod{13}.
SolutionM=71113=1001M = 7 \cdot 11 \cdot 13 = 1001. M1=143M_1 = 143. We need 143b11(mod7)143 b_1 \equiv 1 \pmod{7}. Since 143=207+3143 = 20 \cdot 7 + 3We need 3b11(mod7)3b_1 \equiv 1 \pmod{7} So b15(mod7)b_1 \equiv 5 \pmod{7}. M2=91M_2 = 91. We need 91b21(mod11)91 b_2 \equiv 1 \pmod{11}. Since 91=811+391 = 8 \cdot 11 + 3We need 3b21(mod11)3b_2 \equiv 1 \pmod{11} So b24(mod11)b_2 \equiv 4 \pmod{11}. M3=77M_3 = 77. We need 77b31(mod13)77 b_3 \equiv 1 \pmod{13}. Since 77=513+1277 = 5 \cdot 13 + 12We need 12b31(mod13)12b_3 \equiv 1 \pmod{13}. 121(mod13)12 \equiv -1 \pmod{13}So b31-b_3 \equiv 1Giving b312(mod13)b_3 \equiv 12 \pmod{13}. x=35143+5491+21277=2145+1820+1848=5813x = 3 \cdot 5 \cdot 143 + 5 \cdot 4 \cdot 91 + 2 \cdot 12 \cdot 77 = 2145 + 1820 + 1848 = 5813. 5813mod10015813 \bmod 1001: 5813=51001+8085813 = 5 \cdot 1001 + 808. So x808(mod1001)x \equiv 808 \pmod{1001}. \blacksquare
### 5.4 The General Chinese Remainder Theorem The CRT can be extended to systems where the moduli are not necessarily pairwise coprime. Theorem 5.2 (General CRT). The system xai(modmi)x \equiv a_i \pmod{m_i} for i=1,,ki = 1, \ldots, k has a Solution if and only if aiaj(modgcd(mi,mj))a_i \equiv a_j \pmod{\gcd(m_i, m_j)} for all i,ji, j. When a solution Exists, it is unique modulo lcm(m1,,mk)\mathrm{lcm}(m_1, \ldots, m_k). Proof. (\Rightarrow) If xai(modmi)x \equiv a_i \pmod{m_i} and xaj(modmj)x \equiv a_j \pmod{m_j}Then mi(xai)m_i \mid (x - a_i) and mj(xaj)m_j \mid (x - a_j). Any common divisor of mim_i and mjm_j divides (xai)(xaj)=ajai(x - a_i) - (x - a_j) = a_j - a_i. So gcd(mi,mj)(aiaj)\gcd(m_i, m_j) \mid (a_i - a_j). (\Leftarrow) Proceed pairwise. Consider xa1(modm1)x \equiv a_1 \pmod{m_1} and xa2(modm2)x \equiv a_2 \pmod{m_2}. Write m1=dm1m_1 = d \cdot m_1' and m2=dm2m_2 = d \cdot m_2' where d=gcd(m1,m2)d = \gcd(m_1, m_2). By hypothesis a1a2(modd)a_1 \equiv a_2 \pmod{d}. The combined congruence is equivalent to xa2+dk(modm2)x \equiv a_2 + dk \pmod{m_2} for some kk with dkd \mid k. By induction on kkThe full system Is solvable. Uniqueness modulo the lcm follows from Proposition 4.5(3). \blacksquare Problem. Solve x3(mod6)x \equiv 3 \pmod{6}, x5(mod10)x \equiv 5 \pmod{10}.
Solutiongcd(6,10)=2\gcd(6, 10) = 2. Check: 35(mod2)3 \equiv 5 \pmod{2}? 3mod2=13 \bmod 2 = 1, 5mod2=15 \bmod 2 = 1. Yes, so a Solution exists. x3(mod6)x \equiv 3 \pmod{6} means x=6k+3x = 6k + 3. Substituting: 6k+35(mod10)6k + 3 \equiv 5 \pmod{10}So 6k2(mod10)6k \equiv 2 \pmod{10}. Dividing by gcd(6,10)=2\gcd(6, 10) = 2: 3k1(mod5)3k \equiv 1 \pmod{5}Giving k2(mod5)k \equiv 2 \pmod{5}. So k=5m+2k = 5m + 2And x=6(5m+2)+3=30m+15x = 6(5m + 2) + 3 = 30m + 15. The solution is x15(mod30)x \equiv 15 \pmod{30}. Note lcm(6,10)=30\mathrm{lcm}(6, 10) = 30. \blacksquare
Problem. Determine whether the system x5(mod12)x \equiv 5 \pmod{12}, x3(mod15)x \equiv 3 \pmod{15} x8(mod20)x \equiv 8 \pmod{20} has a solution.
SolutionCheck pairwise compatibility: gcd(12,15)=3\gcd(12, 15) = 3. 53(mod3)5 \equiv 3 \pmod{3}? 5mod3=25 \bmod 3 = 2, 3mod3=03 \bmod 3 = 0. No! 202 \neq 0. Therefore the system has no solution. \blacksquare
### 5.5 Applications of the CRT Application (RSA decryption). In RSA, one computes mdmodnm^d \bmod n where n=pqn = pq. Since ϕ(n)=(p1)(q1)\phi(n) = (p-1)(q-1)One can compute mdmodpm^d \bmod p and mdmodqm^d \bmod q separately (much faster For large moduli) and then combine using the CRT. Application (Constructing integers with prescribed residues). The CRT guarantees that for any Choice of residues aia_i modulo pairwise coprime mim_iWe can find an integer with all those Residues simultaneously. This is used in error-correcting codes and in the construction of Pseudorandom number generators. Application (Simultaneous systems). The CRT is used to reduce computation modulo a large Number n=m1m2mkn = m_1 m_2 \cdots m_k to computations modulo each smaller mim_i. This “garner’s Algorithm” approach is widely used in computer algebra systems. Problem. A number NN leaves remainder 33 when divided by 88, 11 when divided by 99And 77 when divided by 2525. Find the smallest such NN.
SolutionM=8925=1800M = 8 \cdot 9 \cdot 25 = 1800. M1=225M_1 = 225. 225b11(mod8)225b_1 \equiv 1 \pmod{8}. 2251(mod8)225 \equiv 1 \pmod{8}So b1=1b_1 = 1. M2=200M_2 = 200. 200b21(mod9)200b_2 \equiv 1 \pmod{9}. 200=229+2200 = 22 \cdot 9 + 2So 2b21(mod9)2b_2 \equiv 1 \pmod{9}, b2=5b_2 = 5. M3=72M_3 = 72. 72b31(mod25)72b_3 \equiv 1 \pmod{25}. 72=225+2272 = 2 \cdot 25 + 22So 22b31(mod25)22b_3 \equiv 1 \pmod{25}. 223(mod25)22 \equiv -3 \pmod{25}. We need 3b31-3b_3 \equiv 1So 3b3243b_3 \equiv 24, b3=8b_3 = 8. N=31225+15200+7872=675+1000+4032=5707N = 3 \cdot 1 \cdot 225 + 1 \cdot 5 \cdot 200 + 7 \cdot 8 \cdot 72 = 675 + 1000 + 4032 = 5707. 5707mod1800=570731800=57075400=3075707 \bmod 1800 = 5707 - 3 \cdot 1800 = 5707 - 5400 = 307. The smallest positive solution is N=307N = 307. \blacksquare
## 6. Euler’s Theorem and Fermat’s Little Theorem ### 6.1 Euler’s Totient Function Definition. Euler’s totient function ϕ(n)\phi(n) counts the integers in 1,2,,n\\{1, 2, \ldots, n\\} That are coprime to nn. Proposition 6.1. If pp is prime, then ϕ(p)=p1\phi(p) = p - 1. ### 6.2 Multiplicativity of the Totient Function Theorem 6.2. If gcd(m,n)=1\gcd(m, n) = 1Then ϕ(mn)=ϕ(m)ϕ(n)\phi(mn) = \phi(m)\phi(n). Proof. We count the integers in 1,2,,mn\\{1, 2, \ldots, mn\\} coprime to mnmn. Since gcd(m,n)=1\gcd(m, n) = 1 We have gcd(k,mn)=1\gcd(k, mn) = 1 if and only if gcd(k,m)=1\gcd(k, m) = 1 and gcd(k,n)=1\gcd(k, n) = 1. Consider the m×nm \times n grid where entry (i,j)(i, j) represents the number ki(modm)k \equiv i \pmod{m} kj(modn)k \equiv j \pmod{n}. By the CRT, each pair (i,j)(i, j) with 1im1 \leq i \leq m, 1jn1 \leq j \leq n Corresponds to a unique kk modulo mnmn. The number kk is coprime to mnmn iff ii is coprime to mm And jj is coprime to nn. There are ϕ(m)\phi(m) choices for ii and ϕ(n)\phi(n) choices for jj Giving ϕ(m)ϕ(n)\phi(m) \cdot \phi(n) values of kk coprime to mnmn. \blacksquare Proposition 6.3. If n=p1a1pkakn = p_1^{a_1} \cdots p_k^{a_k}Then ϕ(n)=npn(11/p)\phi(n) = n \prod_{p \mid n}(1 - 1/p). Proof. By multiplicativity, ϕ(n)=i=1kϕ(piai)\phi(n) = \prod_{i=1}^k \phi(p_i^{a_i}). Now ϕ(pa)=papa1=pa(11/p)\phi(p^a) = p^a - p^{a-1} = p^a(1 - 1/p)Since exactly pa1p^{a-1} of the pap^a integers in 1,,pa\\{1, \ldots, p^a\\} are multiples of pp. \blacksquare ### 6.3 Euler’s Theorem Theorem 6.4 (Euler’s Theorem). If gcd(a,n)=1\gcd(a, n) = 1Then aϕ(n)1(modn)a^{\phi(n)} \equiv 1 \pmod{n} Proof. Let Un=r1,r2,,rϕ(n)U_n = \\{r_1, r_2, \ldots, r_{\phi(n)}\\} be the reduced residue system modulo nn. Since gcd(a,n)=1\gcd(a, n) = 1The map riari(modn)r_i \mapsto ar_i \pmod{n} permutes UnU_n. Thus i=1ϕ(n)(ari)i=1ϕ(n)ri(modn)\prod_{i=1}^{\phi(n)} (ar_i) \equiv \prod_{i=1}^{\phi(n)} r_i \pmod{n}So aϕ(n)riri(modn)a^{\phi(n)} \prod r_i \equiv \prod r_i \pmod{n}. Since gcd(ri,n)=1\gcd(\prod r_i, n) = 1We cancel to get aϕ(n)1(modn)a^{\phi(n)} \equiv 1 \pmod{n}. \blacksquare Corollary 6.5 (Fermat’s Little Theorem). If pp is prime and gcd(a,p)=1\gcd(a, p) = 1Then ap11(modp)a^{p-1} \equiv 1 \pmod{p}. Equivalently, apa(modp)a^p \equiv a \pmod{p} for all aa. ### 6.4 Worked Examples Problem. Compute 7222mod157^{222} \bmod 15. Solution. ϕ(15)=ϕ(3)ϕ(5)=24=8\phi(15) = \phi(3)\phi(5) = 2 \cdot 4 = 8. Since gcd(7,15)=1\gcd(7, 15) = 1 781(mod15)7^8 \equiv 1 \pmod{15}. We have 222=278+6222 = 27 \cdot 8 + 6So 7222=(78)277612776(mod15)7^{222} = (7^8)^{27} \cdot 7^6 \equiv 1^{27} \cdot 7^6 \pmod{15}. Now 72=494(mod15)7^2 = 49 \equiv 4 \pmod{15}, 74161(mod15)7^4 \equiv 16 \equiv 1 \pmod{15}So 76=747214=4(mod15)7^6 = 7^4 \cdot 7^2 \equiv 1 \cdot 4 = 4 \pmod{15}. \blacksquare Problem. Show that n13nn^{13} - n is divisible by 27302730 for all nZn \in \mathbb{Z}.
Solution2730=2357132730 = 2 \cdot 3 \cdot 5 \cdot 7 \cdot 13. We show n13n(modp)n^{13} \equiv n \pmod{p} for each prime p2,3,5,7,13p \in \\{2, 3, 5, 7, 13\\}. For p=13p = 13: by Fermat, n13n(mod13)n^{13} \equiv n \pmod{13}. For p2,3,5,7p \in \\{2, 3, 5, 7\\}: by Fermat, npn(modp)n^p \equiv n \pmod{p}. Since p<13p \lt 13By repeated Application n13=nqp+r=(np)qnrnqnr=nq+rn^{13} = n^{qp+r} = (n^p)^q \cdot n^r \equiv n^q \cdot n^r = n^{q+r}. Iterating gives n13n(modp)n^{13} \equiv n \pmod{p}. By the CRT (since 2,3,5,7,132, 3, 5, 7, 13 are pairwise coprime), n13n(mod2730)n^{13} \equiv n \pmod{2730}So 2730(n13n)2730 \mid (n^{13} - n). \blacksquare
### 6.5a Fermat Pseudoprimes Definition. A composite integer nn is a Fermat pseudoprime to base aa if an11(modn)a^{n-1} \equiv 1 \pmod{n}. A composite integer that is a Fermat pseudoprime to all bases aa with gcd(a,n)=1\gcd(a, n) = 1 is a Carmichael number. The existence of Carmichael numbers shows that Fermat’s little theorem is a necessary but not Sufficient test for primality. The smallest Carmichael number is 561=31117561 = 3 \cdot 11 \cdot 17. Problem. Verify that 561561 is a Fermat pseudoprime to base 22.
Solution2560mod5612^{560} \bmod 561. Since 561=31117561 = 3 \cdot 11 \cdot 17Compute modulo each factor: 221(mod3)2^2 \equiv 1 \pmod{3}So 2560=(22)2801(mod3)2^{560} = (2^2)^{280} \equiv 1 \pmod{3}. 2101(mod11)2^{10} \equiv 1 \pmod{11} (Fermat), and 560=5610560 = 56 \cdot 10So 25601(mod11)2^{560} \equiv 1 \pmod{11}. 2161(mod17)2^{16} \equiv 1 \pmod{17} (Fermat), and 560=3516560 = 35 \cdot 16So 25601(mod17)2^{560} \equiv 1 \pmod{17}. By the CRT, 25601(mod561)2^{560} \equiv 1 \pmod{561}. Since 561561 is composite, it is a Fermat pseudoprime To base 22. \blacksquare
### 6.5 Application to RSA The RSA cryptosystem is a direct application of Euler’s theorem. Setup. Choose two large distinct primes pp and qq. Set n=pqn = pq and ϕ(n)=(p1)(q1)\phi(n) = (p-1)(q-1). Choose ee with 1<e<ϕ(n)1 \lt e \lt \phi(n) and gcd(e,ϕ(n))=1\gcd(e, \phi(n)) = 1. Compute dd such that ed1(modϕ(n))ed \equiv 1 \pmod{\phi(n)} using the extended Euclidean algorithm. Public key: (n,e)(n, e). Private key: (n,d)(n, d). Encryption: To send message mm (0m<n0 \leq m \lt n), compute c=memodnc = m^e \bmod n. Decryption: Compute m=cdmodnm = c^d \bmod n. Theorem 6.6. RSA decryption is correct: cdm(modn)c^d \equiv m \pmod{n}. Proof. Since ed1(modϕ(n))ed \equiv 1 \pmod{\phi(n)}Write ed=1+kϕ(n)ed = 1 + k\phi(n) for some kZk \in \mathbb{Z}. If gcd(m,n)=1\gcd(m, n) = 1Then cdmed=m1+kϕ(n)m(mϕ(n))km1km(modn)c^d \equiv m^{ed} = m^{1 + k\phi(n)} \equiv m \cdot (m^{\phi(n)})^k \equiv m \cdot 1^k \equiv m \pmod{n} by Euler’s theorem. If gcd(m,n)>1\gcd(m, n) > 1Then since n=pqn = pqWe have pmp \mid m or qmq \mid m. Suppose pmp \mid m And qmq \nmid m. By Fermat, mq11(modq)m^{q-1} \equiv 1 \pmod{q}. So med=m1+k(p1)(q1)m(modq)m^{ed} = m^{1 + k(p-1)(q-1)} \equiv m \pmod{q}. Also med0m(modp)m^{ed} \equiv 0 \equiv m \pmod{p}. By the CRT, medm(modn)m^{ed} \equiv m \pmod{n}. \blacksquare Problem. Given p=61p = 61, q=53q = 53, e=17e = 17Encrypt and decrypt the message m=65m = 65.
Solutionn=6153=3233n = 61 \cdot 53 = 3233, ϕ(n)=6052=3120\phi(n) = 60 \cdot 52 = 3120. Find dd: solve 17d1(mod3120)17d \equiv 1 \pmod{3120}. Using the extended Euclidean algorithm: 3120=18317+93120 = 183 \cdot 17 + 9, 17=19+817 = 1 \cdot 9 + 8, 9=18+19 = 1 \cdot 8 + 1. Back-substituting: 1=98=9(179)=2917=2(312018317)17=23120367171 = 9 - 8 = 9 - (17 - 9) = 2 \cdot 9 - 17 = 2(3120 - 183 \cdot 17) - 17 = 2 \cdot 3120 - 367 \cdot 17. So d3672753(mod3120)d \equiv -367 \equiv 2753 \pmod{3120}. Encrypt: c=6517mod3233c = 65^{17} \bmod 3233. Compute: 652=4225992(mod3233)65^2 = 4225 \equiv 992 \pmod{3233}. 6549922=9840641232(mod3233)65^4 \equiv 992^2 = 984064 \equiv 1232 \pmod{3233}. 65812322=15178241547(mod3233)65^8 \equiv 1232^2 = 1517824 \equiv 1547 \pmod{3233}. 651615472=2393209789(mod3233)65^{16} \equiv 1547^2 = 2393209 \equiv 789 \pmod{3233}. 6517=65166578965=512852790(mod3233)65^{17} = 65^{16} \cdot 65 \equiv 789 \cdot 65 = 51285 \equiv 2790 \pmod{3233}. So c=2790c = 2790. Decrypt: m=27902753mod3233m = 2790^{2753} \bmod 3233. (By the correctness …/1-number-and-algebra/3_proof-and-logic, this returns 6565.) \blacksquare
## 7. Primitive Roots ### 7.1 The Multiplicative Order Definition. The multiplicative order of aa modulo nn (where gcd(a,n)=1\gcd(a, n) = 1) is the Smallest positive integer kk such that ak1(modn)a^k \equiv 1 \pmod{n}. We write ordn(a)=k\mathrm{ord_n}(a) = k. Proposition 7.1. ordn(a)\mathrm{ord_n}(a) divides ϕ(n)\phi(n). Proposition 7.2. ak1(modn)a^k \equiv 1 \pmod{n} if and only if ordn(a)k\mathrm{ord_n}(a) \mid k. Proposition 7.3. If ordn(a)=k\mathrm{ord_n}(a) = kThen ordn(am)=k/gcd(k,m)\mathrm{ord_n}(a^m) = k / \gcd(k, m). ### 7.2 Primitive Roots Definition. gg is a primitive root modulo nn if ordn(g)=ϕ(n)\mathrm{ord_n}(g) = \phi(n)I.e., gg Generates the multiplicative group (Z/nZ)(\mathbb{Z}/n\mathbb{Z})^*. Theorem 7.4. A primitive root modulo nn exists if and only if n=2n = 2, n=4n = 4, n=pkn = p^kOr n=2pkn = 2p^k where pp is an odd prime and k1k \geq 1. Intuition. The multiplicative group (Z/nZ)(\mathbb{Z}/n\mathbb{Z})^* is cyclic precisely for these Values of nn. When the group is not cyclic (e.g., n=8n = 8 where (Z/8Z)C2×C2(\mathbb{Z}/8\mathbb{Z})^* \cong C_2 \times C_2), no single element can generate the entire group. Proposition 7.4a. (Z/nZ)i=1k(Z/piaiZ)(\mathbb{Z}/n\mathbb{Z})^* \cong \prod_{i=1}^k (\mathbb{Z}/p_i^{a_i}\mathbb{Z})^* Where n=piain = \prod p_i^{a_i} is the prime factorization. Each factor (Z/paZ)(\mathbb{Z}/p^a\mathbb{Z})^* is cyclic for odd primes pp. This decomposition explains why primitive roots exist only for the stated values: a product of Cyclic groups is cyclic if and only if the orders are pairwise coprime. Theorem 7.5. If nn has a primitive root, then there are exactly ϕ(ϕ(n))\phi(\phi(n)) primitive roots Modulo nn. ### 7.3 Existence of Primitive Roots for Primes Theorem 7.6. Every prime pp has a primitive root. Proof. Let ψ(d)\psi(d) denote the number of elements of (Z/pZ)(\mathbb{Z}/p\mathbb{Z})^* of order Exactly dd. The key facts are: 1. ψ(d)ϕ(d)\psi(d) \leq \phi(d) for all d(p1)d \mid (p-1). 2. d(p1)ψ(d)=p1=d(p1)ϕ(d)\sum_{d \mid (p-1)} \psi(d) = p - 1 = \sum_{d \mid (p-1)} \phi(d). If ψ(d)<ϕ(d)\psi(d) \lt \phi(d) for some ddThen the sum ψ(d)\sum \psi(d) would be strictly less than ϕ(d)=p1\sum \phi(d) = p - 1A contradiction. So ψ(d)=ϕ(d)\psi(d) = \phi(d) for all d(p1)d \mid (p-1). In Particular, ψ(p1)=ϕ(p1)>0\psi(p - 1) = \phi(p - 1) > 0So primitive roots exist. \blacksquare ### 7.4 Finding Primitive Roots To test whether gg is a primitive root modulo pp (where pp is prime), it suffices to verify g(p1)/q≢1(modp)g^{(p-1)/q} \not\equiv 1 \pmod{p} for every prime divisor qq of p1p - 1. Proposition 7.7. Let pp be prime and g(Z/pZ)g \in (\mathbb{Z}/p\mathbb{Z})^*. Then gg is a primitive Root modulo pp if and only if for every prime q(p1)q \mid (p - 1), g(p1)/q≢1(modp)g^{(p-1)/q} \not\equiv 1 \pmod{p}. Proof. If gg is a primitive root, ordp(g)=p1\mathrm{ord_p}(g) = p - 1. If g(p1)/q1(modp)g^{(p-1)/q} \equiv 1 \pmod{p} For some prime q(p1)q \mid (p-1)Then ordp(g)(p1)/q<p1\mathrm{ord_p}(g) \mid (p-1)/q \lt p-1Contradiction. Conversely, if gg is not a primitive root, let d=ordp(g)<p1d = \mathrm{ord_p}(g) \lt p - 1. Then d(p1)d \mid (p-1) So (p1)/d>1(p-1)/d > 1 has some prime factor qqMeaning q(p1)q \mid (p-1) and d(p1)/qd \mid (p-1)/q. Then g(p1)/q1(modp)g^{(p-1)/q} \equiv 1 \pmod{p}Contradicting the hypothesis. \blacksquare Problem. Find all primitive roots modulo 1313.
Solutionϕ(13)=12\phi(13) = 12. We need elements of order 1212 in (Z/13Z)(\mathbb{Z}/13\mathbb{Z})^*. The prime divisors of 1212 are 22 and 33. We test g6g^6 and g4g^4. g=2g = 2: 24=163≢12^4 = 16 \equiv 3 \not\equiv 1, 26=64121≢1(mod13)2^6 = 64 \equiv 12 \equiv -1 \not\equiv 1 \pmod{13}. So 22 is a primitive root. g=3g = 3: 34=813(mod13)3^4 = 81 \equiv 3 \pmod{13}. Not a primitive root (order divides 44). g=5g = 5: 54=6251(mod13)5^4 = 625 \equiv 1 \pmod{13}. Not a primitive root. g=6g = 6: 6496^4 \equiv 9, 66121(mod13)6^6 \equiv 12 \equiv -1 \pmod{13}. Primitive root. g=7g = 7: 7497^4 \equiv 9, 76121(mod13)7^6 \equiv 12 \equiv -1 \pmod{13}. Primitive root. g=11g = 11: 114311^4 \equiv 3, 116121(mod13)11^6 \equiv 12 \equiv -1 \pmod{13}. Primitive root. By Theorem 7.5, there are ϕ(12)=4\phi(12) = 4 primitive roots modulo 1313: 2,6,7,112, 6, 7, 11. \blacksquare
### 7.5 Index Calculus When a primitive root gg modulo pp is known, every element aa of (Z/pZ)(\mathbb{Z}/p\mathbb{Z})^* Can be written uniquely as agk(modp)a \equiv g^k \pmod{p} with 0k<p10 \leq k \lt p - 1. The exponent kk Is called the index (or discrete logarithm) of aa to base ggWritten indg(a)=k\mathrm{ind_g}(a) = k. Proposition 7.8 (Properties of indices). Let gg be a primitive root modulo pp. For all a,b(Z/pZ)a, b \in (\mathbb{Z}/p\mathbb{Z})^*: 1. indg(ab)indg(a)+indg(b)(modp1)\mathrm{ind_g}(ab) \equiv \mathrm{ind_g}(a) + \mathrm{ind_g}(b) \pmod{p-1}. 2. indg(ak)kindg(a)(modp1)\mathrm{ind_g}(a^k) \equiv k \cdot \mathrm{ind_g}(a) \pmod{p-1}. 3. indg(1)=0\mathrm{ind_g}(1) = 0 and indg(g)=1\mathrm{ind_g}(g) = 1. ### 7.6 The Discrete Logarithm Problem Definition. Given a prime ppA primitive root gg modulo ppAnd a(Z/pZ)a \in (\mathbb{Z}/p\mathbb{Z})^* The discrete logarithm problem (DLP) asks: find kk such that gka(modp)g^k \equiv a \pmod{p}. Unlike ordinary logarithms, no polynomial-time algorithm is known for the DLP. The best known Algorithms (baby-step giant-step, index calculus, number field sieve) run in subexponential time. Application (Diffie—Hellman key exchange). Alice and Bob agree on a large prime pp and Primitive root gg (public). Alice chooses secret aaSends gamodpg^a \bmod p. Bob chooses secret bb Sends gbmodpg^b \bmod p. The shared secret is gabmodpg^{ab} \bmod pComputable by Alice as (gb)a(g^b)^a and By Bob as (ga)b(g^a)^b. An eavesdropper seeing gag^a and gbg^b cannot efficiently compute gabg^{ab} Without solving the DLP. ### 7.7 Worked Example: Index Calculus Problem. Let g=2g = 2 be a primitive root modulo 1919. Find ind2(14)(mod19)\mathrm{ind_2}(14) \pmod{19}.
SolutionFirst, verify 22 is a primitive root modulo 1919: ϕ(19)=18\phi(19) = 18Prime factors of 1818 are 22 and 33. 218/2=29=5122^{18/2} = 2^9 = 512. 512/19=26.9512 / 19 = 26.9\ldots, 2619=49426 \cdot 19 = 494, 512494=181(mod19)512 - 494 = 18 \equiv -1 \pmod{19}. 218/3=26=642^{18/3} = 2^6 = 64. 64/19=3.464 / 19 = 3.4\ldots, 6457=7≢1(mod19)64 - 57 = 7 \not\equiv 1 \pmod{19}. Confirmed. Compute powers of 22 modulo 1919: 21=22^1 = 2, 22=42^2 = 4, 23=82^3 = 8, 24=1632^4 = 16 \equiv -3, 25=321362^5 = 32 \equiv 13 \equiv -6 26=6472^6 = 64 \equiv 7, 27=142^7 = 14, 28=2892^8 = 28 \equiv 9, 29=1812^9 = 18 \equiv -1 2102172^{10} \equiv -2 \equiv 17, 2114152^{11} \equiv -4 \equiv 15, 2128112^{12} \equiv -8 \equiv 11 2131632^{13} \equiv -16 \equiv 3, 214=62^{14} = 6, 215=122^{15} = 12, 216=2452^{16} = 24 \equiv 5 217=102^{17} = 10, 218=2012^{18} = 20 \equiv 1. From 27=14(mod19)2^7 = 14 \pmod{19}We get ind2(14)=7\mathrm{ind_2}(14) = 7. \blacksquare
Problem. Using the index table above, solve 6x11(mod19)6^x \equiv 11 \pmod{19}.
SolutionTaking indices base 22: ind2(6x)=ind2(11)\mathrm{ind_2}(6^x) = \mathrm{ind_2}(11). xind2(6)ind2(11)(mod18)x \cdot \mathrm{ind_2}(6) \equiv \mathrm{ind_2}(11) \pmod{18}. From the table: ind2(6)=14\mathrm{ind_2}(6) = 14 and ind2(11)=12\mathrm{ind_2}(11) = 12. So 14x12(mod18)14x \equiv 12 \pmod{18}. gcd(14,18)=2\gcd(14, 18) = 2 and 2122 \mid 12So solutions exist. Divide by 22: 7x6(mod9)7x \equiv 6 \pmod{9}. 714(mod9)7^{-1} \equiv 4 \pmod{9} (since 74=2817 \cdot 4 = 28 \equiv 1). So x46=246(mod9)x \equiv 4 \cdot 6 = 24 \equiv 6 \pmod{9}. The solutions modulo 1818 are x6,15(mod18)x \equiv 6, 15 \pmod{18}. Check: 66=466566^6 = 46656. 46656/19=2455.646656 / 19 = 2455.6\ldots, 245519=466452455 \cdot 19 = 46645, 4665646645=1146656 - 46645 = 11. \blacksquare
## 8. Quadratic Residues ### 8.1 Definition Definition. Let pp be an odd prime. An integer aa not divisible by pp is a quadratic Residue modulo pp if the congruence x2a(modp)x^2 \equiv a \pmod{p} has a solution. Otherwise aa is a quadratic non-residue. Proposition 8.1. There are exactly (p1)/2(p - 1)/2 quadratic residues and (p1)/2(p - 1)/2 quadratic Non-residues modulo pp. Proof. The map xx2(modp)x \mapsto x^2 \pmod{p} from 1,2,,p1\\{1, 2, \ldots, p-1\\} to the set of quadratic Residues is exactly two-to-one since x2(x)2(modp)x^2 \equiv (-x)^2 \pmod{p} but x≢x(modp)x \not\equiv -x \pmod{p} for x≢0(modp)x \not\equiv 0 \pmod{p} (since pp is odd). \blacksquare ### 8.2 Euler’s Criterion Theorem 8.2 (Euler’s Criterion). Let pp be an odd prime and gcd(a,p)=1\gcd(a, p) = 1. Then a(p1)/2{1(modp)if a is a QR mod p1(modp)if a is a QNR mod pa^{(p-1)/2} \equiv \begin{cases} 1 \pmod{p} & \mathrm{if\ } a \mathrm{\ is\ a\ QR\ mod\ } p \\ -1 \pmod{p} & \mathrm{if\ } a \mathrm{\ is\ a\ QNR\ mod\ } p \end{cases} Proof. By Fermat’s little theorem, ap11(modp)a^{p-1} \equiv 1 \pmod{p}So (a(p1)/21)(a(p1)/2+1)0(modp)(a^{(p-1)/2} - 1)(a^{(p-1)/2} + 1) \equiv 0 \pmod{p}. Thus a(p1)/2±1(modp)a^{(p-1)/2} \equiv \pm 1 \pmod{p}. If aa is a QR, say ax2(modp)a \equiv x^2 \pmod{p}Then a(p1)/2xp11(modp)a^{(p-1)/2} \equiv x^{p-1} \equiv 1 \pmod{p}. For the converse: a(p1)/21(modp)a^{(p-1)/2} \equiv 1 \pmod{p} implies aa is a QR (by a polynomial argument: the Equation x(p1)/210(modp)x^{(p-1)/2} - 1 \equiv 0 \pmod{p} has at most (p1)/2(p-1)/2 solutions, and all QRs are Solutions). Since there are exactly (p1)/2(p-1)/2 QRs and (p1)/2(p-1)/2 elements with a(p1)/21(modp)a^{(p-1)/2} \equiv 1 \pmod{p}These sets coincide. \blacksquare ### 8.3 The Legendre Symbol Definition. The Legendre symbol is defined by (ap)={0if pa1if a is a QR mod p1if a is a QNR mod p\left(\frac{a}{p}\right) = \begin{cases} 0 & \mathrm{if\ } p \mid a \\ 1 & \mathrm{if\ } a \mathrm{\ is\ a\ QR\ mod\ } p \\ -1 & \mathrm{if\ } a \mathrm{\ is\ a\ QNR\ mod\ } p \end{cases} Proposition 8.3. The Legendre symbol is completely multiplicative: (abp)=(ap)(bp)\left(\frac{ab}{p}\right) = \left(\frac{a}{p}\right)\left(\frac{b}{p}\right). ### 8.4 Quadratic Reciprocity Theorem 8.4 (Law of Quadratic Reciprocity). For distinct odd primes pp and qq: (pq)(qp)=(1)p12q12\left(\frac{p}{q}\right)\left(\frac{q}{p}\right) = (-1)^{\frac{p-1}{2} \cdot \frac{q-1}{2}} Theorem 8.5 (First Supplement). (1p)=(1)(p1)/2\left(\frac{-1}{p}\right) = (-1)^{(p-1)/2}. So 1-1 is a QR Mod pp if and only if p1(mod4)p \equiv 1 \pmod{4}. Theorem 8.6 (Second Supplement). (2p)=(1)(p21)/8\left(\frac{2}{p}\right) = (-1)^{(p^2-1)/8}. So 22 is a QR Mod pp if and only if p±1(mod8)p \equiv \pm 1 \pmod{8}. ### 8.5 Proofs of the Supplements Proof of the First Supplement. By Euler’s criterion: (1p)=(1)(p1)/2\left(\frac{-1}{p}\right) = (-1)^{(p-1)/2}. This equals 11 when p1(mod4)p \equiv 1 \pmod{4} (since (p1)/2(p-1)/2 is even) and 1-1 when p3(mod4)p \equiv 3 \pmod{4} (since (p1)/2(p-1)/2 is odd). \blacksquare Proof of the Second Supplement. By Euler’s criterion, (2p)=2(p1)/2(modp)\left(\frac{2}{p}\right) = 2^{(p-1)/2} \pmod{p}. Consider the product P=k=1(p1)/22k=2(p1)/2((p1)/2)!P = \prod_{k=1}^{(p-1)/2} 2k = 2^{(p-1)/2} \cdot ((p-1)/2)!. Reduce each 2k2k modulo pp into the set (p1)/2,,1,1,,(p1)/2\\{-(p-1)/2, \ldots, -1, 1, \ldots, (p-1)/2\\}. The key observation (Gauss’s lemma) is that the number of 2k2k landing in the negative range is (p21)/8(p^2 - 1)/8Which depends on pmod8p \bmod 8. \blacksquare ### 8.6 The Jacobi Symbol Definition. The Jacobi symbol generalizes the Legendre symbol to odd composite moduli. For n=p1a1pkakn = p_1^{a_1} \cdots p_k^{a_k} (odd, positive): (an)=i=1k(api)ai\left(\frac{a}{n}\right) = \prod_{i=1}^k \left(\frac{a}{p_i}\right)^{a_i} Warning. (an)=1\left(\frac{a}{n}\right) = 1 does not imply aa is a QR modulo nn when nn is Composite. The Jacobi symbol satisfies the same reciprocity law and supplements as the Legendre symbol, making It efficient for computation. Proposition 8.7 (Properties of the Jacobi symbol). For odd positive m,nm, n: 1. (amn)=(am)(an)\left(\frac{a}{mn}\right) = \left(\frac{a}{m}\right)\left(\frac{a}{n}\right). 2. (abn)=(an)(bn)\left(\frac{ab}{n}\right) = \left(\frac{a}{n}\right)\left(\frac{b}{n}\right). 3. (mn)(nm)=(1)m12n12\left(\frac{m}{n}\right)\left(\frac{n}{m}\right) = (-1)^{\frac{m-1}{2} \cdot \frac{n-1}{2}}. 4. (1n)=(1)(n1)/2\left(\frac{-1}{n}\right) = (-1)^{(n-1)/2}. 5. (2n)=(1)(n21)/8\left(\frac{2}{n}\right) = (-1)^{(n^2-1)/8}. 6. If ab(modn)a \equiv b \pmod{n}Then (an)=(bn)\left(\frac{a}{n}\right) = \left(\frac{b}{n}\right). ### 8.7 Worked Examples Problem. Determine whether 7373 is a quadratic residue modulo 9797. Solution. By quadratic reciprocity, since both 7373 and 9797 are congruent to 1(mod4)1 \pmod{4}: (7397)=(9773)=(2473)=(473)(673)=1(673)\left(\frac{73}{97}\right) = \left(\frac{97}{73}\right) = \left(\frac{24}{73}\right) = \left(\frac{4}{73}\right)\left(\frac{6}{73}\right) = 1 \cdot \left(\frac{6}{73}\right) (673)=(273)(373)\left(\frac{6}{73}\right) = \left(\frac{2}{73}\right)\left(\frac{3}{73}\right) (273)=1\left(\frac{2}{73}\right) = 1 since 731(mod8)73 \equiv 1 \pmod{8}. (373)=(1)3127312(733)=(1)72(13)=11=1\left(\frac{3}{73}\right) = (-1)^{\frac{3-1}{2} \cdot \frac{73-1}{2}} \left(\frac{73}{3}\right) = (-1)^{72} \left(\frac{1}{3}\right) = 1 \cdot 1 = 1. So (7397)=1\left(\frac{73}{97}\right) = 1And 7373 is a QR modulo 9797. \blacksquare Problem. Compute the Jacobi symbol (219383)\left(\frac{219}{383}\right).
SolutionBoth 219=373219 = 3 \cdot 73 and 383383 are odd. Since 3833(mod4)383 \equiv 3 \pmod{4} and 2193(mod4)219 \equiv 3 \pmod{4} By reciprocity: (219383)=(383219)\left(\frac{219}{383}\right) = -\left(\frac{383}{219}\right). 383mod219=164383 \bmod 219 = 164. So (383219)=(164219)=(4219)(41219)=(41219)\left(\frac{383}{219}\right) = \left(\frac{164}{219}\right) = \left(\frac{4}{219}\right)\left(\frac{41}{219}\right) = \left(\frac{41}{219}\right). 411(mod4)41 \equiv 1 \pmod{4}, 2193(mod4)219 \equiv 3 \pmod{4}So (41219)=(21941)\left(\frac{41}{219}\right) = -\left(\frac{219}{41}\right). 219mod41=14219 \bmod 41 = 14. So (21941)=(1441)=(241)(741)\left(\frac{219}{41}\right) = \left(\frac{14}{41}\right) = \left(\frac{2}{41}\right)\left(\frac{7}{41}\right). (241)=1\left(\frac{2}{41}\right) = 1 since 411(mod8)41 \equiv 1 \pmod{8}. 73(mod4)7 \equiv 3 \pmod{4}, 411(mod4)41 \equiv 1 \pmod{4}So (741)=(417)=(67)=(27)(37)\left(\frac{7}{41}\right) = \left(\frac{41}{7}\right) = \left(\frac{6}{7}\right) = \left(\frac{2}{7}\right)\left(\frac{3}{7}\right). (27)=1\left(\frac{2}{7}\right) = 1 since 71(mod8)7 \equiv -1 \pmod{8}. (37)=(1)13(73)=(13)=1\left(\frac{3}{7}\right) = (-1)^{1 \cdot 3} \left(\frac{7}{3}\right) = -\left(\frac{1}{3}\right) = -1. Working back: (741)=1(1)=1\left(\frac{7}{41}\right) = 1 \cdot (-1) = -1. (21941)=1(1)=1\left(\frac{219}{41}\right) = 1 \cdot (-1) = -1. (41219)=(1)=1\left(\frac{41}{219}\right) = -(-1) = 1. (383219)=1\left(\frac{383}{219}\right) = 1. (219383)=(1)=1\left(\frac{219}{383}\right) = -(1) = -1. So 219219 is a QNR modulo 383383. \blacksquare
### 8.8 Applications of Quadratic Reciprocity Application (Solovay—Strassen primality test). For an odd candidate nnChoose random aa and Check whether a(n1)/2(an)(modn)a^{(n-1)/2} \equiv \left(\frac{a}{n}\right) \pmod{n} (where the Jacobi symbol is used). If nn is composite, at least half of all aa violate this. This gives a probabilistic primality test. Application (determining solvability). Quadratic reciprocity allows efficient computation of Legendre symbols without directly checking all residues, reducing an O(p)O(p) problem to O(logp)O(\log p) arithmetic operations. ### 8.9 Computing Square Roots Modulo p When aa is a quadratic residue modulo an odd prime ppFinding xx with x2a(modp)x^2 \equiv a \pmod{p} Is the square root problem modulo pp. Proposition 8.8. When p3(mod4)p \equiv 3 \pmod{4}A square root of aa modulo pp (when aa is a QR) is Given by x±a(p+1)/4(modp)x \equiv \pm a^{(p+1)/4} \pmod{p}. Proof. (a(p+1)/4)2=a(p+1)/2=aa(p1)/2a1=a(modp)(a^{(p+1)/4})^2 = a^{(p+1)/2} = a \cdot a^{(p-1)/2} \equiv a \cdot 1 = a \pmod{p} by Euler’s criterion. \blacksquare Problem. Find a square root of 55 modulo 2929.
SolutionFirst verify 55 is a QR modulo 2929: (529)=(295)=(45)=1\left(\frac{5}{29}\right) = \left(\frac{29}{5}\right) = \left(\frac{4}{5}\right) = 1. Yes. Since 291(mod4)29 \equiv 1 \pmod{4}We cannot use the simple formula. We use a direct search among The QRs modulo 2929. The squares modulo 2929 of 1,2,,141, 2, \ldots, 14 are: 1,4,9,16,25,367,4920,646,8123,100131, 4, 9, 16, 25, 36 \equiv 7, 49 \equiv 20, 64 \equiv 6, 81 \equiv 23, 100 \equiv 13 1215,14428,16924,19622121 \equiv 5, 144 \equiv 28, 169 \equiv 24, 196 \equiv 22. So 112=1215(mod29)11^2 = 121 \equiv 5 \pmod{29}. A square root of 55 modulo 2929 is x11x \equiv 11 (and also x18x \equiv 18). \blacksquare
Problem. Find a square root of 77 modulo 1919.
Solution193(mod4)19 \equiv 3 \pmod{4}So we can use the formula. First verify 77 is a QR: (719)=(1)7121912(197)=(1)54(57)=(57)\left(\frac{7}{19}\right) = (-1)^{\frac{7-1}{2} \cdot \frac{19-1}{2}} \left(\frac{19}{7}\right) = (-1)^{54} \left(\frac{5}{7}\right) = \left(\frac{5}{7}\right). (57)=(1)23(75)=(25)=(1)(251)/8=(1)3=1\left(\frac{5}{7}\right) = (-1)^{2 \cdot 3} \left(\frac{7}{5}\right) = \left(\frac{2}{5}\right) = (-1)^{(25-1)/8} = (-1)^3 = -1. Wait, let me recompute. (719)\left(\frac{7}{19}\right): 73(mod4)7 \equiv 3 \pmod{4}, 193(mod4)19 \equiv 3 \pmod{4}So (719)=(197)=(57)\left(\frac{7}{19}\right) = -\left(\frac{19}{7}\right) = -\left(\frac{5}{7}\right). Now 51(mod4)5 \equiv 1 \pmod{4}, 73(mod4)7 \equiv 3 \pmod{4} So (57)=(75)=(25)=(1)=1\left(\frac{5}{7}\right) = -\left(\frac{7}{5}\right) = -\left(\frac{2}{5}\right) = -(-1) = 1. So (719)=1\left(\frac{7}{19}\right) = -1. This means 77 is a QNR modulo 1919So no square root exists. \blacksquare
## 9. Continued Fractions ### 9.1 Simple Continued Fractions A simple continued fraction is an expression of the form a0+1a1+1a2+1a3+a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + \cdots}}} Where a0Za_0 \in \mathbb{Z} and a1,a2,Na_1, a_2, \ldots \in \mathbb{N}. We write [a0;a1,a2,][a_0; a_1, a_2, \ldots]. ### 9.2 Computation For an irrational number α\alphaThe continued fraction expansion is computed recursively: a0=αa_0 = \lfloor \alpha \rfloor, α1=1/(αa0)\alpha_1 = 1/(\alpha - a_0), a1=α1a_1 = \lfloor \alpha_1 \rfloorAnd So on. Example. 2=1+(21)=1+12+1=1+12+(21)\sqrt{2} = 1 + (\sqrt{2} - 1) = 1 + \frac{1}{\sqrt{2} + 1} = 1 + \frac{1}{2 + (\sqrt{2} - 1)}. So 2=[1;2,2,2,]=[1;2]\sqrt{2} = [1; 2, 2, 2, \ldots] = [1; \overline{2}]. ### 9.3 Convergents The nn-th convergent pn/qn=[a0;a1,,an]p_n/q_n = [a_0; a_1, \ldots, a_n] is computed by: p1=1,p0=a0,pn=anpn1+pn2p_{-1} = 1, \quad p_0 = a_0, \quad p_n = a_n p_{n-1} + p_{n-2} q1=0,q0=1,qn=anqn1+qn2q_{-1} = 0, \quad q_0 = 1, \quad q_n = a_n q_{n-1} + q_{n-2} Theorem 9.1. pn/qnα<1/qn2|p_n/q_n - \alpha| \lt 1/q_n^2 for all nn. Theorem 9.2 (Best Approximation). If qαp<qnαpn|q\alpha - p| \lt |q_n \alpha - p_n| for q<qn+1q \lt q_{n+1}Then p/q=pn/qnp/q = p_n/q_n. ### 9.4 Periodic Continued Fractions Theorem 9.3 (Lagrange). The continued fraction of α\alpha is periodic if and only if α\alpha Is a quadratic irrational. Example. The golden ratio φ=1+52=[1;1,1,1,]=[1;1]\varphi = \frac{1 + \sqrt{5}}{2} = [1; 1, 1, 1, \ldots] = [1; \overline{1}]. ### 9.5 More Computation Examples Problem. Find the continued fraction expansion of 7\sqrt{7}.
Solution7=2+(72)\sqrt{7} = 2 + (\sqrt{7} - 2)So a0=2a_0 = 2. α1=172=7+23\alpha_1 = \frac{1}{\sqrt{7} - 2} = \frac{\sqrt{7} + 2}{3}. So a1=1a_1 = 1. α2=371=7+12\alpha_2 = \frac{3}{\sqrt{7} - 1} = \frac{\sqrt{7} + 1}{2}. So a2=1a_2 = 1. α3=271=7+13\alpha_3 = \frac{2}{\sqrt{7} - 1} = \frac{\sqrt{7} + 1}{3}. So a3=1a_3 = 1. α4=372=7+2\alpha_4 = \frac{3}{\sqrt{7} - 2} = \sqrt{7} + 2. So a4=4a_4 = 4. α5=172=α1\alpha_5 = \frac{1}{\sqrt{7} - 2} = \alpha_1. The process repeats. Therefore 7=[2;1,1,1,4]\sqrt{7} = [2; \overline{1, 1, 1, 4}]. \blacksquare
Problem. Compute the convergents of [1;1,1,1,1][1; 1, 1, 1, 1] (the first five terms of φ\varphi).
Solutionp1=1p_{-1} = 1, p0=1p_0 = 1. q1=0q_{-1} = 0, q0=1q_0 = 1. a1=1a_1 = 1: p1=11+1=2p_1 = 1 \cdot 1 + 1 = 2, q1=11+0=1q_1 = 1 \cdot 1 + 0 = 1. Convergent: 2/1=22/1 = 2. a2=1a_2 = 1: p2=12+1=3p_2 = 1 \cdot 2 + 1 = 3, q2=11+1=2q_2 = 1 \cdot 1 + 1 = 2. Convergent: 3/2=1.53/2 = 1.5. a3=1a_3 = 1: p3=13+2=5p_3 = 1 \cdot 3 + 2 = 5, q3=12+1=3q_3 = 1 \cdot 2 + 1 = 3. Convergent: 5/31.6675/3 \approx 1.667. a4=1a_4 = 1: p4=15+3=8p_4 = 1 \cdot 5 + 3 = 8, q4=13+2=5q_4 = 1 \cdot 3 + 2 = 5. Convergent: 8/5=1.68/5 = 1.6. These are ratios of consecutive Fibonacci numbers, converging to φ1.618\varphi \approx 1.618. \blacksquare
Problem. Find the continued fraction expansion of the rational number 157/68157/68.
Solution157/68=2+21/68157/68 = 2 + 21/68So a0=2a_0 = 2. 68/21=3+5/2168/21 = 3 + 5/21So a1=3a_1 = 3. 21/5=4+1/521/5 = 4 + 1/5So a2=4a_2 = 4. 5/1=55/1 = 5So a3=5a_3 = 5. Therefore 157/68=[2;3,4,5]157/68 = [2; 3, 4, 5]. Verification: [2;3,4,5]=2+13+14+1/5=2+13+5/21=2+168/21=2+21/68=157/68[2; 3, 4, 5] = 2 + \frac{1}{3 + \frac{1}{4 + 1/5}} = 2 + \frac{1}{3 + 5/21} = 2 + \frac{1}{68/21} = 2 + 21/68 = 157/68. \blacksquare
### 9.6 Periodic Continued Fractions and Pell’s Equation The continued fraction expansion of D\sqrt{D} is closely connected to Pell’s equation x2Dy2=1x^2 - Dy^2 = 1. Theorem 9.4. If the continued fraction of D\sqrt{D} has period length \ellThen: - If \ell is even, the fundamental solution of x2Dy2=1x^2 - Dy^2 = 1 is (p1,q1)(p_{\ell-1}, q_{\ell-1}). - If \ell is odd, the fundamental solution is (p21,q21)(p_{2\ell-1}, q_{2\ell-1}). ### 9.7 Approximation Properties Theorem 9.5. If p/qp/q is a convergent to α\alphaThen αpq<1q2\left|\alpha - \frac{p}{q}\right| \lt \frac{1}{q^2} Furthermore, if αp/q<1/(2q2)|\alpha - p/q| \lt 1/(2q^2)Then p/qp/q must be a convergent to α\alpha. Proposition 9.6. The convergents pn/qnp_n/q_n satisfy qnFn+1q_n \geq F_{n+1} (the (n+1)(n+1)-th Fibonacci Number), so the denominators grow at least exponentially. ### 9.8 Irrationality via Continued Fractions Theorem 9.7. If α\alpha has an infinite continued fraction expansion, then α\alpha is irrational. Proof. If α\alpha were rational, the Euclidean algorithm would terminate in finitely many Steps, producing a finite continued fraction. Contradiction. \blacksquare Proposition 9.8. ee is irrational. Proof. The continued fraction of ee is [2;1,2,1,1,4,1,1,6,1,1,8,1,][2; 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, \ldots] Which has a regular but infinite pattern. By Theorem 9.7, ee is irrational. \blacksquare ## 10. Diophantine Equations ### 10.1 Linear Diophantine Equations Theorem 10.1. The equation ax+by=cax + by = c has integer solutions if and only if gcd(a,b)c\gcd(a, b) \mid c. Proof. This follows directly from Bézout’s identity. \blacksquare Proposition 10.1a. If d=gcd(a,b)d = \gcd(a, b) and (x0,y0)(x_0, y_0) is a particular solution of ax+by=cax + by = c Then all integer solutions are given by x=x0+bdt,y=y0adt,tZx = x_0 + \frac{b}{d} \cdot t, \quad y = y_0 - \frac{a}{d} \cdot t, \quad t \in \mathbb{Z} Problem. Find all integer solutions to 15x+21y=1215x + 21y = 12.
Solutiond=gcd(15,21)=3d = \gcd(15, 21) = 3 and 3123 \mid 12So solutions exist. Divide through by 33: 5x+7y=45x + 7y = 4. Using the extended Euclidean algorithm: 7=15+27 = 1 \cdot 5 + 2, 5=22+15 = 2 \cdot 2 + 1. So 1=522=52(75)=35271 = 5 - 2 \cdot 2 = 5 - 2(7 - 5) = 3 \cdot 5 - 2 \cdot 7. Thus 5(3)+7(2)=15(3) + 7(-2) = 1And 5(12)+7(8)=45(12) + 7(-8) = 4. A particular solution: (x0,y0)=(12,8)(x_0, y_0) = (12, -8). All solutions: x=12+7tx = 12 + 7t, y=85ty = -8 - 5tFor tZt \in \mathbb{Z}. \blacksquare
### 10.2 Pythagorean Triples Theorem 10.2. All primitive Pythagorean triples (a,b,c)(a, b, c) (with gcd(a,b,c)=1\gcd(a, b, c) = 1 and a2+b2=c2a^2 + b^2 = c^2) are given by a=m2n2,b=2mn,c=m2+n2a = m^2 - n^2, \quad b = 2mn, \quad c = m^2 + n^2 Where m>n>0m > n > 0, gcd(m,n)=1\gcd(m, n) = 1And m≢n(mod2)m \not\equiv n \pmod{2}. Proof. Without loss, aa is odd and bb is even. From a2=c2b2=(cb)(c+b)a^2 = c^2 - b^2 = (c-b)(c+b). Setting m=(c+a)/2m = (c + a)/2 and n=(ca)/2n = (c - a)/2 yields the parameterization. \blacksquare Proposition 10.2a. The number of primitive Pythagorean triples with hypotenuse N\leq N is Asymptotically N2π\frac{N}{2\pi}. Problem. Find all primitive Pythagorean triples with c50c \leq 50.
SolutionWe need m>n>0m > n > 0, gcd(m,n)=1\gcd(m, n) = 1, m≢n(mod2)m \not\equiv n \pmod{2}And c=m2+n250c = m^2 + n^2 \leq 50. Try mm values: m249m^2 \leq 49So m7m \leq 7. m=2m = 2: n=1n = 1: (3,4,5)(3, 4, 5). m=3m = 3: n=2n = 2: (5,12,13)(5, 12, 13). m=4m = 4: n=1n = 1: (15,8,17)(15, 8, 17). n=3n = 3: gcd(4,3)=1\gcd(4,3) = 1, (7,24,25)(7, 24, 25). m=5m = 5: n=2n = 2: (21,20,29)(21, 20, 29). n=4n = 4: (9,40,41)(9, 40, 41). m=6m = 6: n=1n = 1: gcd(6,1)=1\gcd(6,1) = 1, (35,12,37)(35, 12, 37). n=5n = 5: (11,60,61)(11, 60, 61) but c>50c > 50. m=7m = 7: n=2n = 2: (45,28,53)(45, 28, 53) but c>50c > 50. n=4n = 4: (33,56,65)(33, 56, 65) but c>50c > 50. n=6n = 6: gcd(7,6)=1\gcd(7,6) = 1, (13,84,85)(13, 84, 85) but c>50c > 50. Primitive triples with c50c \leq 50: (3,4,5)(3,4,5), (5,12,13)(5,12,13), (15,8,17)(15,8,17), (7,24,25)(7,24,25), (21,20,29)(21,20,29), (9,40,41)(9,40,41), (35,12,37)(35,12,37). \blacksquare
### 10.3 Pell’s Equation Theorem 10.3. The equation x2Dy2=1x^2 - Dy^2 = 1 (where DD is not a perfect square) always has Non-trivial integer solutions. If (x1,y1)(x_1, y_1) is the smallest positive solution, then all solutions Are given by (xn+ynD)=(x1+y1D)n(x_n + y_n\sqrt{D}) = (x_1 + y_1\sqrt{D})^n. Proof. The existence of a non-trivial solution follows from Dirichlet’s unit theorem applied to Z[D]\mathbb{Z}[\sqrt{D}]. The general solution follows from the fact that the group of units of norm 11 in Z[D]\mathbb{Z}[\sqrt{D}] is cyclic and generated by the fundamental unit. \blacksquare Problem. Find all solutions to x22y2=1x^2 - 2y^2 = 1.
SolutionThe continued fraction of 2=[1;2]\sqrt{2} = [1; \overline{2}] has period =1\ell = 1 (odd). The first convergent after p0/q0=1/1p_0/q_0 = 1/1 is p1/q1=3/2p_1/q_1 = 3/2. Check: 32222=98=13^2 - 2 \cdot 2^2 = 9 - 8 = 1. The fundamental solution is (x1,y1)=(3,2)(x_1, y_1) = (3, 2). All solutions are given by (3+22)n=xn+yn2(3 + 2\sqrt{2})^n = x_n + y_n\sqrt{2}. n=1n = 1: (3,2)(3, 2). n=2n = 2: (17,12)(17, 12). n=3n = 3: (99,70)(99, 70). n=4n = 4: (577,408)(577, 408). \blacksquare
Problem. Find the fundamental solution to x23y2=1x^2 - 3y^2 = 1.
Solution3=[1;1,2]\sqrt{3} = [1; \overline{1, 2}]Period =2\ell = 2 (even). Convergents: p0/q0=1/1p_0/q_0 = 1/1, p1/q1=2/1p_1/q_1 = 2/1. a2=2a_2 = 2: p2=22+1=5p_2 = 2 \cdot 2 + 1 = 5, q2=21+1=3q_2 = 2 \cdot 1 + 1 = 3. Since =2\ell = 2 is even, the fundamental solution is (p1,q1)=(p1,q1)=(2,1)(p_{\ell-1}, q_{\ell-1}) = (p_1, q_1) = (2, 1). Check: 22312=43=12^2 - 3 \cdot 1^2 = 4 - 3 = 1. Confirmed. All solutions: (2+3)n=xn+yn3(2 + \sqrt{3})^n = x_n + y_n\sqrt{3}. n=1n = 1: (2,1)(2, 1). n=2n = 2: (7,4)(7, 4). n=3n = 3: (26,15)(26, 15). n=4n = 4: (97,56)(97, 56). \blacksquare
### 10.4 The Method of Descent Theorem 10.4. The equation x4+y4=z2x^4 + y^4 = z^2 has no non-trivial integer solutions. Proof (sketch). Assume a minimal solution (x,y,z)(x, y, z) with z>0z > 0 minimal. Then (x2,y2,z)(x^2, y^2, z) Is a Pythagorean triple. Using the parameterization of Pythagorean triples and infinite descent, one Constructs a smaller solution, contradicting minimality. \blacksquare Corollary 10.5. The equation x4+y4=z4x^4 + y^4 = z^4 has no non-trivial integer solutions (this is Fermat’s last theorem for n=4n = 4). ### 10.5 The Generalized Riemann Hypothesis Conjecture (Generalized Riemann Hypothesis). All non-trivial zeros of the Dirichlet LL-function L(s,χ)L(s, \chi) for any Dirichlet character χ\chi lie on the line Re(s)=1/2\mathrm{Re}(s) = 1/2. This is one of the most important open problems in mathematics. It has profound implications for the Distribution of primes in arithmetic progressions and the error terms in various number-theoretic Estimates. ## 11. Algebraic Number Theory: Gaussian Integers ### 11.1 The Gaussian Integers Definition. The Gaussian integers are Z[i]=a+bi:a,bZ\mathbb{Z}[i] = \\{a + bi : a, b \in \mathbb{Z}\\} Where i=1i = \sqrt{-1}. They form a commutative ring with unity under the usual addition and Multiplication of complex numbers. ### 11.2 Norm and Units The norm of α=a+biZ[i]\alpha = a + bi \in \mathbb{Z}[i] is N(α)=a2+b2=ααˉN(\alpha) = a^2 + b^2 = \alpha \bar{\alpha}. Proposition 11.1. N(αβ)=N(α)N(β)N(\alpha\beta) = N(\alpha)N(\beta). Proposition 11.2. The units of Z[i]\mathbb{Z}[i] are 1,1,i,i\\{1, -1, i, -i\\} (exactly those with norm 11). ### 11.3 Primes in Gaussian Integers Theorem 11.3. An element πZ[i]\pi \in \mathbb{Z}[i] is prime if and only if one of the following Holds: 1. π=u(1+i)\pi = u(1 + i) for some unit uu (up to associates, π=1+i\pi = 1 + iWith norm 22). 2. π=u(a+bi)\pi = u(a + bi) where a2+b2=pa^2 + b^2 = p for a prime p1(mod4)p \equiv 1 \pmod{4}. 3. π=up\pi = up where p3(mod4)p \equiv 3 \pmod{4} is a prime in Z\mathbb{Z}. Proof. If N(π)=pN(\pi) = p where p1(mod4)p \equiv 1 \pmod{4} is prime, then π\pi is Gaussian prime. If p3(mod4)p \equiv 3 \pmod{4}Then pp is Gaussian prime (since p=(a+bi)(c+di)p = (a + bi)(c + di) would give p2=N(p)=(a2+b2)(c2+d2)p^2 = N(p) = (a^2 + b^2)(c^2 + d^2)Forcing one factor to have norm 11A unit). The prime 2=(1+i)(1i)=(1+i)2(i)2 = (1 + i)(1 - i) = (1+i)^2 \cdot (-i)So 1+i1 + i is Gaussian prime with norm 22. \blacksquare Corollary 11.4 (Fermat’s Theorem on Sums of Two Squares). A prime pp can be written as a sum of Two squares if and only if p=2p = 2 or p1(mod4)p \equiv 1 \pmod{4}. Proof. For p1(mod4)p \equiv 1 \pmod{4}: by quadratic reciprocity, 1-1 is a QR mod ppSo a21(modp)a^2 \equiv -1 \pmod{p} for some aa. Then p(a2+1)=(a+i)(ai)p \mid (a^2 + 1) = (a + i)(a - i) in Z[i]\mathbb{Z}[i]. If pp were prime in Z[i]\mathbb{Z}[i]It would divide a+ia + i or aia - iBut neither quotient is in Z[i]\mathbb{Z}[i]. So p=αβp = \alpha\beta with neither a unit, giving p2=N(p)=N(α)N(β)p^2 = N(p) = N(\alpha)N(\beta) So N(α)=N(β)=pN(\alpha) = N(\beta) = pI.e., p=a2+b2p = a^2 + b^2. \blacksquare ### 11.4 The Gaussian Integers Form a UFD Theorem 11.5. Z[i]\mathbb{Z}[i] is a Euclidean domain (with norm as the Euclidean function), hence A PID, hence a UFD. Proof. For α,βZ[i]\alpha, \beta \in \mathbb{Z}[i] with β0\beta \neq 0Write α/β=s+ti\alpha/\beta = s + ti With s,tQs, t \in \mathbb{Q}. Choose m,nZm, n \in \mathbb{Z} with sm1/2|s - m| \leq 1/2 and tn1/2|t - n| \leq 1/2. Set q=m+niq = m + ni and r=αβqr = \alpha - \beta q. Then rZ[i]r \in \mathbb{Z}[i] and N(r)=N(β)N(α/βq)=N(β)((sm)2+(tn)2)N(β)1/2<N(β)N(r) = N(\beta) \cdot N(\alpha/\beta - q) = N(\beta)((s-m)^2 + (t-n)^2) \leq N(\beta) \cdot 1/2 \lt N(\beta). So Z[i]\mathbb{Z}[i] is Euclidean. \blacksquare ### 11.5 Worked Example Problem. Factor 55 in Z[i]\mathbb{Z}[i]. Solution. N(5)=25N(5) = 25. We need a2+b2=5a^2 + b^2 = 5Which gives (a,b)=(1,2)(a, b) = (1, 2) or (2,1)(2, 1). So 5=(1+2i)(12i)=(2+i)(2i)5 = (1 + 2i)(1 - 2i) = (2 + i)(2 - i). Note that 1+2i1 + 2i and 2i2 - i differ by a unit: 1+2i=i(2i)1 + 2i = -i(2 - i). So up to associates, 5=(2+i)(2i)5 = (2 + i)(2 - i). \blacksquare Problem. Factor 1313 in Z[i]\mathbb{Z}[i] and verify that 13=a2+b213 = a^2 + b^2.
SolutionSince 131(mod4)13 \equiv 1 \pmod{4}It factors in Z[i]\mathbb{Z}[i]. We need a2+b2=13a^2 + b^2 = 13 with a,bZa, b \in \mathbb{Z}. Trying: a213a^2 \leq 13So a0,1,2,3a \in \\{0, 1, 2, 3\\}. a=2a = 2: b2=9b^2 = 9, b=3b = 3. So 13=22+32=(2+3i)(23i)13 = 2^2 + 3^2 = (2 + 3i)(2 - 3i). Verification: (2+3i)(23i)=4+9=13(2 + 3i)(2 - 3i) = 4 + 9 = 13. Both 2+3i2 + 3i and 23i2 - 3i are Gaussian primes Since N(2+3i)=13N(2 + 3i) = 13 is prime. \blacksquare
### 11.6 Associates and Irreducibility Definition. Two Gaussian integers α,β\alpha, \beta are associates if α=uβ\alpha = u\beta for some Unit u1,1,i,iu \in \\{1, -1, i, -i\\}. Associates have the same norm. Proposition 11.6. A Gaussian integer α\alpha is irreducible if and only if N(α)N(\alpha) is either A prime in Z\mathbb{Z} or the square of a prime in Z\mathbb{Z}. Proof. If N(α)=pN(\alpha) = p (prime in Z\mathbb{Z}) and α=βγ\alpha = \beta\gammaThen N(α)=N(β)N(γ)=pN(\alpha) = N(\beta)N(\gamma) = pSo one of N(β),N(γ)N(\beta), N(\gamma) equals 11Making that Factor a unit. Conversely, if α\alpha is irreducible, then N(α)N(\alpha) has no nontrivial Factorizations compatible with factorizations of α\alpha. \blacksquare Problem. Determine whether the following Gaussian integers are irreducible: 3+4i3 + 4i, 6+7i6 + 7i, 2+5i2 + 5i.
Solution3+4i3 + 4i: N(3+4i)=9+16=25=52N(3 + 4i) = 9 + 16 = 25 = 5^2. This is a square of a prime, so 3+4i3 + 4i may or may Not be irreducible. In fact, (2+i)2=4+4i+i2=3+4i(2+i)^2 = 4 + 4i + i^2 = 3 + 4iSo 3+4i3 + 4i is reducible. 6+7i6 + 7i: N(6+7i)=36+49=85=517N(6 + 7i) = 36 + 49 = 85 = 5 \cdot 17. Neither 55 nor 1717 is a square of a prime, And N(6+7i)N(6 + 7i) is not prime. We check if 6+7i6 + 7i has a proper factor. If 6+7i=(a+bi)(c+di)6 + 7i = (a + bi)(c + di) With N(a+bi)=5N(a + bi) = 5Then a2+b2=5a^2 + b^2 = 5Giving (a,b)=(1,2)(a, b) = (1, 2) or (2,1)(2, 1). Check: (1+2i)(2+3i)=2+3i+4i+6i2=4+7i6+7i(1 + 2i)(2 + 3i) = 2 + 3i + 4i + 6i^2 = -4 + 7i \neq 6 + 7i. (1+2i)(3+2i)=3+2i+6i+4i2=1+8i(1+2i)(3+2i) = 3 + 2i + 6i + 4i^2 = -1 + 8i. (2+i)(3+4i)=6+8i+3i+4i2=2+11i(2+i)(3+4i) = 6 + 8i + 3i + 4i^2 = 2 + 11i. (2+i)(4+3i)=8+6i+4i+3i2=5+10i(2+i)(4+3i) = 8 + 6i + 4i + 3i^2 = 5 + 10i. (1+2i)(4+3i)=4+3i+8i+6i2=2+11i(1+2i)(4+3i) = 4 + 3i + 8i + 6i^2 = -2 + 11i. None match, so 6+7i6 + 7i is irreducible. 2+5i2 + 5i: N(2+5i)=4+25=29N(2 + 5i) = 4 + 25 = 29Which is prime. So 2+5i2 + 5i is irreducible. \blacksquare
### 11.7 Division in Gaussian Integers Proposition 11.7. If α,βZ[i]\alpha, \beta \in \mathbb{Z}[i] with β0\beta \neq 0Then there exist κ,ρZ[i]\kappa, \rho \in \mathbb{Z}[i] such that α=βκ+ρ\alpha = \beta\kappa + \rho with N(ρ)<N(β)N(\rho) \lt N(\beta). This is the Euclidean algorithm for Z[i]\mathbb{Z}[i] (proved in Theorem 11.5). Problem. Divide 11+3i11 + 3i by 4i4 - i in Z[i]\mathbb{Z}[i]Finding quotient and remainder.
Solution11+3i4i=(11+3i)(4+i)(4i)(4+i)=44+11i+12i+3i217=41+23i17=4117+2317i\frac{11 + 3i}{4 - i} = \frac{(11 + 3i)(4 + i)}{(4 - i)(4 + i)} = \frac{44 + 11i + 12i + 3i^2}{17} = \frac{41 + 23i}{17} = \frac{41}{17} + \frac{23}{17}i. Round: κ=2+1i=2+i\kappa = 2 + 1i = 2 + i. ρ=(11+3i)(4i)(2+i)=(11+3i)(8+4i2ii2)=(11+3i)(9+2i)=2+i\rho = (11 + 3i) - (4 - i)(2 + i) = (11 + 3i) - (8 + 4i - 2i - i^2) = (11 + 3i) - (9 + 2i) = 2 + i. Check: N(ρ)=N(2+i)=5<N(4i)=17N(\rho) = N(2 + i) = 5 \lt N(4 - i) = 17. \blacksquare
## 12. Arithmetic Functions ### 12.1 Multiplicative Functions Definition. An arithmetic function f ⁣:NCf \colon \mathbb{N} \to \mathbb{C} is multiplicative if f(mn)=f(m)f(n)f(mn) = f(m)f(n) whenever gcd(m,n)=1\gcd(m, n) = 1. It is completely multiplicative if f(mn)=f(m)f(n)f(mn) = f(m)f(n) for all m,nm, n. Proposition 12.1. If ff is multiplicative and n=p1a1pkakn = p_1^{a_1} \cdots p_k^{a_k}Then f(n)=f(p1a1)f(pkak)f(n) = f(p_1^{a_1}) \cdots f(p_k^{a_k}). Example. ϕ(n)\phi(n) is multiplicative (but not completely multiplicative). ϕ(6)=2ϕ(2)ϕ(2)=1\phi(6) = 2 \neq \phi(2)\phi(2) = 1. ### 12.2 The Sum-of-Divisors Function Definition. σ(n)=dnd\sigma(n) = \sum_{d \mid n} d (the sum of all positive divisors of nn). τ(n)=dn1\tau(n) = \sum_{d \mid n} 1 (the number of positive divisors of nn). Proposition 12.2. If n=p1a1pkakn = p_1^{a_1} \cdots p_k^{a_k}Then σ(n)=i=1kpiai+11pi1,τ(n)=i=1k(ai+1)\sigma(n) = \prod_{i=1}^k \frac{p_i^{a_i + 1} - 1}{p_i - 1}, \quad \tau(n) = \prod_{i=1}^k (a_i + 1) Proof. Both σ\sigma and τ\tau are multiplicative (since the divisor structure of mnmn with gcd(m,n)=1\gcd(m,n) = 1 factors as the product of the divisor structures of mm and nn). So it suffices To verify the formula for prime powers. For n=pan = p^a: the divisors are 1,p,p2,,pa1, p, p^2, \ldots, p^aGiving σ(pa)=1+p+p2++pa=pa+11p1,τ(pa)=a+1\sigma(p^a) = 1 + p + p^2 + \cdots + p^a = \frac{p^{a+1} - 1}{p - 1}, \quad \tau(p^a) = a + 1 The general formula follows from multiplicativity. \blacksquare Definition. nn is perfect if σ(n)=2n\sigma(n) = 2n. Theorem 12.3 (Euclid—Euler). An even number nn is perfect if and only if n=2p1(2p1)n = 2^{p-1}(2^p - 1) Where 2p12^p - 1 is a Mersenne prime. Proof. If n=2p1(2p1)n = 2^{p-1}(2^p - 1) with 2p12^p - 1 prime, then σ(n)=σ(2p1)σ(2p1)=(2p1)2p=2n\sigma(n) = \sigma(2^{p-1})\sigma(2^p - 1) = (2^p - 1) \cdot 2^p = 2n. Conversely, if nn is even And perfect, write n=2p1mn = 2^{p-1}m with mm odd. Then σ(n)=(2p1)σ(m)=2pm\sigma(n) = (2^p - 1)\sigma(m) = 2^p mSo σ(m)=2pm/(2p1)\sigma(m) = 2^p m / (2^p - 1). Since σ(m)\sigma(m) must be an integer, (2p1)m(2^p - 1) \mid m. Write m=(2p1)qm = (2^p - 1)q. Then σ(m)=2pq\sigma(m) = 2^p qBut also σ(m)m+1=(2p1)q+1\sigma(m) \geq m + 1 = (2^p - 1)q + 1. If q>1q > 1Then σ(m)m+1+q>2pq\sigma(m) \geq m + 1 + q > 2^p q Contradiction. So q=1q = 1 and m=2p1m = 2^p - 1 is prime. \blacksquare ### 12.3 The Möbius Function Definition. The Möbius function μ ⁣:N1,0,1\mu \colon \mathbb{N} \to \\{-1, 0, 1\\} is defined by: - μ(1)=1\mu(1) = 1. - μ(n)=0\mu(n) = 0 if nn is divisible by a square of a prime (nn is not squarefree). - μ(n)=(1)k\mu(n) = (-1)^k if nn is a product of kk distinct primes. Proposition 12.4 (Properties of μ\mu). 1. μ\mu is multiplicative: if gcd(m,n)=1\gcd(m, n) = 1Then μ(mn)=μ(m)μ(n)\mu(mn) = \mu(m)\mu(n). 2. dnμ(d)=1\sum_{d \mid n} \mu(d) = 1 if n=1n = 1 and 00 if n>1n > 1. Proof of (2). If n=1n = 1: d1μ(d)=μ(1)=1\sum_{d \mid 1} \mu(d) = \mu(1) = 1. If n>1n > 1Write n=p1a1pkakn = p_1^{a_1} \cdots p_k^{a_k}. By multiplicativity, dnμ(d)=i=1kj=0aiμ(pij)\sum_{d \mid n} \mu(d) = \prod_{i=1}^k \sum_{j=0}^{a_i} \mu(p_i^j). For each factor: j=0aiμ(pij)=μ(1)+μ(pi)+μ(pi2)+=1+(1)+0+=0\sum_{j=0}^{a_i} \mu(p_i^j) = \mu(1) + \mu(p_i) + \mu(p_i^2) + \cdots = 1 + (-1) + 0 + \cdots = 0 Since ai1a_i \geq 1. \blacksquare ### 12.4 Dirichlet Convolution Definition. The Dirichlet convolution of two arithmetic functions ff and gg is (fg)(n)=dnf(d)g ⁣(nd)(f * g)(n) = \sum_{d \mid n} f(d) \cdot g\!\left(\frac{n}{d}\right) Proposition 12.5 (Properties of Dirichlet convolution). 1. Commutativity: fg=gff * g = g * f. 2. Associativity: (fg)h=f(gh)(f * g) * h = f * (g * h). 3. Identity element: The function ε(n)={1n=10n>1\varepsilon(n) = \begin{cases} 1 & n = 1 \\ 0 & n > 1 \end{cases} satisfies fε=ff * \varepsilon = f. 4. Möbius inversion: μ\mu is the convolution inverse of 1\mathbf{1} (where 1(n)=1\mathbf{1}(n) = 1 for all nn), i.e., 1μ=ε\mathbf{1} * \mu = \varepsilon. Proof of (1). (fg)(n)=dnf(d)g(n/d)(f * g)(n) = \sum_{d \mid n} f(d)g(n/d). Setting e=n/de = n/dThis equals enf(n/e)g(e)=(gf)(n)\sum_{e \mid n} f(n/e)g(e) = (g * f)(n). \blacksquare ### 12.5 Möbius Inversion Theorem 12.6 (Möbius Inversion). If f(n)=dng(d)f(n) = \sum_{d \mid n} g(d) for all n1n \geq 1Then g(n)=dnμ(d)f(n/d)g(n) = \sum_{d \mid n} \mu(d) f(n/d) Proof. In terms of Dirichlet convolution: f=g1f = g * \mathbf{1}So fμ=(g1)μ=g(1μ)=gε=gf * \mu = (g * \mathbf{1}) * \mu = g * (\mathbf{1} * \mu) = g * \varepsilon = g. The explicit form Follows by writing out the convolution: dnμ(d)f(n/d)=dnμ(d)e(n/d)g(e)=eng(e)d(n/e)μ(d)\sum_{d \mid n} \mu(d) f(n/d) = \sum_{d \mid n} \mu(d) \sum_{e \mid (n/d)} g(e) = \sum_{e \mid n} g(e) \sum_{d \mid (n/e)} \mu(d). The inner sum is 11 if e=ne = n and 00 otherwise, so only g(n)g(n) remains. \blacksquare ### 12.6 Euler’s Totient Summation Formula Proposition 12.7. k=1nϕ(k)=3π2n2+O(nlogn)\sum_{k=1}^{n} \phi(k) = \frac{3}{\pi^2} n^2 + O(n \log n). Intuition. The probability that two random integers are coprime is 1/ζ(2)=6/π21/\zeta(2) = 6/\pi^2. The Number of pairs (a,b)(a, b) with 1abn1 \leq a \leq b \leq n and gcd(a,b)=1\gcd(a, b) = 1 is b=1nϕ(b)\sum_{b=1}^n \phi(b)Which should be approximately 126π2n2=3π2n2\frac{1}{2} \cdot \frac{6}{\pi^2} n^2 = \frac{3}{\pi^2}n^2. ### 12.7 Worked Examples Problem. Express dnϕ(d)\sum_{d \mid n} \phi(d) in closed form. Solution. Let f(n)=dnϕ(d)f(n) = \sum_{d \mid n} \phi(d). We claim f(n)=nf(n) = n. Since ϕ\phi is multiplicative, ff is multiplicative. For n=pan = p^a: f(pa)=j=0aϕ(pj)=ϕ(1)+ϕ(p)++ϕ(pa)=1+(p1)+(p2p)++(papa1)=paf(p^a) = \sum_{j=0}^a \phi(p^j) = \phi(1) + \phi(p) + \cdots + \phi(p^a) = 1 + (p - 1) + (p^2 - p) + \cdots + (p^a - p^{a-1}) = p^a. So f(n)=nf(n) = n. This can also be proved directly: the integers 1,2,,n1, 2, \ldots, n are partitioned by Their gcd with nnAnd the number with gcd(k,n)=d\gcd(k, n) = d is ϕ(n/d)\phi(n/d). \blacksquare Problem. Use Möbius inversion to find a formula for ϕ(n)\phi(n) in terms of the divisors of nn.
SolutionWe know dnϕ(d)=n\sum_{d \mid n} \phi(d) = n. By Möbius inversion: ϕ(n)=dnμ(d)nd=ndnμ(d)d=npn(11p)\phi(n) = \sum_{d \mid n} \mu(d) \cdot \frac{n}{d} = n \sum_{d \mid n} \frac{\mu(d)}{d} = n \prod_{p \mid n}\left(1 - \frac{1}{p}\right) The last equality uses the multiplicative property of μ\mu: the sum dnμ(d)/d\sum_{d \mid n} \mu(d)/d factors Over prime powers as pn(11/p)\prod_{p \mid n} (1 - 1/p). \blacksquare
Problem. Compute d60μ(d)σ(60/d)\sum_{d \mid 60} \mu(d) \cdot \sigma(60/d).
Solution60=223560 = 2^2 \cdot 3 \cdot 5. The divisors of 6060 are 1,2,3,4,5,6,10,12,15,20,30,60\\{1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60\\}. μ\mu is nonzero only for squarefree divisors: μ(1)=1\mu(1) = 1, μ(2)=1\mu(2) = -1, μ(3)=1\mu(3) = -1, μ(5)=1\mu(5) = -1, μ(6)=1\mu(6) = 1, μ(10)=1\mu(10) = 1, μ(15)=1\mu(15) = 1, μ(30)=1\mu(30) = -1. σ(60)=168\sigma(60) = 168, σ(30)=72\sigma(30) = 72, σ(20)=42\sigma(20) = 42, σ(15)=24\sigma(15) = 24 σ(12)=28\sigma(12) = 28, σ(10)=18\sigma(10) = 18, σ(6)=12\sigma(6) = 12, σ(1)=1\sigma(1) = 1. d60μ(d)σ(60/d)=1168+(1)72+(1)42+(1)24+128+118+112+(1)1=168724224+28+18+121=87\sum_{d \mid 60} \mu(d)\sigma(60/d) = 1 \cdot 168 + (-1) \cdot 72 + (-1) \cdot 42 + (-1) \cdot 24 + 1 \cdot 28 + 1 \cdot 18 + 1 \cdot 12 + (-1) \cdot 1 = 168 - 72 - 42 - 24 + 28 + 18 + 12 - 1 = 87. This computes the Dirichlet convolution (μσ)(60)(\mu * \sigma)(60). \blacksquare
### 12.8 Perfect Numbers and Amicable Numbers Definition. Two positive integers mm and nn are amicable (or friendly) if σ(m)=σ(n)=m+n\sigma(m) = \sigma(n) = m + n. The pair (m,n)(m, n) is called an amicable pair. Example. (220,284)(220, 284) is the smallest amicable pair: σ(220)=σ(22)σ(5)σ(11)=7612=504=220+284\sigma(220) = \sigma(2^2)\sigma(5)\sigma(11) = 7 \cdot 6 \cdot 12 = 504 = 220 + 284. σ(284)=σ(4)σ(71)=772=504=220+284\sigma(284) = \sigma(4)\sigma(71) = 7 \cdot 72 = 504 = 220 + 284. Proposition 12.9. If mm and nn form an amicable pair, then σ(m)m=σ(n)n\frac{\sigma(m)}{m} = \frac{\sigma(n)}{n}. Problem. Show that (1184,1210)(1184, 1210) is an amicable pair.
Solution1184=25371184 = 2^5 \cdot 37. σ(1184)=σ(32)σ(37)=6338=2394\sigma(1184) = \sigma(32)\sigma(37) = 63 \cdot 38 = 2394. 1210=251121210 = 2 \cdot 5 \cdot 11^2. σ(1210)=σ(2)σ(5)σ(121)=36133=2394\sigma(1210) = \sigma(2)\sigma(5)\sigma(121) = 3 \cdot 6 \cdot 133 = 2394. 1184+1210=2394=σ(1184)=σ(1210)1184 + 1210 = 2394 = \sigma(1184) = \sigma(1210). Confirmed: (1184,1210)(1184, 1210) is amicable. \blacksquare
### 12.9 Ramanujan’s Tau Function Definition. Ramanujan’s tau function τ(n)\tau(n) (not to be confused with the divisor-counting Function) is defined by the identity n=1τ(n)qn=qn=1(1qn)24\sum_{n=1}^{\infty} \tau(n) q^n = q \prod_{n=1}^{\infty}(1 - q^n)^{24} Proposition 12.10 (Ramanujan’s congruences). For all n1n \geq 1: 1. τ(5n)τ(n)(mod5)\tau(5n) \equiv \tau(n) \pmod{5} 2. τ(7n)τ(n)(mod7)\tau(7n) \equiv \tau(n) \pmod{7} 3. τ(11n)τ(n)(mod11)\tau(11n) \equiv \tau(n) \pmod{11} These congruences were conjectured by Ramanujan in 1916 and proved by Mordell in 1917. They Were later explained by Deligne’s …/1-number-and-algebra/3_proof-and-logic of the Weil conjectures. ## 13. Additional Topics ### 13.1 Wilson’s Theorem Theorem 13.1 (Wilson’s Theorem). pp is prime if and only if (p1)!1(modp)(p - 1)! \equiv -1 \pmod{p}. Proof. If pp is prime: in Z/pZ\mathbb{Z}/p\mathbb{Z}Each element pairs with its inverse. The only Self-inverse elements are 11 and p1p - 1. So (p1)!1(p1)1(modp)(p-1)! \equiv 1 \cdot (p-1) \equiv -1 \pmod{p}. Conversely, if nn is composite and n>4n > 4Then (n1)!0(modn)(n-1)! \equiv 0 \pmod{n} since nn has a proper Factor appearing in (n1)!(n-1)!. \blacksquare ### 13.2 The Ring Z/nZ\mathbb{Z}/n\mathbb{Z} Theorem 13.2. The ring Z/nZ\mathbb{Z}/n\mathbb{Z} is a field if and only if nn is prime. Proposition 13.3. (Z/nZ)(\mathbb{Z}/n\mathbb{Z})^* has order ϕ(n)\phi(n) and is a group under Multiplication. ### 13.3 Dirichlet’s Theorem on Primes in Arithmetic Progressions Theorem 13.4 (Dirichlet). If gcd(a,m)=1\gcd(a, m) = 1Then there are infinitely many primes of the form a+kma + km (k0k \geq 0). Proof (sketch). Dirichlet introduced LL-functions L(s,χ)=n=1χ(n)/nsL(s, \chi) = \sum_{n=1}^{\infty} \chi(n)/n^s Where χ\chi is a Dirichlet character mod mm. The key steps are: 1. L(s,χ0)L(s, \chi_0) has a simple pole at s=1s = 1 (where χ0\chi_0 is the principal character). 2. L(1,χ)0L(1, \chi) \neq 0 for non-principal characters χ\chi. 3. logL(s,χ0)=plog(1χ0(p)/ps)1=pk1χ0(pk)/(kpks)\log L(s, \chi_0) = \sum_p \log(1 - \chi_0(p)/p^s)^{-1} = \sum_p \sum_{k \geq 1} \chi_0(p^k)/(kp^{ks}). 4. Combining over all characters: χlogL(s,χ)\sum_\chi \log L(s, \chi) diverges as s1+s \to 1^+And the contribution from χ0\chi_0 captures primes pa(modm)p \equiv a \pmod{m}. \blacksquare ### 13.4 The Frobenius Coin Problem Theorem 13.5 (Frobenius). If gcd(a,b)=1\gcd(a, b) = 1 and a,ba, b are positive, then the largest integer That cannot be expressed as ax+byax + by with x,y0x, y \geq 0 is ababab - a - b. Proof. First, we show every integer nabn \geq ab can be written as ax+byax + by with x,y0x, y \geq 0. Since gcd(a,b)=1\gcd(a, b) = 1The set 0,a,2a,,(b1)a\\{0, a, 2a, \ldots, (b-1)a\\} is a complete residue system modulo bb. So for any n0n \geq 0There exists xx with 0xb10 \leq x \leq b - 1 and axn(modb)ax \equiv n \pmod{b}Meaning nax=byn - ax = by for some integer yy. When n(b1)an \geq (b-1)aWe have by=nax0by = n - ax \geq 0So y0y \geq 0. Thus all n(b1)a=aban \geq (b-1)a = ab - a are representable. To show ababab - a - b is not representable: if abab=ax+byab - a - b = ax + by with x,y0x, y \geq 0Then ab=a(x+1)+b(y+1)ab = a(x+1) + b(y+1)So ba(x+1)b \mid a(x+1)Hence b(x+1)b \mid (x+1) (since gcd(a,b)=1\gcd(a,b) = 1). So x+1bx + 1 \geq bGiving axa(b1)=abaax \geq a(b-1) = ab - a. Then by=ababaxabab(aba)=b<0by = ab - a - b - ax \leq ab - a - b - (ab - a) = -b \lt 0 Contradicting y0y \geq 0. \blacksquare Problem. What is the largest amount of postage that cannot be made using 6-cent and 11-cent stamps?
Solutiongcd(6,11)=1\gcd(6, 11) = 1. By the Frobenius theorem, the largest non-representable amount is 611611=6617=496 \cdot 11 - 6 - 11 = 66 - 17 = 49 cents. Verification: 49=6x+11y49 = 6x + 11y requires yy odd (since 4911y49 - 11y must be even). y=1y = 1: 38/638/6 (no). y=3y = 3: 16/616/6 (no). y=5y = 5: 6/6-6/6 (negative). So 4949 is indeed not representable. 50=64+11250 = 6 \cdot 4 + 11 \cdot 2, 51=65+11151 = 6 \cdot 5 + 11 \cdot 1, 52=67+11052 = 6 \cdot 7 + 11 \cdot 0. All Values 5050 and above are representable. \blacksquare
### 13.5 The Carmichael Function Definition. The Carmichael function λ(n)\lambda(n) is the smallest positive integer such that aλ(n)1(modn)a^{\lambda(n)} \equiv 1 \pmod{n} for all aa with gcd(a,n)=1\gcd(a, n) = 1. For n=p1a1pkakn = p_1^{a_1} \cdots p_k^{a_k}: λ(n)=lcm ⁣(λ(p1a1),,λ(pkak))\lambda(n) = \mathrm{lcm}\!\left(\lambda(p_1^{a_1}), \ldots, \lambda(p_k^{a_k})\right) Where λ(2)=1\lambda(2) = 1, λ(4)=2\lambda(4) = 2, λ(2k)=2k2\lambda(2^k) = 2^{k-2} for k3k \geq 3And λ(pk)=(p1)pk1\lambda(p^k) = (p-1)p^{k-1} for odd primes pp. Proposition 13.6. λ(n)ϕ(n)\lambda(n) \mid \phi(n) for all n1n \geq 1And λ(n)=ϕ(n)\lambda(n) = \phi(n) precisely When n=1,2,4n = 1, 2, 4, n=pkn = p^kOr n=2pkn = 2p^k (where pp is an odd prime). Intuition. The Carmichael function gives the exponent of the group (Z/nZ)(\mathbb{Z}/n\mathbb{Z})^* Which equals the lcm of the orders of all elements. Euler’s totient ϕ(n)\phi(n) gives the order of The group. The exponent always divides the order, with equality exactly when the group is cyclic (i.e., when a primitive root exists). Theorem 13.7 (Korselt’s Criterion). nn is a Carmichael number (composite nn with an11(modn)a^{n-1} \equiv 1 \pmod{n} for all gcd(a,n)=1\gcd(a, n) = 1) if and only if: 1. nn is squarefree, and 2. For every prime pnp \mid n, (p1)(n1)(p - 1) \mid (n - 1). Proof. If nn is squarefree with n=p1pkn = p_1 \cdots p_kThen λ(n)=lcm(p11,,pk1)\lambda(n) = \mathrm{lcm}(p_1 - 1, \ldots, p_k - 1). We need λ(n)(n1)\lambda(n) \mid (n - 1)Which is equivalent to each (pi1)(n1)(p_i - 1) \mid (n - 1). \blacksquare Example. 561=31117561 = 3 \cdot 11 \cdot 17. Check: 31=25603 - 1 = 2 \mid 560, 111=1056011 - 1 = 10 \mid 560 171=1656017 - 1 = 16 \mid 560. So 561561 is a Carmichael number (the smallest). ### 13.6 Sophie Germain Primes Definition. A prime pp is a Sophie Germain prime if 2p+12p + 1 is also prime. The prime q=2p+1q = 2p + 1 is called a safe prime. Sophie Germain primes arise in the study of Fermat’s last theorem: if pp is a Sophie Germain prime, then there are no non-zero integer solutions to xp+yp=zpx^p + y^p = z^p with pxyzp \nmid xyz (this was proved by Sophie Germain). Proposition 13.8. If q=2p+1q = 2p + 1 is a safe prime and aa is a quadratic residue modulo qq Then ap1(modq)a^p \equiv 1 \pmod{q}. Proof. By Euler’s criterion, a(q1)/2=ap1(modq)a^{(q-1)/2} = a^p \equiv 1 \pmod{q}. \blacksquare The first few Sophie Germain primes are: 2,3,5,11,23,29,41,53,83,89,113,2, 3, 5, 11, 23, 29, 41, 53, 83, 89, 113, \ldots It is conjectured (but not proved) that there are infinitely many Sophie Germain primes. ### 13.7 Mersenne and Fermat Primes Definition. A Mersenne prime is a prime of the form Mp=2p1M_p = 2^p - 1 where pp is prime. A Fermat prime is a prime of the form Fn=22n+1F_n = 2^{2^n} + 1. Proposition 13.9. If 2p12^p - 1 is prime, then pp is prime. Proof. If p=abp = ab with a,b>1a, b > 1Then 2p1=(2a)b1=(2a1)(2a(b1)++2a+1)2^p - 1 = (2^a)^b - 1 = (2^a - 1)(2^{a(b-1)} + \cdots + 2^a + 1) Which is composite. \blacksquare Proposition 13.10. If 22n+12^{2^n} + 1 is prime, then nn is a power of 22. Proof. If n=abn = ab with bb odd, then 22n+1=(22a)2na+12^{2^n} + 1 = (2^{2^a})^{2^{n-a}} + 1And we can factor x2k+1=(x2k1+1)22x2k1x^{2^k} + 1 = (x^{2^{k-1}} + 1)^2 - 2x^{2^{k-1}}Which allows induction. \blacksquare The known Fermat primes are F0=3F_0 = 3, F1=5F_1 = 5, F2=17F_2 = 17, F3=257F_3 = 257, F4=65537F_4 = 65537. No others are known, and it is conjectured that these are the only ones. ## 14. Additional Results ### 14.1 Fermat’s Last Theorem Theorem 14.1 (Wiles, 1995). For n3n \geq 3The equation xn+yn=znx^n + y^n = z^n has no non-zero Integer solutions. The …/1-number-and-algebra/3_proof-and-logic is far beyond our scope, using deep results from algebraic geometry (elliptic curves, Modular forms, Galois representations). ### 14.1a The Twin Prime Conjecture Conjecture (Twin Prime Conjecture). There are infinitely many primes pp such that p+2p + 2 Is also prime. The largest known twin prime pair (as of 2026) contains numbers with over 400,000 digits. In 2013, Yitang Zhang proved that there exists some constant N<7×107N \lt 7 \times 10^7 such that infinitely many Prime pairs (p,p+N)(p, p + N) exist. This bound has since been improved to N246N \leq 246 by the Polymath project. Theorem 14.1a (Brun, 1919). The sum of the reciprocals of the twin primes converges: p primep+2 prime(1p+1p+2)<\sum_{\substack{p \mathrm{\ prime} \\ p+2 \mathrm{\ prime}} \left(\frac{1}{p} + \frac{1}{p+2}\right) \lt \infty} This is known as Brun’s theorem. It establishes that the twin primes form a “thin” set, In contrast to the full set of primes (whose reciprocal sum diverges by Euler). ### 14.2 The Ring Z[5]\mathbb{Z}[\sqrt{-5}] Example. In Z[5]\mathbb{Z}[\sqrt{-5}]Unique factorization fails: 6=23=(1+5)(15)6 = 2 \cdot 3 = (1 + \sqrt{-5})(1 - \sqrt{-5}) The elements 2,3,1+5,152, 3, 1 + \sqrt{-5}, 1 - \sqrt{-5} are all irreducible but not prime (in the Ring-theoretic sense). This failure of unique factorization motivates the development of ideal Theory. ### 14.3 Quadratic Forms Definition. A binary quadratic form is Q(x,y)=ax2+bxy+cy2Q(x, y) = ax^2 + bxy + cy^2 with a,b,cZa, b, c \in \mathbb{Z}. Its discriminant is D=b24acD = b^2 - 4ac. Two forms are equivalent if one can be obtained from the other by a change of variables (x,y)(px+qy,rx+sy)(x, y) \mapsto (px + qy, rx + sy) with psqr=1ps - qr = 1. Theorem 14.2 (Gauss). The number of equivalence classes of binary quadratic forms of Discriminant D<0D \lt 0 is finite. The class number h(D)h(D) is 1 precisely for D{3,4,7,8,11,19,43,67,163}D \in \{-3, -4, -7, -8, -11, -19, -43, -67, -163\}. Remark. The fact that 163-163 is the largest such DD was conjectured by Gauss and proved by Heegner in 1952 (with later simplified …/1-number-and-algebra/3_proof-and-logics by Stark and Baker). This is the celebrated class number 1 problem. Proposition 14.2a. A binary quadratic form Q(x,y)=ax2+bxy+cy2Q(x, y) = ax^2 + bxy + cy^2 of discriminant D<0D \lt 0 represents nn if and only if DD is a quadratic residue modulo 4n4n. ### 14.4 The Class Number and Unique Factorization The class group of a quadratic field Q(D)\mathbb{Q}(\sqrt{D}) measures the failure of unique Factorization in its ring of integers. The class number h(D)h(D) is the order of this group. Theorem 14.3. Unique factorization holds in the ring of integers of Q(D)\mathbb{Q}(\sqrt{D}) If and only if h(D)=1h(D) = 1. This connects the algebraic question of unique factorization to the analytic properties of the Dedekind zeta function, via the class number formula: h(D)=D2πL(1,χD)h(D) = \frac{\sqrt{|D|}}{2\pi} \cdot L(1, \chi_D) Where L(s,χD)L(s, \chi_D) is the Dirichlet LL-function associated to the quadratic character χD\chi_D. Proposition 14.3a. The class number h(D)h(-D) grows roughly as D\sqrt{D} for large DD: h(D)DπL(1,χD)h(-D) \sim \frac{\sqrt{D}}{\pi} \cdot L(1, \chi_{-D}) as DD \to \infty. ### 14.5 Mersenne Numbers Theorem 14.4 (Lucas—Lehmer test). Let Mp=2p1M_p = 2^p - 1 with pp an odd prime. Define the sequence L0=4L_0 = 4, Ln+1=Ln22L_{n+1} = L_n^2 - 2. Then MpM_p is prime if and only if Lp20(modMp)L_{p-2} \equiv 0 \pmod{M_p}. This test makes it possible to efficiently determine the primality of Mersenne numbers, which is Why the largest known primes are Mersenne primes. Proposition 14.4a. Every even perfect number is a Mersenne prime times a power of 22. This is the Euclid—Euler theorem (Theorem 12.3) restated in terms of Mersenne primes. Problem. Use the Lucas—Lehmer test to verify that M5=31M_5 = 31 is prime.
SolutionM5=251=31M_5 = 2^5 - 1 = 31. We need L52=L30(mod31)L_{5-2} = L_3 \equiv 0 \pmod{31}. L0=4L_0 = 4 L1=422=14L_1 = 4^2 - 2 = 14 L2=1422=194L_2 = 14^2 - 2 = 194. 194=631+8194 = 6 \cdot 31 + 8So L28(mod31)L_2 \equiv 8 \pmod{31}. L3=822=620(mod31)L_3 = 8^2 - 2 = 62 \equiv 0 \pmod{31}. Since L30(mod31)L_3 \equiv 0 \pmod{31}, M5=31M_5 = 31 is prime. \blacksquare
### 14.6 The abc Conjecture Conjecture (Masser—Oesterlé, 1985). For every ε>0\varepsilon > 0There exists Kε>0K_\varepsilon > 0 Such that for all coprime positive integers a,b,ca, b, c with a+b=ca + b = c: c<Kεrad(abc)1+εc \lt K_\varepsilon \cdot \mathrm{rad}(abc)^{1 + \varepsilon} Where rad(n)=pnp\mathrm{rad}(n) = \prod_{p \mid n} p is the radical of nn (the product of distinct prime Factors). The abc conjecture is one of the most important open problems in number theory. It implies: - Fermat’s last theorem for sufficiently large exponents. - Mordell’s conjecture (Faltings’ theorem). - Roth’s theorem on Diophantine approximation. - The existence of infinitely many non-Wieferich primes. ### 14.7 The Collatz Conjecture Conjecture (Collatz, 1937). Define T ⁣:NNT \colon \mathbb{N} \to \mathbb{N} by T(n)={n/2n even3n+1n oddT(n) = \begin{cases} n/2 & n \mathrm{\ even} \\ 3n + 1 & n \mathrm{\ odd} \end{cases} For every positive integer nnThe sequence n,T(n),T(T(n)),n, T(n), T(T(n)), \ldots eventually reaches 11. Despite its simple statement, the Collatz conjecture remains open. It has been verified by computer For all starting values up to at least 2682^{68}But no general …/1-number-and-algebra/3_proof-and-logic exists. ### 14.8 Worked Example Problem. Determine all representations of n=7n = 7 as a sum of two squares. Solution. We need a2+b2=7a^2 + b^2 = 7 with a,bZa, b \in \mathbb{Z}. Checking: a27a^2 \leq 7So a0,1,2a \in \\{0, 1, 2\\}. For a=0a = 0: b2=7b^2 = 7 (no). For a=1a = 1: b2=6b^2 = 6 (no). For a=2a = 2: b2=3b^2 = 3 (no). By symmetry, a=1,2a = -1, -2 give the same. So 77 cannot be written as a sum of two Squares. This is consistent with the theorem: 73(mod4)7 \equiv 3 \pmod{4}So it is not a sum of two squares. \blacksquare ### 14.9 Worked Example: Quadratic Forms Problem. Determine the number of representations of n=65n = 65 as a sum of two squares.
Solution65=51365 = 5 \cdot 13. Both 51(mod4)5 \equiv 1 \pmod{4} and 131(mod4)13 \equiv 1 \pmod{4}So both are sums of two Squares: 5=12+225 = 1^2 + 2^2 and 13=22+3213 = 2^2 + 3^2. By the identity (a2+b2)(c2+d2)=(acbd)2+(ad+bc)2=(ac+bd)2+(adbc)2(a^2 + b^2)(c^2 + d^2) = (ac - bd)^2 + (ad + bc)^2 = (ac + bd)^2 + (ad - bc)^2: Using 5=12+225 = 1^2 + 2^2 and 13=22+3213 = 2^2 + 3^2: (1223)2+(13+22)2=(4)2+72=16+49=65(1 \cdot 2 - 2 \cdot 3)^2 + (1 \cdot 3 + 2 \cdot 2)^2 = (-4)^2 + 7^2 = 16 + 49 = 65. (12+23)2+(1322)2=82+(1)2=64+1=65(1 \cdot 2 + 2 \cdot 3)^2 + (1 \cdot 3 - 2 \cdot 2)^2 = 8^2 + (-1)^2 = 64 + 1 = 65. Also 65=82+12=72+4265 = 8^2 + 1^2 = 7^2 + 4^2. Including signs and order, the representations are (±1,±8)(\pm 1, \pm 8), (±4,±7)(\pm 4, \pm 7), (±7,±4)(\pm 7, \pm 4), (±8,±1)(\pm 8, \pm 1)Giving 1616 ordered pairs. \blacksquare
## 15. Common Pitfalls :::caution Common Pitfall The Chinese Remainder Theorem requires the moduli to be pairwise coprime. If m1m_1 and m2m_2 share a common factor ddThe system xa1(modm1)x \equiv a_1 \pmod{m_1} xa2(modm2)x \equiv a_2 \pmod{m_2} is solvable only if a1a2(modd)a_1 \equiv a_2 \pmod{d}. ::: :::caution Common Pitfall (an)=1\left(\frac{a}{n}\right) = 1 for the Jacobi symbol does NOT mean aa is A QR modulo nn. For example, (215)=(23)(25)=(1)(1)=1\left(\frac{2}{15}\right) = \left(\frac{2}{3}\right)\left(\frac{2}{5}\right) = (-1)(-1) = 1But x22(mod15)x^2 \equiv 2 \pmod{15} has no solution (checking mod 33: x22(mod3)x^2 \equiv 2 \pmod{3} is impossible). ::: :::caution Common Pitfall When using Fermat’s little theorem, remember that ap11(modp)a^{p-1} \equiv 1 \pmod{p} only when gcd(a,p)=1\gcd(a, p) = 1. The correct form for all aa is apa(modp)a^p \equiv a \pmod{p}. ::: :::caution Common Pitfall Not every prime in Z\mathbb{Z} remains prime in Z[i]\mathbb{Z}[i]. Only Primes p3(mod4)p \equiv 3 \pmod{4} remain prime in Z[i]\mathbb{Z}[i]. Primes p1(mod4)p \equiv 1 \pmod{4} factor as p=(a+bi)(abi)p = (a + bi)(a - bi)And 2=(1+i)2(i)2 = (1 + i)^2 \cdot (-i). ::: :::caution Common Pitfall The Euclidean algorithm computes gcd(a,b)\gcd(a, b) for positive integers. When Working with negative integers or polynomials, remember that gcd\gcd is defined up to a unit (sign For integers, leading coefficient for polynomials). ::: :::caution Common Pitfall When solving axb(modm)ax \equiv b \pmod{m}You must first check that gcd(a,m)b\gcd(a, m) \mid b. If not, there is no solution. If gcd(a,m)=d>1\gcd(a, m) = d > 1Divide through by dd And remember that the modulus becomes m/dm/d. ::: :::caution Common Pitfall Primitive roots do not exist for all moduli. A primitive root modulo nn Exists only for n=2n = 2, n=4n = 4, n=pkn = p^kOr n=2pkn = 2p^k where pp is an odd prime. For example, There is no primitive root modulo 88 or modulo 1515. ::: :::caution Common Pitfall In the division algorithm a=bq+ra = bq + rThe remainder satisfies 0r<b0 \leq r \lt b when b>0b > 0. When aa is negative, the quotient qq is also negative (or zero). For example, 17=5(4)+3-17 = 5 \cdot (-4) + 3Not 17=5(3)+(2)-17 = 5 \cdot (-3) + (-2). ::: :::caution Common Pitfall The Möbius function μ(n)=0\mu(n) = 0 when nn has a repeated prime factor. Only squarefree integers have nonzero Möbius function values. When using Möbius inversion, many Terms in the sum may be zero. ::: :::caution Common Pitfall Euler’s theorem requires gcd(a,n)=1\gcd(a, n) = 1. To compute akmodna^k \bmod n When gcd(a,n)1\gcd(a, n) \neq 1Factor out common prime factors first, or use the CRT to work modulo Prime power factors of nn separately.