Documente Academic
Documente Profesional
Documente Cultură
Example:
For [0;1,1,1]
C0=0,c1=1,c2=1/2,c3=2/3,c4=3/5
DIOHAMTINE EQUATINS:-
Lets say we are asked to solve the equation ax+by=c
If d is the g.c.d of a and b, then
a/d .x + b/d .y =c/d
and g.c.d(a/d,b/d)=1, so we
first solve
ax+by=1
if x0,y0 exist s.t ax0+y0=1
If we multiply by c.
acx0+bcy0=c, implies
ax+by=c
so cx0and cy0 will be the desired solution
Method:
First write a/b as a continued fraction.
Here we will use the formulas
C0= a0
p0=a0 , p1 =a0a1+1, q0=1, q1 = a1
for k≥2
pk = ak pk-2 + ak-2 pk -1
qk = ak qk-2 + ak-2 qk -1
Ck =pk /qk
and Cn-1=pn-1/qn-1 , cn=pn/qn=a/b
As g.c.d of (pn,qn)=1,pn=a,qn=b.
So
Pnqn-1-qnpn-1=(-1)n-1
Example: Lets say we have to solve the Diophantine
equation 158x -57 y = 2.
First we will reduce 158/57 to continued fraction
158/57=2+(44/57)= 2+(1/(57/44))=2+1/(1+(13/44))
= 2+1/(1+(1/(44/13)))
= 2+1/(1+1/(3+(1/(13/5))))
=2+1/(1+1/(3+1/(2+1/(1+1/(1+(1/2))))))
As p0=2,q0=1
p1=3,q1=1
p2=a2×p1+p0=3×3+2=11
q2=a2×q1+q0=3×1+1=4
p3=a3×p2+p1=2×11+3=25
q3=a3×q2+q1=2×4+1=9
p4=a4×p3+p2=1×25+11=36
q4=a4×q3+q2=1×9+4=13
p5=1×36+25=a5 ×p4+p3=61
q5=a5×p4+q3=1×13+9=22
p6=a6×p5+p4=2×61+36=158
q6=a6×p5+q4=2×22+13=57
We will find
C6=158/57
C5=61/22
So 158(22) - 57(61) = (-1)6-1
•
158(22) - 57(61) = -1 or 158(-22) - 57(-61) = 1
As the equation had RHS as 2
Multiply by 2
158(-22.2) - 57(-61.2) = 2
The general Solution will be
x = -44 + 57t
y = -122 +158t where t = 0,±1, ±2.............