# What should I learn to understand the equivalence of these two expressions?

I found the following statement from the textbook accompanying MIT's course Mathematics for Computer Science. The pdf can be found here, on page 8.

I can't see how the first implies the second, but I don't know what to learn in order to better understand this. Can anyone point me in the right direction?

$a = q(sa + tb) + r$ so $r = (1-qs)a + (-qt)b$

I can see that the terms are the same, but where does the 1 come from here? My understanding of algebra is fairly limited, but here I don't even know where to start. Any help is appreciated!

• It's actually just straightforward algebra and rearrangement of the expression/ solving for r, also the term is $(1-qs)a$ – Triatticus Dec 14 '17 at 21:37
• You do it step by step. First, expand $a = q(sa + tb) + r$ into $a = qsa + qtb + r$. Then you bring those $qsa, ptb$ to the left. So we have $a - qsa - qtb = r$. Finally, factorize $a$ to get $r = a(1 - qs) - qtb$ – Alex Vong Dec 14 '17 at 21:38
• If you have more problems like this, I think you need to review parts of precalculus. – Stephen Meskin Dec 14 '17 at 21:48

Expand $$a = qsa + qtb + r$$
Rearrange terms $$r = a - qs a - qtb$$
Factor $$r = (1-qs)a - qtb$$