Guys, question about a "Chinese Remainder Theorem" Algorithm. So say we have $n_1,\dots,n_t$ which are relatively prime, and $a_1,\dots,a_t$. Say we let $a=a_1$. We want to find $x$ such that
$$
xn_1\equiv 1\mod n_2.
$$
Then we get
$$
a’=a+(a_2-a)xn_1.
$$
So now we have that $a’\equiv a_i\mod n_i$ for $i\in\{1,2\}$. Now my book says that we could also replace the factor $(a_2-a)x$ by its remainder after division of $n_2$. I don’t see why this is the case. Anyone any idea?