What do brackets mean for mod operation?

3.4k Views Asked by At

I'm solving equation 5 = (6 * 8 + 9 * b)(mod 10). I tried to use wolframalpha and it gives me answer b = 3. But if I remove brackets around mod 5 = (6 * 8 + 9 * b) mod 10 it makes a plot, and doesn't give me any real answer. I have no idea how to solve this without guessing the b. So I assume there is some meaning behind those brackets?

3

There are 3 best solutions below

0
On BEST ANSWER

With the brackets it means: $$5 \equiv (6 \cdot 8 + 9 \cdot b) \pmod{10}$$ It means that every value from $0$ to $9$ is considered an equivalence class. (Note that $\LaTeX$ has a special directive for it: \pmod.)

You'll see that Wolfram shows this interpretation in its solution:

Solution in the least residue system modulo 10:

$b=3$

which is usually written as $b\equiv 3 \pmod{10}$. See Modular Arithmetic for more information.

Without the brackets, Wolfram also gives a solution at the bottom, but now it gives all integer solutions.

Integer solution:

$b=10n+3, n\in \mathbb Z$

7
On

Okay.

$\pmod n$ means we are doing modulo arithmetic on equivalence classes.

$5 \equiv (6*8 + 9*b)\pmod {10}$ means to find which modulo class $b$ belongs to.

Perhaps a less confusing notation is $5 \equiv_{10} (6*8+9b)$. The $\pmod {10}$ isn't something you do. It's a statement about what "universe" of arithmetic you are working in. And we can solve it:

$5 \equiv_{10} (6*8+9b)$

$5 \equiv_{10} 48 + 9b$

$5 \equiv_{10} 8 + (-1)b$

$-3\equiv_{10} -b$

$3 \equiv_{10} b$

$b \equiv 3 \pmod {10}$.

And without the parenthesis it means the similar but entirely different "gimme the remainder" operation in the "universe" of regualar old arithetic.

$5 = (6*8 + 9b) \mod 10$ means.

The remainder of $(6*8+9b)\div 10$ is $5$

So $48 + 9b = 10n + 5$ for some number $n$

$9b = -43 + 10n$

$9b = 27 + 10(n-6)$

$b = 3 + 10\frac {n-6}9$ for some integer $\frac {n-6}9$. We don't actually care what $n$ is. Just that be if $b= 3 + 10k$ we will get that remainder.

So Wolfram is programmed to solve those in different manners. Even though in practice the results are very very similar.

Note: $5 = 6*8 + 9b \mod 10$ would be different.

$-43 = (9b \mod 10)$ but $0 \le 9b \mod 10 < 10$ and that can't be $-43$ so this has no solutions. (Whereas $5 = (6*8 + 9b)\mod 10$ has infinite solutions and $5 \equiv 6*8 + 9b \pmod{10}$ has one solution that is an equivalence class that represents infinitely many equivalent integers.)

5
On

There is some confusion here, due to the use and abuse of various related concepts.

1. Congruences and modular arithmetic

You say the integers $a$ and $b$ are congruent modulo $m$ (a positive integer) iff $m$ divide $a-b$ and you write $a\equiv b\pmod{m}$ (and the divisibility relation is written $m\,|\,a-b$). In LaTeX, a\equiv b\pmod{m}.

Congruences have a number of nice properties that you can find on Wikipedia and in many books of elementary number theory.

For instance, if $a\equiv b\pmod{m}$ and $c\equiv d\pmod{m}$, then $a+c\equiv b+d\pmod{m}$ and $ac\equiv bd\pmod{m}$. And $\equiv$ is an equivalence relation.

Modular arithmetic is said to "wrap around", because if $a\equiv b\pmod{m}$, then $a+km\equiv b\pmod{m}$ for all integers $k$.

And given an integer $a$ you can always find a unique integer $r\in\{0,\dots m-1\}$ such that $a\equiv r\pmod{m}$. This $r$ has a precise meaning: $r$ is the remainder in the euclidean division of $a$ by $m$. And the relation $a\equiv b\pmod{m}$ actually means that $a$ and $b$ give the same remainder when divided by $m$.

2. Rings, ideals and quotients

