I am watching cryptography classes because I want to understand the math behind bitcoin's algorithm. This is a hobby, but I am having a brainfart watching this part of the lecture:
The equations are:
$$ S_2 = AS_1 + B \mod m $$
$$ S_3 = AS_2 + B \mod m $$
He solved them and got:
$$ A = (S_2 - S_3)(S_1 - S_2)^{-1} \mod m $$
$$ B = S_2 - S_1(S_2 - S_3)(S_1 - S_2)^{-1} \mod m $$
I was able to solve for A and arrive at the same result but not B, How did he arrive at the resulting equation for B? I can see that A was plugged into the first equation but I wasn't able to get to the same result.