The idea is to find an inverse modulo for two numbers, $660$ and $43$ in this case. I find that the GCD is easy to calculate, but the step after that, calculating the inverse modulo when calculating back trough the GCD calculation. The thing I do not get, is that 'by algebra' they keep removing certain numbers between parentheses, and it seems illogical to me.
$\begin{array}{rcl}660 & = & 43 \cdot 15 + 15 \\ 43 & = & 15 \cdot 2 + 13 \\ 15 & = & 13 \cdot 1 + 2 \\ 13 & = & 2 \cdot 6 + 1 \\ 2 & = & 1 \cdot 2 + 0 \end{array}$
Now, these are steps 1 trough 5, and for step 6 (to calculate the inverse), they give this:
$\begin{array}{rcl} (1) & = & 13 - 2 \cdot 6 \\ (2) & = & 13 - (15 - 13) \cdot 6 \\ (3) & = & 7 \cdot 13 - 6 \cdot 5 \\ (4) & = & 7 \cdot (43 - 15 \cdot 2) - 6 \cdot 15 \\ (5) & = & 7 \cdot 43 - 20 \cdot 15 \\ (6) & = & 7 \cdot 43 − 20 \cdot (660 − 43 \cdot 15) \\ (7) & = & 307 \cdot 43 - 20 \cdot 660 \end{array}$
The thing I do not get, for example, is how they end up with 20 at step 5. What exactly are the rules here when simplifying these steps? It seems like they are just replacing any numbers to their liking .. I have this for my discrete math course, and have not had basic algebra lessons before this, so it could be really easy. All help is appreciated!
Edit: perhaps there is no real question above, my question thus: what are the rules for this? Can these integers within the parentheses just be shuffled around?