L08 – Chinese remainder theorem, CRT map, and group

Discrete Mathematics2026年3月27日发布 芮和
1.7K 490
8,622字
36–55 分钟

Summary of Lecture 7

L07 – Prime number theorem, Fermat test, linear congruence equations, and system of linear congruences

Chebyshev’s theta function: θ(x)=pxlnp\theta(x) = \sum_{p \le x} \ln p

THEOREM:θ(x)=Θ(π(x)lnx)\theta(x) = \Theta(\pi(x) \ln x).

THEOREM: For any real number x1x \ge 1, θ(x)<(2ln2)x\theta(x) < (2 \ln 2)x.

THEOREM (Hadamard; Poussin, 1896):limxπ(x)xlnx=1\lim_{x \to \infty} \frac{\pi(x)}{\frac{x}{\ln x}} = 1

  • π(x)>xlnx(1+12lnx),x59\pi(x) > \frac{x}{\ln x}\left(1 + \frac{1}{2\ln x}\right), x \ge 59; π(x)<xlnx(1+32lnx),x>1\pi(x) < \frac{x}{\ln x}\left(1 + \frac{3}{2\ln x}\right), x > 1
    // Rosser and Schoenfeld

THEOREM:|n|2nnln2(12+O(1n))|\mathbb{P}_n| \ge \frac{2^n}{n \ln 2}\left(\frac{1}{2} + O\left(\frac{1}{n}\right)\right) when nn \to \infty.

Prime Number Generation: choose and test // at most 2nln22n \ln 2 trials

  • Fermat test: 𝐅𝐞𝐫𝐦𝐚𝐭(n,t)\textbf{Fermat}(n, t)

THEOREM: Let n+,a,b,gcd(a,n)=dn \in \mathbb{Z}^+, a, b \in \mathbb{Z}, \gcd(a, n) = d and t=(ad)1modndt = \left(\frac{a}{d}\right)^{-1} \bmod \frac{n}{d}. If d|bd \mid b, then axb(modn)ax \equiv b \pmod{n} if and only if xbdt(modnd)x \equiv \frac{b}{d}t \pmod{\frac{n}{d}}.


Chinese Remainder Theorem

THEROEM: Let n1,,nk+n_1, \dots, n_k \in \mathbb{Z}^+ be pairwise relatively prime and let n=n1nkn = n_1 \cdots n_k. Then for any b1,,bkb_1, \dots, b_k \in \mathbb{Z}, then the system

