裴蜀定理_原理证明

裴蜀定理

算法使用

对于\(\forall a,b \in \mathbb{Z}\),\(\exists x,y \in \mathbb{Z}\),使

\[a \cdot x + b \cdot y = \gcd(a,b) \]

\(a\)\(b\)组成的最小正整数为\(\gcd(a,b)\).

\(\gcd(x,y)\)表示\(x\)\(y\)的最大公约数.

数学原理

Tips : \(a | b\)表示\(b\)能整除\(a\),即\(b \ \% \ a = 0\)\(b \ ÷ \ a 为整数\).

\[\begin{aligned} 定义 &a与b为定值 \\ &A = \{c \ | \ a \cdot x + b \cdot y = c;x,y \in \mathbb{Z} \} \\ 设&A中最小正元素为s \\ &a \cdot x_0 + b \cdot y_0 = s \\ 要证 & \textcolor{blue}{\gcd(a,b) = s} \\ \because \ & \gcd(a,b) | a \cdot x_0 \\ & \gcd(a,b) | b \cdot y_0 \\ & \gcd(a,b) | (a \cdot x_0 + b \cdot y_0) \\ \therefore \ & \gcd(a,b) | s \\ & \textcolor{red}{s >= \gcd(a,b)} \\ 设 &a = m \cdot s + n , m \in \mathbb{Z} ,(0 \le n < s) \\ &b = i \ \ \cdot s + j \ , i \ \ \in \mathbb{Z} ,(0 \le j \ < s) \\ \because \ &n = a - m \cdot s \\ & \: \: \: \: = a - m (a \cdot x_0 + b \cdot y_0) \\ & \: \: \: \: = a(1 - m \cdot x_0) + b (-m \cdot y_0) \\ & n \in A , 0 \le n < s,s是A中最小正整数 \\ &j \ = b - i \ \ \cdot s \\ & \: \: \: \: = b - i \ \ (a \cdot x_0 + b \cdot y_0) \\ & \: \: \: \: = a(- i \ \ \cdot x_0) + b (1 - i\ \ \cdot y_0) \\ & j \ \in A , 0 \le j \ < s,s是A中最小正整数 \\ \therefore \ & n = 0 ,j \ = 0 \\ & s | a \ , \ s | b \\ \therefore \ & s为a \ b的一个公约数 , \gcd(a,b) 为a \ b的最大公约数 \\ & \textcolor{red}{s <= \gcd(a,b)} \\ \therefore \ & \textcolor{blue}{\gcd(a,b) = s} \end{aligned} \]

拓展

  • \(a \cdot x + b \cdot y = c\),\(\gcd(a,b) | c\).
posted @ 2023-01-04 20:54  WHY139  阅读(90)  评论(0)    收藏  举报