I'm trying to solve a programming problem, a subpart of the solution is like bellow:
X is a positive integer where
$X = m_1A_1 + a_1 = m_2A_2 + a_2 = m_3A_3 + a_3 = m_4A_4 + a_4 = m_5A_5 + a_5 = m_6A_6 + a_6$
The values of $a_1, a_2, a_3, a_4, a_5, a_6,A_1, A_2, A_3, A_4, A_5, A_6$ are given. We've to find X.
Now, if there were only 2 equations, then it could be solved by extended euclid's algorithm. I've seen the solution, they did like this : first they solved the first two equations,found $m_1, m_2$ by extended euclid's algorithm. Then they merged them into a single equation $mA + a$, where the new $A = lcm(A_1, A_2$) and new $a = m_1A_1 + a_1$. Then they applied extended euclid algorithm for the new equation and the third equation and so on. Finally, the showed $X = a$ after merging all equations.
I can't fully understand merging part, how this results is correct. Can anyone help me understanding the proof?