{xb1(modn1)xb2(modn2)xbk(modnk)\begin{cases}x \equiv b_1 \pmod{n_1} \\x \equiv b_2 \pmod{n_2} \\\quad \vdots \\x \equiv b_k \pmod{n_k}\end{cases}

always has a solution. Furthermore, if bb \in \mathbb{Z} is a solution, then any solution xx must satisfy xb(modn)x \equiv b \pmod n.

  • Let Ni=nniN_i = \frac{n}{n_i} for every i[k]i \in [k].
    • gcd(Ni,ni)=1\gcd(N_i, n_i) = 1 for every i[k]i \in [k].
    •  si,ti,Nisi+niti=1\exists \ s_i, t_i, N_i s_i + n_i t_i = 1.
  • Let b=b1(N1s1)++bk(Nksk)b = b_1(N_1 s_1) + \dots + b_k(N_k s_k).
    • Then bbi(modni)b \equiv b_i \pmod{n_i} for every i[k]i \in [k].
  • xbi(modni)x \equiv b_i \pmod{n_i} for all ii
    xb(modni)\implies x \equiv b \pmod{n_i} for all ii
    ni|(xb)\implies n_i | (x – b) for all ii
    (n1n2nk)|(xb)\implies (n_1 n_2 \cdots n_k) | (x – b)
    xb(modn)\implies x \equiv b \pmod n

Solution to Sun-Tsu’s Question

EXAMPLE: Solve the system {x2(mod3)x3(mod5)x2(mod7)\begin{cases}x\equiv 2\pmod{3}\\x\equiv 3\pmod{5}\\x\equiv 2\pmod{7}\end{cases}.

  • n1=3,n2=5,n3=7;n=n1n2n3=105;b1=2,b2=3,b3=2n_1 = 3, n_2 = 5, n_3 = 7; n = n_1 n_2 n_3 = 105; b_1 = 2, b_2 = 3, b_3 = 2
    • N1=n2n3=35,N2=n1n3=21,N3=n1n2=15N_1 = n_2 n_3 = 35, N_2 = n_1 n_3 = 21, N_3 = n_1 n_2 = 15
    • 12n1N1=1;4n2+N2=1;2n3+N3=112 n_1 – N_1 = 1; -4 n_2 + N_2 = 1; -2 n_3 + N_3 = 1
    • t1=12,s1=1;t2=4,s2=1;t3=2,s3=1t_1 = 12, s_1 = -1; t_2 = -4, s_2 = 1; t_3 = -2, s_3 = 1
  • b=b1(N1s1)+b2(N2s2)+b3(N3s3)b = b_1(N_1 s_1) + b_2(N_2 s_2) + b_3(N_3 s_3)
    =2(35)+3(21)+2(15)= 2 (-35) + 3 (21) + 2(15)
    =23= 23
  • xx \in \mathbb{Z} is a solution of the system iff x23(mod105)x \equiv 23 \pmod{105}
  • Solutions: [23]105[23]_{105}

CRT Map

THEOREM: Let n1,,nk+n_1, \dots, n_k \in \mathbb{Z}^+ and gcd(ni,nj)=1\gcd(n_i, n_j) = 1 for all iji \neq j. Let n=n1nkn = n_1 \cdots n_k. The CRT map θ([x]n)=([x]n1,,[x]nk)\theta([x]_n) = ([x]_{n_1}, \dots, [x]_{n_k}) is a bijection from n\mathbb{Z}_n^* to n1××nk\mathbb{Z}_{n_1}^*\times \cdots \times \mathbb{Z}_{n_k}^*.

  • θ\theta is well-defined:
    • show that θ([x]n)n1××nk\theta([x]n) \in \mathbb{Z}{n_1}^* \times \cdots \times \mathbb{Z}_{n_k}^* for every [x]nn[x]_n \in \mathbb{Z}_n^*
      • [x]nngcd(x,n)=1gcd(x,ni)=1[x]_n \in \mathbb{Z}_n^* \implies \gcd(x, n) = 1 \implies \gcd(x, n_i) = 1 for every i[k][x]ninii \in [k] \implies [x]_{n_i} \in \mathbb{Z}_{n_i}^* for every i[k]i \in [k]
    • show that [x]n=[y]nθ([x]n)=θ([y]n)[x]_n = [y]_n \implies \theta([x]_n) = \theta([y]_n)
      • [x]n=[y]nxy(modn)xy(modni)[x]_n = [y]_n \implies x \equiv y \pmod{n} \implies x \equiv y \pmod{n_i} for every i[k]i \in [k];
        [x]ni=[y]ni\implies [x]_{n_i} = [y]_{n_i} for every i[k]i \in [k]
        θ([x]n)=θ([y]n)\implies \theta([x]_n) = \theta([y]_n)
  • θ\theta is injective, i.e., θ([x]n)=θ([y]n)[x]n=[y]n\theta([x]_n) = \theta([y]_n) \implies [x]_n = [y]_n
    • θ([x]n)=θ([y]n)([x]n1,,[x]nk)=([y]n1,,[y]nk)[x]ni=[y]ni\theta([x]_n) = \theta([y]_n) \implies ([x]_{n_1}, \dots, [x]_{n_k}) = ([y]_{n_1}, \dots, [y]_{n_k}) \implies [x]_{n_i} = [y]_{n_i} for every i[k]i \in [k]
      ni|(xy)\implies n_i \mid (x – y) for every i[k]i \in [k]
      n|(xy)[x]n=[y]n\implies n \mid (x – y) \implies [x]_n = [y]_n
  • θ\theta is surjective: Let ([b1]n1,,[bk]nk)n1××nk([b_1]_{n_1}, \dots, [b_k]_{n_k}) \in \mathbb{Z}_{n_1}^* \times \cdots \times \mathbb{Z}_{n_k}^*. Preimage?
    • Due to CRT, the system xbi(modni),i=1,,kx \equiv b_i \pmod{n_i}, i = 1, \dots, k, has a solution bb
    • bbi(modni)b \equiv b_i \pmod{n_i} for all i[k]i \in [k]
    • Since [bi]nini[b_i]_{n_i} \in \mathbb{Z}_{n_i}^*, gcd(b,ni)=1\gcd(b, n_i) = 1 for all i[k]i \in [k]
    • gcd(b,n1n2nk)=1\gcd(b, n_1 n_2 \cdots n_k) = 1
    • θ([b]n)=([b]n1,,[b]nk)=([b1]n1,,[bk]nk)\theta([b]_n) = ([b]_{n_1}, \dots, [b]_{n_k}) = ([b_1]_{n_1}, \dots, [b_k]_{n_k})
    • [b]n[b]_n is a preimage of ([b1]n1,,[bk]nk)([b_1]_{n_1}, \dots, [b_k]_{n_k})

Euler’s Phi Function

THEOREM: Let n1,,nk+n_1, \dots, n_k \in \mathbb{Z}^+ be pairwise relatively prime. Let n=n1nkn = n_1 \cdots n_k. Then ϕ(n)=ϕ(n1)ϕ(nk)\phi(n) = \phi(n_1) \cdots \phi(n_k).

  • θ:nn1××nk\theta: \mathbb{Z}_n^* \to \mathbb{Z}_{n_1}^* \times \cdots \times \mathbb{Z}_{n_k}^* is bijective
  • ϕ(n)=ϕ(n1)××ϕ(nk)\phi(n) = \phi(n_1) \times \cdots \times \phi(n_k)

THEOREM: If n=p1e1pkekn = p_1^{e_1} \cdots p_k^{e_k} for distinct primes p1,,pkp_1, \dots, p_k and integers e1,,ek1e_1, \dots, e_k \ge 1, then ϕ(n)=n(1p11)(1pk1)\phi(n) = n(1 – p_1^{-1}) \cdots (1 – p_k^{-1}).

  • ϕ(n)=ϕ(p1e1)ϕ(pkek)=n(1p11)(1pk1)\phi(n) = \phi(p_1^{e_1}) \cdots \phi(p_k^{e_k}) = n(1 – p_1^{-1}) \cdots (1 – p_k^{-1})

EXAMPLE:ϕ(10)=ϕ(2)ϕ(5)=4\phi(10) = \phi(2)\phi(5) = 4; n=10;n1=2,n2=5n = 10; n_1 = 2, n_2 = 5

  • θ:nn1×n2\theta: \mathbb{Z}_n^* \to \mathbb{Z}_{n_1}^* \times \mathbb{Z}_{n_2}^*
    1(1,1);3(1,3);7(1,2);9(1,4)1 \mapsto (1,1); 3 \mapsto (1,3); 7 \mapsto (1,2); 9 \mapsto (1,4)

(n,+)(\mathbb{Z}_n, +)

EXAMPLE: For n+n \in \mathbb{Z}^+, n\mathbb{Z}_n and ++ satisfy the following properties.

  • Closure:[a]n+[b]nn[a]_n + [b]_n \in \mathbb{Z}_n
    • [a]n+[b]n=[a+b]nn[a]_n + [b]_n = [a + b]_n \in \mathbb{Z}_n
  • Associative:([a]n+[b]n)+[c]n=[a]n+([b]n+[c]n)([a]_n + [b]_n) + [c]_n = [a]_n + ([b]_n + [c]_n)
    • ([a]n+[b]n)+[c]n=[a+b]n+[c]n=[(a+b)+c]n([a]_n + [b]_n) + [c]_n = [a + b]_n + [c]_n = [(a + b) + c]_n
      =[a+(b+c)]n=[a]n+[b+c]n= [a + (b + c)]_n = [a]_n + [b + c]_n
      =[a]n+([b]n+[c]n)= [a]_n + ([b]_n + [c]_n)
  • Identity:[a]n+[0]n=[0]n+[a]n=[a]n[a]_n + [0]_n = [0]_n + [a]_n = [a]_n
    • [a]n+[0]n=[a+0]n=[0+a]n=[0]n+[a]n[a]_n + [0]_n = [a + 0]_n = [0 + a]_n = [0]_n + [a]_n
  • Inverse:[a]n+[a]n=[a]n+[a]n=[0]n[a]_n + [-a]_n = [-a]_n + [a]_n = [0]_n
    • [a]n+[a]n=[a+(a)]n=[0]n[a]_n + [-a]_n = [a + (-a)]_n = [0]_n
  • Commutative:[a]n+[b]n=[b]n+[a]n[a]_n + [b]_n = [b]_n + [a]_n
    • [a]n+[b]n=[a+b]n=[b+a]n=[b]n+[a]n[a]_n + [b]_n = [a + b]_n = [b + a]_n = [b]_n + [a]_n

Group

DEFINITION: A group is a set GG together with a binary operation \star on GG such that

  • Closure:a,bG,abG\forall a, b \in G, a \star b \in G
  • Associative:a,b,cG,a(bc)=(ab)c\forall a, b, c \in G, a \star (b \star c) = (a \star b) \star c
  • Identity:eG,aG,ae=ea=a\exists e \in G, \forall a \in G, a \star e = e \star a = a
  • Inverse:aG,bG,ab=ba=e\forall a \in G, \exists b \in G, a \star b = b \star a = e

DEFINITION: A group GG is said to be an Abelian group if it is

  • Commutative:a,bG,ab=ba\forall a, b \in G, a \star b = b \star a

Group n\mathbb{Z}_n^*

THEOREM:n\mathbb{Z}_n^* is an Abelian group for any integer n>1n > 1.

  • Closure:[a]n,[b]nn,[a]n[b]n=[ab]nn\forall [a]_n, [b]_n \in \mathbb{Z}_n^*, [a]_n \cdot [b]_n = [ab]_n \in \mathbb{Z}_n^*
  • Associative:[a]n,[b]n,[c]nn,[a]n([b]n[c]n)=[abc]n=([a]n[b]n)[c]n\forall [a]_n, [b]_n, [c]_n \in \mathbb{Z}_n^*, [a]_n \cdot ([b]_n \cdot [c]_n) = [abc]_n = ([a]_n \cdot [b]_n) \cdot [c]_n
  • Identity element:[1]nn,[a]nn,[a]n[1]n=[1]n[a]n=[a]n\exists [1]_n \in \mathbb{Z}_n^, \forall [a]_n \in \mathbb{Z}_n^, [a]_n \cdot [1]_n = [1]_n \cdot [a]_n = [a]_n
  • Inverse:[a]nn,[s]nn\forall [a]_n \in \mathbb{Z}_n^*, \exists [s]_n \in \mathbb{Z}_n^* such that [a]n[s]n=[s]n[a]n=[1]n[a]_n \cdot [s]_n = [s]_n \cdot [a]_n = [1]_n
  • Commutative:[a]n,[b]nn,[a]n[b]n=[ab]n=[ba]n=[b]n[a]n\forall [a]_n, [b]_n \in \mathbb{Z}_n^*, [a]_n \cdot [b]_n = [ab]_n = [ba]_n = [b]_n \cdot [a]_n

REMARK: we are interested in two types of Abelian groups

  • Additive Group: binary operation ++; identity 00
    • Example: (,+),(n,+),(,+),(n,+)(\mathbb{Z}, +), (n\mathbb{Z}, +), (\mathbb{Q}, +), (\mathbb{Z}_n, +)
  • Multiplicative Group: binary operation \cdot; identity 11 //(n,)(\mathbb{Z}_n^*, \cdot)
    • Example: (,×),(±1,×),(n,)(\mathbb{Q}^*, \times), ({\pm 1}, \times), (\mathbb{Z}_n^*, \cdot)

Order

DEFINITION: The order of a group GG is the cardinality of GG.

  • |n|=n,|p|=p1,||=|\mathbb{Z}_n| = n, |\mathbb{Z}_p^*| = p – 1, |\mathbb{Z}| = \infty

DEFINITION: when |G|<|G| < \infty, aG\forall a \in G, the order of aa is the least integer l>0l > 0 such that al=1a^l = 1 (la=0la = 0 for additive group)

EXAMPLE: Determine the orders of all elements of 7\mathbb{Z}_7^* and 6\mathbb{Z}_6

  • 7={1,2,3,4,5,6};o(1)=1;o(2)=o(4)=3;o(3)=o(5)=6;o(6)=2\mathbb{Z}_7^* = \{1,2,3,4,5,6\}; o(1) = 1; o(2) = o(4) = 3; o(3) = o(5) = 6; o(6) = 2
  • 6={0,1,2,3,4,5};o(0)=1,o(1)=o(5)=6,o(2)=o(4)=3,o(3)=2\mathbb{Z}_6 = \{0,1,2,3,4,5\}; o(0) = 1, o(1) = o(5) = 6, o(2) = o(4) = 3, o(3) = 2

THEOREM: Let GG be a multiplicative Abelian group of order mm. Then for any aGa \in G, am=1a^m = 1.

  • G={a1,,am}G = \{a_1, \dots, a_m\}
  • If iji \neq j, then aaiaajaa_i \neq aa_j.
  • aa1aa2aam=a1a2amaa_1 \cdot aa_2 \cdots aa_m = a_1 a_2 \cdots a_m
  • am=1a^m = 1
© 版权声明

相关文章

49 条评论

  • 猴智机灵
    猴智机灵 读者

    这定理证明过程有点绕

    中国四川
    回复
    • 猎户信使
      猎户信使 读者

      同感,我也绕晕了

      中国广西@ 猴智机灵
      回复
  • 秘法吟诵
    秘法吟诵 读者

    原来群论和密码学是这么联系的

    中国湖北
    回复
    • 烈阳施法者
      烈阳施法者 读者

      我也对密码学感兴趣

      中国重庆@ 秘法吟诵
      回复
  • 猎人曹
    猎人曹 读者

    原来群论在密码学里这么重要

    中国湖北
    回复
  • 泡泡桃
    泡泡桃 读者

    原来模运算和群论是这么联系的

    日本
    回复
  • 狗子の快乐时光
    狗子の快乐时光 读者

    原来群论和模运算是一回事儿啊

    韩国
    回复
  • 灵异眼
    灵异眼 读者

    原来中国剩余定理还能这么用

    中国广东
    回复
  • 狼王归来
    狼王归来 读者

    这例题步骤太详细了,适合我这种数学渣

    中国
    回复
    • 竹篮打水小能手
      竹篮打水小能手 读者

      同款数学渣握手

      中国广东@ 狼王归来
      回复
  • 神经同步
    神经同步 读者

    原来RSA密码学基础在这

    韩国
    回复
    • 糖果梦境
      糖果梦境 读者

      同感,数学基础很关键

      美国@ 神经同步
      回复
  • 破晓疯子
    破晓疯子 读者

    原来欧拉函数和群论是这么关联的

    美国
    回复
    • 玄鬼探案
      玄鬼探案 读者

      这个关联确实挺有意思

      中国北京@ 破晓疯子
      回复
  • 火龙骑士
    火龙骑士 游客

    那个s1=-1到底咋算出来的?扩展欧几里得没讲清楚啊

    中国河南
    回复
  • 猴子多多
    猴子多多 读者

    群论定义背了八百遍还是用不利索,考试必挂科

    中国河南
    回复
  • 琴师小周
    琴师小周 游客

    RSA底层原理就是靠这个吗?求个通俗解释

    中国上海
    回复
  • 老拐子
    老拐子 游客

    之前搞分布式ID生成时真用过CRT,调试到凌晨三点😭

    中国江苏
    回复
  • 赤霄云游
    赤霄云游 游客

    中间确实缺了好几步,扩展欧几里得那步没写

    日本
    回复
  • 立夏初阳
    立夏初阳 游客

    例题凑数字痕迹太重,完全不像自然推导

    中国贵州
    回复
  • 西域客
    西域客 游客

    这堆公式看得我直接晕过去,数论太难了😵

    中国湖北
    回复
  • 勇敢狗狗
    勇敢狗狗 游客

    θ映射那块跳太快了,中间逻辑断了

    中国上海
    回复
  • 银装素裹
    银装素裹 游客

    群论定义背了又忘,不如直接上代码例子

    印度尼西亚
    回复
  • CanyonRidge
    CanyonRidge 游客

    例题里s1=-1咋来的?扩展欧几里得没写清楚啊

    中国重庆
    回复
  • 神经幻想
    神经幻想 读者

    RSA底层是不是靠这个?求个通俗解释

    中国北京
    回复
  • 焦虑的风
    焦虑的风 游客

    之前搞分布式ID时真用过CRT,调试到凌晨三点😭

    中国浙江
    回复
  • 射手银河
    射手银河 游客

    这堆符号看得我眼睛疼,能不能画个图?

    韩国
    回复
  • AndromedaTaurus
    AndromedaTaurus 游客

    模7余2、模3也余2,那x=2不就满足俩?但模5不对…还得接着试

    中国
    回复
  • 鬼火灯笼
    鬼火灯笼 游客

    这堆定理证明看得眼睛疼,不如直接给代码实现来得实在。

    中国上海
    回复
  • 幽梦回声
    幽梦回声 游客

    模7余2、模3也余2,x-2是21倍数?试到23就停了?万一有更小的呢?

    印度
    回复
  • 疯狂的牙刷
    疯狂的牙刷 读者

    θ映射到底是不是同构?光说双射不够吧…

    澳大利亚
    回复
    • 夜霜微凉
      夜霜微凉 游客

      光双射确实不够啊,得保持运算结构才算同构吧?

      印度@ 疯狂的牙刷
      回复
  • 深空矿工
    深空矿工 读者

    bijection证明那段直接略过,反正最后能算出结果就行。

    新西兰
    回复
  • 秋高气爽
    秋高气爽 读者

    同余方程组实际项目里真用过,搞分布式ID生成时踩过坑。

    中国山东
    回复
  • 温暖如春
    温暖如春 读者

    欧拉函数那块突然乘起来看得我一愣,前面没提积性啊?

    中国陕西
    回复
  • 魔法蘑菇
    魔法蘑菇 游客

    23那个解代进去验算对就行,过程跳就跳吧,反正作业抄答案不香吗🤔

    中国广东
    回复
  • 梦中说梦
    梦中说梦 游客

    完全看不懂θ映射那部分在干啥,懵了。

    中国河北
    回复
  • 幽冥祭司
    幽冥祭司 游客

    模运算这块老是搞混,心态崩了🤯

    中国
    回复
  • 童话星
    童话星 游客

    之前搞过同余方程组,确实折腾了好久。

    中国北京
    回复
  • 话痨小熊猫
    话痨小熊猫 游客

    密码学里 RSA 是不是就靠这个?求指路。

    日本
    回复
  • 渔夫赵六
    渔夫赵六 游客

    这定理证明过程看得头大,想弃疗。

    日本
    回复
  • 玉衡公子
    玉衡公子 读者

    原来中国剩余定理还能这么用

    中国浙江
    回复
  • 炽焰贤者
    炽焰贤者 游客

    这定理证明过程看得头大

    中国山东
    回复