modular arithmetic, solving $ax + b \equiv c \pmod d$?

For example $151x - 294\equiv 44\pmod 7 $. How would I go about solving that?

The answer says to simplify it into the $ax\equiv b\pmod c $ form first, but I have no clue on how to get rid of the $294$... help?


Solution 1:

"a congruent to b mod m" is also written $a \equiv b \pmod m$ and I define it to mean that $a + (m) = b + (m)$ where $(m) = \{ k m \in \mathbb Z | k \in \mathbb Z \}$ is the set of all multiples of $m$ also called the ideal generated by $m$.

What this means, for example, is that $9 \equiv 23 \pmod 7$ since $9 + (7) = \{\cdots,-12,-5,2,9,16,23,30,\cdots\} = 23 + (7).$ In general if number $x = mk+r$ then $x \equiv r \pmod m.$

A general result about relations is that if $R$ is an equivalence relation on $X$ and $f : Y \mapsto X$ is a function then the relation defined by $aSb :\iff f(a) R f(b)$ is also an equivalence relation (on $Y$). This proves that equivalence mod m is an equivalence relation since the relation $R$ is $=$ (which we know to be an equivalence) and the function $f$ is just $+ (m)$.

Since we have an equivalence relation we can do equational reasoning with it. For example:

If $$151x - 294 \equiv 44 \pmod 7$$ then since $$44 \equiv 2 \pmod 7$$ we have $$151x - 294 \equiv 2 \pmod 7,$$ furthermore $$151 \equiv 4 \pmod 7$$ and $$294 \equiv 0 \pmod 7$$ so we have $$4x \equiv 2 \pmod 7.$$ Cancelling out $2$ from both sides gives $$2 x \equiv 1 \pmod 7.$$ To solve this we can just try $x = 1$, $x = 2$, ... until we find a solution.

Solution 2:

to solve $151x - 294 \equiv 44 \pmod{7}$, first add 294 on both sides to obtain $151x \equiv 338 \pmod{7}$. now before solving for x, let's first check if an integer solution exists. $(151,7) = 1$, and $1|338$, so x is solvable. so now we are solving for x in $151x + 7m = 338$

now use extended eculid algorithm to solve for x. precisely, set up 2 columns and and try to get the column under "e" to become 338 by row addition, subtraction and multiplication. the third column "m" is not necessary, but I listed it anyway for clarity.

e | x(coeff. of 151) | m(coeff. of 7)

151 | 1 | 0

7 | 0 | 1

147 | 0 (2nd row* 21, and we ignore the m column from now on)

4 | 1 (row1 - row3)

3 | -1 (row2-row4)

1 | 2 (from previous two rows)

338 | 676

so x = 676, but x can be any element in $[676]_{7}$

hope this helps, and sorry about the format. \tabular doesn't seem to work here and I don't know what else to do...