∀
a
,
b
∈
z
,
d
=
g
c
d
(
a
,
b
)
\forall a,b\in z,d=gcd\left(a,b \right )
∀a,b∈z,d=gcd(a,b)
关于
x
,
y
x,y
x,y的线性不定方程:(裴蜀等式)
a
x
+
b
y
=
c
ax+by=c
ax+by=c有整数解
(
x
,
y
)
⇔
d
∣
c
\left(x,y \right )\Leftrightarrow d\mid c
(x,y)⇔d∣c,有解时,则有无穷解
通解为
(
m
0
x
0
+
k
b
d
,
m
0
y
0
−
k
a
d
)
(
k
∈
z
)
\left(m_{0}x_{0}+\frac{kb}{d},m_{0}y_{0}-\frac{ka}{d} \right )\left( k\in z \right )
(m0x0+dkb,m0y0−dka)(k∈z)
或者
(
c
d
x
0
+
k
b
d
,
c
d
y
0
−
k
a
d
)
(
k
∈
z
)
\left(\frac{c}{d}x_{0}+\frac{kb}{d},\frac{c}{d}y_{0}-\frac{ka}{d} \right )\left( k\in z \right )
(dcx0+dkb,dcy0−dka)(k∈z)
其中
a
x
+
b
y
=
c
,
(
x
0
,
y
0
)
ax+by=c,\left(x0,y0 \right )
ax+by=c,(x0,y0)为
a
x
0
+
b
y
0
=
d
=
g
c
d
(
a
,
b
)
ax_{0}+by_{0}=d=gcd\left(a,b \right)
ax0+by0=d=gcd(a,b)的特解,
m
0
=
c
d
m_{0}=\frac{c}{d}
m0=dc
证明:
先证明
a
x
+
b
y
=
g
c
d
(
a
,
b
)
ax+by=gcd\left ( a,b \right )
ax+by=gcd(a,b)有解
证明:
∵
d
=
g
c
d
(
a
,
b
)
\because d=gcd\left(a,b \right )
∵d=gcd(a,b)
∴
d
∣
a
,
d
∣
b
\therefore d\mid a,d\mid b
∴d∣a,d∣b
d
∣
(
a
x
+
b
y
)
d\mid \left(ax+by \right )
d∣(ax+by)
设
s
s
s是
a
,
b
a,b
a,b的线性组合中最小的正元素,则
∃
x
,
y
∈
z
\exists x,y\in z
∃x,y∈z,使
s
=
a
x
+
b
y
∈
z
s=ax+by \in z
s=ax+by∈z
设
q
=
⌊
a
s
⌋
q=\left \lfloor \frac{a}{s} \right \rfloor
q=⌊sa⌋
r
=
a
%
s
=
a
−
q
s
=
a
−
q
(
a
x
+
b
y
)
=
(
1
−
q
x
)
a
−
b
q
y
r=a\%s=a-qs=a-q\left(ax+by \right )=\left(1-qx\right)a-bqy
r=a%s=a−qs=a−q(ax+by)=(1−qx)a−bqy
∴
r
\therefore r
∴r也是
a
,
b
a,b
a,b的线性组合
又
∵
r
=
a
%
s
\because r=a\%s
∵r=a%s
∴
0
≤
r
<
s
\therefore 0\leq r < s
∴0≤r<s (因为取余的结果必然小于模的数)
又
∵
s
\because s
∵s是
a
,
b
a,b
a,b的线性组合中最小的正元素
∴
r
\therefore r
∴r比线性组合中最小正元素的还小,
r
=
0
r=0
r=0
∴
s
∣
a
\therefore s\mid a
∴s∣a
同理可证
s
∣
b
s\mid b
s∣b
∴
s
\therefore s
∴s是
a
,
b
a,b
a,b的公约数
又
∵
d
\because d
∵d是
a
,
b
a,b
a,b的最大公约数
∴
d
≥
s
\therefore d\geq s
∴d≥s
∵
d
∣
(
a
x
+
b
y
)
,
s
=
a
x
+
b
y
\because d\mid\left ( ax+by \right ),s=ax+by
∵d∣(ax+by),s=ax+by
∴
d
∣
s
\therefore d \mid s
∴d∣s
∴
s
≥
d
\therefore s\geq d
∴s≥d
又
∵
d
≥
s
\because d\geq s
∵d≥s
∴
s
=
d
=
g
c
d
(
a
,
b
)
\therefore s=d=gcd\left ( a,b \right )
∴s=d=gcd(a,b)
a
x
+
b
y
=
s
ax+by=s
ax+by=s
a
x
+
b
y
=
g
c
d
(
a
,
b
)
ax+by=gcd\left ( a,b \right )
ax+by=gcd(a,b)有解
接着证明
g
c
d
(
a
,
b
)
∣
c
⇔
a
x
+
b
y
=
c
gcd\left ( a,b \right )\mid c \Leftrightarrow ax+by=c
gcd(a,b)∣c⇔ax+by=c有整数解
证明:
充分性
d
=
g
c
d
(
a
,
b
)
d=gcd\left ( a,b \right )
d=gcd(a,b)
设
a
x
+
b
y
=
g
c
d
(
a
,
b
)
ax+by=gcd\left ( a,b \right )
ax+by=gcd(a,b)解为
(
x
0
,
y
0
)
\left ( x_{0},y_{0} \right )
(x0,y0)
∵
d
∣
c
\because d\mid c
∵d∣c
∴
∃
k
∈
z
\therefore \exists k\in z
∴∃k∈z, 使得
c
=
k
d
c=kd
c=kd
∵
a
x
0
+
b
y
0
=
d
\because ax_{0}+by_{0}=d
∵ax0+by0=d
k
a
x
0
+
k
b
y
0
=
k
d
=
c
kax_{0}+kby_{0}=kd=c
kax0+kby0=kd=c
∴
a
x
+
b
y
=
c
\therefore ax+by=c
∴ax+by=c的解为
(
k
x
0
,
k
y
0
)
\left(kx_{0},ky_{0} \right )
(kx0,ky0)
必要性:
a
x
1
+
b
y
1
=
c
ax_{1}+by_{1}=c
ax1+by1=c
设
d
=
g
c
d
(
a
,
b
)
d=gcd\left(a,b \right )
d=gcd(a,b)
∴
d
∣
a
,
d
∣
b
\therefore d\mid a,d\mid b
∴d∣a,d∣b
∴
d
∣
(
a
x
1
+
b
y
1
)
\therefore d\mid \left ( ax_{1}+by_{1} \right )
∴d∣(ax1+by1)
∴
d
∣
c
\therefore d\mid c
∴d∣c
∴
g
c
d
(
a
,
b
)
∣
c
\therefore gcd(a,b)\mid c
∴gcd(a,b)∣c
∴ g c d ( a , b ) ∣ c ⇔ a x + b y = c \therefore gcd\left(a,b \right )\mid c\Leftrightarrow ax+by=c ∴gcd(a,b)∣c⇔ax+by=c 有整数解
最后证明有无穷解以及通解形式
证明:设
a
x
0
+
b
y
0
=
d
,
c
=
m
0
d
ax_{0}+by_{0}=d,c=m_{0}d
ax0+by0=d,c=m0d
a
m
0
x
0
+
b
m
0
y
0
=
m
0
d
=
c
am_{0}x_{0}+bm_{0}y_{0}=m_{0}d=c
am0x0+bm0y0=m0d=c
a
(
m
0
x
0
+
k
d
b
)
+
b
(
m
0
y
0
−
k
a
b
)
(
k
∈
z
)
=
a
m
0
x
0
+
a
k
b
d
+
b
m
0
y
0
−
b
k
a
d
=
a
m
0
x
0
+
b
m
0
y
0
=
c
\begin{aligned} &\quad a\left ( m_{0}x_{0}+\frac{kd}{b} \right )+b\left ( m_{0}y_{0}-\frac{ka}{b} \right )\left ( k\in z \right )\\ &=am_{0}x_{0}+a\frac{kb}{d}+bm_{0}y_{0}-b\frac{ka}{d}\\ &=am_{0}x_{0}+bm_{0}y_{0}\\ &=c \end{aligned}
a(m0x0+bkd)+b(m0y0−bka)(k∈z)=am0x0+adkb+bm0y0−bdka=am0x0+bm0y0=c
即
a
x
+
b
y
=
c
ax+by=c
ax+by=c的通解为
(
m
0
x
0
+
k
b
d
,
m
0
y
0
−
k
a
d
)
(
k
∈
z
)
\left ( m_{0}x_{0}+\frac{kb}{d},m_{0}y_{0}-\frac{ka}{d} \right )\left ( k\in z \right )
(m0x0+dkb,m0y0−dka)(k∈z)
或者
(
c
d
x
0
+
k
b
d
,
c
d
y
0
−
k
a
d
)
(
k
∈
z
)
\left ( \frac{c}{d}x_{0}+\frac{kb}{d},\frac{c}{d}y_{0}-\frac{ka}{d} \right )\left ( k\in z \right )
(dcx0+dkb,dcy0−dka)(k∈z)
也就是证明了无穷解
其中
a
x
+
b
y
=
c
,
(
x
0
,
y
0
)
ax+by=c,\left ( x_{0},y_{0} \right )
ax+by=c,(x0,y0)为
a
x
0
+
b
y
0
=
d
=
g
c
d
(
a
,
b
)
ax_{0}+by_{0}=d=gcd\left ( a,b \right )
ax0+by0=d=gcd(a,b)的特解,
m
0
=
c
d
m_{0}=\frac{c}{d}
m0=dc