EEA will find the GCD(m,n) where
z = a mod m
z = b mod n
We can use EEA to compute CRT. The complete tutorial is found here Solving Congruences: The Chinese Remainder Theorem
From what I understand, given a system of congruence equations, we can find a general solution to the system by:
[1] Compute the gcd of the first two z to find the expression (m*x0) + (n*y0)
[2] Construct a new z based on [1], where
z_new = (m*x0)*b + (n*y0)*a mod (m*n)
[3] Compute the gcd of z_new and the third z
[4] The final z that satisfy the system is again
z_system = (m*x0)*b + (n*y0)*a mod (m*n)
Suppose we have
z = 2 mod 3
z = 3 mod 5
z = 2 mod 7
Z_1 and Z_2
a = 2, b = 3, m = 3 and n = 5
The gcd formula will give us the expression (mx0) + (ny0), which is
(2 * 3)*3 + (-1 * 5) * 2 mod (3*5), or 8 mod 15
Z_new and Z_3
a = 8, b = 2, m = 15, and n = 7, we have
(1 * 15) * 2 + (-2 * 7) * 8 mod (15*7), or -82 mod 105
Yet -82 is not the minimal. All the solutions I have seen using direct substitution will give me 23 (mod 105). I don't think my solution is wrong because 23 + 105*(-1) = -82.
How do I get the minimal solution using EEA if I am interested in solving Chinese Remainder Theorem problems?
I hope this is clear... Thank you!