Given the ring of integers $\Bbb Z$, any ideal has the form $m\Bbb Z$ (it contains the multiples of some positive integer $m$) and you can consider the quotient ring $\Bbb Z/m\Bbb Z$. The quotient ring is a ring on the set of classes of integers defined by the equivalence relation $\sim$, on $\Bbb Z$, defined by $a\sim b$ if $a-b\in m\Bbb Z$. You should see the similarity with $m\,|\,a-b$. Historically congruences came before rings and quotient rings, but congruences are actually a special case, and you can do that in any ring as long as you have an ideal and build the quotient ring.

Given the ring $\Bbb Z$ and the quotient ring $\Bbb Z/m\Bbb Z$, you then have a canonical homomorphism $p:\Bbb Z\to\Bbb Z/m\Bbb Z$ that maps any inteer $a$ to its class in $\Bbb Z/m\Bbb Z$.

Then you can prove that $a\equiv b\pmod{m}$ iff $p(a)=p(b)$. More generally, in an arbitrary ring, and given an ideal $\frak a$, you can define $a\equiv b\pmod{\frak a}$ iff $p(a)=p(b)$.

As you can see, all of this looks more abstract than congruences, but it's a very similar concept in disguise.

Additionally, the notation for $p(a)$ can vary. It's sometimes written $cl(a)$, or even $\dot a$. For instance, with $m=3$, there are $3$ congruence classes, $\{3k\,/\,k\in\Bbb Z\}$, $\{3k+1\,/\,k\in\Bbb Z\}$ and $\{3k+2\,/\,k\in\Bbb Z\}$. Each one can be denoted by any element of the class, for instance $\Bbb Z/3\Bbb Z=\{cl(27),cl(82),cl(-1)\}$, but it's common to use a unique representative element, and it's natural to take the $r$ defined earlier, that is the remainder in the euclidean division. Here the elements of $\Bbb Z/3\Bbb Z$ would be written $\dot0,\dot1,\dot2$. When the context is clear enough, it's a common abuse of notation to write simply $0,1,2$, but I think the temptation should be resisted.

3. Computer science

Congruences are very useful but sometimes you want a notation for the actual remainder. Programming languages all have a way to denote the remainder, with an additional caveat. Pascal and Ada use a mod b, C and C-like languages use a%b, and notations such as mod(a,b) or rem(a,b) is not uncommon. However, languages have various interpretations on what the result is when $a$ or $b$ is negative, see this.

There is a recent tendency, especially in discrete mathematics and computer science, to define the operator $a\mod b$ to be the remainder in the euclidean division. It's also possible to extend the definition to arbitrary real numbers $a,b$ (with $b\ne0$), and this also exists for floating-point arithmetic in programming languages.

For integers $a,b$, $a\mod b$ is thus an integer, and for real $a,b$ it's a real.

Now, there is again a similarity with $a\equiv b\pmod m$. Specifically, if $0\le b<m$, then $b=a\mod m$ (read $b=(a\mod m)$ if your are in doubt). Likewise, you have always $a\equiv (a\mod m) \pmod{m}$.

4. And $a=b \pmod m$?

This is a notation I would not advocate. I believe it's mainly used to mean the same as $a\equiv b\pmod m$, but it's misleading: it's not really an equality, the $\pmod m$ part is crucial here. Or it could mean an equality in $\Bbb Z/m\Bbb Z$. Since it's not entirely clear what is meant, and it's too similar to $a=b\mod m$ (where $\mathrm{mod}$ is the operator), I think it's a bad idea to use it.

5. WolframAlpha's strange plot.

You have now everything to understand why WolframAlpha is adding a plot when going from 5 = (6 * 8 + 9 * b) (mod 10) to 5 = (6 * 8 + 9 * b) mod 10. The former is a congruence and is used only with integers. The latter is an operator that can be defined on reals. In the plot, WolframAlpha is just showing how it interprets $5\mod10$ and $(9b+48)\mod 10$: the intersection is where there is equality.

6. How do you solve this equation?

Your equation can be written $5\equiv 9b+48\pmod{10}$.

Since $5\equiv5\pmod{10}$, your equation is equivalent to $0\equiv 9b+43\pmod{10}$ (remember you can subtract two congruences with the same modulus).

Since $b\equiv b\pmod{10}$ your equation is equivalent to $b\equiv 10b+43\pmod{10}$.

Finally since you don't change the congruence by adding or subtracting a multiple of the modulus ($10$), your equation is equivalent to

$$b\equiv3 \pmod{10}$$

That is, the set of solutions is the set of integers such that $10\,|\,b-3$, which means $b=10k+3$ for some integer $k$. The set of solution is thus $\{10k+3\,/\,k\in\Bbb Z\}$.