<s>[INST] Solving modulus equations with multiple unknowns I have the following equations:
$$8\equiv-(3a+7b)\mod11$$
and
$$9\equiv-(5a+4b)\mod11$$
How do I solve them?
I've tried to subtract one equation from the other, but I end up with the wrong answer.
It is supposed to be:
$a=2$ and $b=9$.
 [/INST] By rearranging the first congruence equation $8 \equiv -3a -7b \pmod{11}$, we have $4b \equiv 8 + 3a \pmod{11}$. Since $\gcd(4, 11) = 1$, there is an inverse of $4$, which is $3$. We thus have
\begin{equation}
b \equiv 24 + 9a \equiv 2 - 2a \pmod{11}
\end{equation}
Plugging this into the other congruence equation $9 \equiv -5a - 4b \pmod{11}$. We have
\begin{equation}
9 \equiv -5a - 4(2 - 2a) \equiv 3a - 8 \pmod{11}
\end{equation}
which implies that $3a \equiv 17 \equiv 6 \pmod {11}$. Since $\gcd(3, 11) = 1$, we can divide by $3$. So, we have $a \equiv 2 \pmod{11}$. Using the same way, you can solve for $b$.
</s>