What do brackets mean for mod operation?
$begingroup$
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?
modules
$endgroup$
add a comment |
$begingroup$
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?
modules
$endgroup$
$begingroup$
You do get the solution just further down on the page. I do not know why the programs chose to program it so that if you type it without the brackets it will plot a graph and it won't if you include the brackets. But mathematically it does the same.
$endgroup$
– fleablood
Dec 5 '18 at 23:30
$begingroup$
Thanks guys. I got it.
$endgroup$
– sashaaero
Dec 5 '18 at 23:35
add a comment |
$begingroup$
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?
modules
$endgroup$
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?
modules
modules
asked Dec 5 '18 at 23:13
sashaaerosashaaero
1325
1325
$begingroup$
You do get the solution just further down on the page. I do not know why the programs chose to program it so that if you type it without the brackets it will plot a graph and it won't if you include the brackets. But mathematically it does the same.
$endgroup$
– fleablood
Dec 5 '18 at 23:30
$begingroup$
Thanks guys. I got it.
$endgroup$
– sashaaero
Dec 5 '18 at 23:35
add a comment |
$begingroup$
You do get the solution just further down on the page. I do not know why the programs chose to program it so that if you type it without the brackets it will plot a graph and it won't if you include the brackets. But mathematically it does the same.
$endgroup$
– fleablood
Dec 5 '18 at 23:30
$begingroup$
Thanks guys. I got it.
$endgroup$
– sashaaero
Dec 5 '18 at 23:35
$begingroup$
You do get the solution just further down on the page. I do not know why the programs chose to program it so that if you type it without the brackets it will plot a graph and it won't if you include the brackets. But mathematically it does the same.
$endgroup$
– fleablood
Dec 5 '18 at 23:30
$begingroup$
You do get the solution just further down on the page. I do not know why the programs chose to program it so that if you type it without the brackets it will plot a graph and it won't if you include the brackets. But mathematically it does the same.
$endgroup$
– fleablood
Dec 5 '18 at 23:30
$begingroup$
Thanks guys. I got it.
$endgroup$
– sashaaero
Dec 5 '18 at 23:35
$begingroup$
Thanks guys. I got it.
$endgroup$
– sashaaero
Dec 5 '18 at 23:35
add a comment |
3 Answers
3
active
oldest
votes
$begingroup$
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 $bequiv 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, nin mathbb Z$
$endgroup$
add a comment |
$begingroup$
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$
$-3equiv_{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 + 10frac {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.)
$endgroup$
$begingroup$
I disagree with your first sentence. While it's true that $aequiv bpmod{m}$ means that $a$ and $b$ belong to the same equivalence class in $Bbb Z/m$, it does not mean that $a$ and $b$ are themselves classes. Actually, $aequiv bpmod{m}$ means that $a$ and $b$ are integers such that $m$ divides $a-b$. So, solving the modular equation $f(n)equiv a pmod{m}$ does not mean finding an equivalence classe. In general the set of integer solutions $n$ will not be an equivalence class modulo $m$ anyway, for instance consider the equation $2^nequiv 0pmod2$.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 0:01
$begingroup$
9
becomes-1
because9 < 10
so you take9 - 10
?
$endgroup$
– sashaaero
Dec 6 '18 at 0:04
$begingroup$
"9 becomes -1 because 9 < 10 so you take 9 - 10". Yes, an no. Because we are evaluating congruences modulo $10$ we are not concerned with actual integers. We can replace $9$ with $-1$ (or $19$ or $29$) without any consequence because for our purposes $9$ and $-1$ are equivalent. And they are equivalent because $9 = -1 + 10k$ for some $k$. I wouldn't have swapped them out in the other interpretation.
$endgroup$
– fleablood
Dec 6 '18 at 1:13
$begingroup$
$2^n equiv 0pmod 2$ Solve for $n$ is a completely different question.
$endgroup$
– fleablood
Dec 6 '18 at 1:15
$begingroup$
Yes, but your formulation of the problem is extremely misleading. You write "It's a statement about what "universe" of arithmetic you are working in.", however $b$ is simply a integer here. It's "as if" we were working in $Bbb Z/10$ because the equation is polynomial. But that's nowhere stated or explained. Note that I have the same concerns with the accepted answer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 1:32
|
show 2 more comments
$begingroup$
There is some confusion here, due to two 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 $aequiv bpmod{m}$ (and the divisibility relation is written $m,|,a-b$). In LaTeX, aequiv bpmod{m}
.
Congruences have a number of nice properties that you can find on Wikipédia and in many books of elementary number theory.
For instance, if $aequiv bpmod{m}$ and $cequiv dpmod{m}$, then $a+cequiv b+dpmod{m}$ and $acequiv bdpmod{m}$. And $equiv$ is an equivalence relation.
Modular arithmetic is said to "wrap around", because if $aequiv bpmod{m}$, then $a+kmequiv bpmod{m}$ for all integers $k$.
And given an integer $a$ you can always find a unique integer $rin{0,dots m-1}$ such that $aequiv rpmod{m}$. This $r$ has a precise meaning: $r$ is the remainder in the euclidean division of $a$ by $m$. And the relation $aequiv bpmod{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 $mBbb Z$ (it contains the multiples of some positive integer $m$) and you can consider the quotient ring $Bbb Z/mBbb 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 $asim b$ if $a-bin mBbb 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/mBbb Z$, you then have a canonical homomorphism $p:Bbb ZtoBbb Z/mBbb Z$ that maps any inteer $a$ to its class in $Bbb Z/mBbb Z$.
Then you can prove that $aequiv bpmod{m}$ iff $p(a)=p(b)$. More generally, in an arbitrary ring, and given an ideal $frak a$, you can define $aequiv bpmod{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,/,kinBbb Z}$, ${3k+1,/,kinBbb Z}$ and ${3k+2,/,kinBbb Z}$. Each one can be denoted by any element of the class, for instance $Bbb Z/3Bbb 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/3Bbb 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 $amod b$ to be the remainder in the euclidean division. It's also possible to extend the definition to arbitrary real numbers $a,b$ (with $bne0$), and this also exists for floating-point arithmetic in programming languages.
For integers $a,b$, $amod b$ is thus an integer, and for real $a,b$ it's a real.
Now, there is again a similarity with $aequiv bpmod m$. Specifically, if $0le b<m$, then $b=amod m$ (read $b=(amod m)$ if your are in doubt). Likewise, you have always $aequiv (amod 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 $aequiv bpmod 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/mBbb Z$. Since it's not entirely clear what is meant, and it's too similar to $a=bmod 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 $5mod10$ and $(9b+48)mod 10$: the intersection is where there is equality.
6. How do you solve this equation?
Your equation can be written $5equiv 9b+48pmod{10}$.
Since $5equiv5pmod{10}$, your equation is equivalent to $0equiv 9b+43pmod{10}$ (remember you can subtract two congruences with the same modulus).
Since $bequiv bpmod{10}$ your equation is equivalent to $bequiv 10b+43pmod{10}$.
Finally since you don't change the congruence by adding or subtracting a multiple of the modulus ($10$), your equation is equivalent to
$$bequiv3 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,/,kinBbb Z}$.
$endgroup$
$begingroup$
If it is given that $a,b in mathbb Z/m$, there's nothing wrong with saying that $a=b$, with or without the $bmod{m}$. Nor saying that $aequiv b$, with or without the $pmod{m}$. It's all a matter of context. And even that becomes irrelevant if there is no room for confusion about what we're talking about.
$endgroup$
– I like Serena
Dec 6 '18 at 22:41
$begingroup$
I don't think notation is ever irrelevant. If only because a standard and uniform notation eases reading. If I read $2$, I expect it's an integer, not an "irrelevant detail" according to the writer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 22:50
$begingroup$
Your use of $mathbb Z/m$ is the first time I've seen it. For instance wiki does not mention it. Given the context I immediately understand what you mean, but strictly speaking, it's the set ${0,pm 1/m, pm 2/m,ldots}$. Just saying.
$endgroup$
– I like Serena
Dec 7 '18 at 1:34
$begingroup$
@IlikeSerena I have seen this in several places, but I don't like it either. I thought it was well known. I have also seen $Bbb Z_n$ by the way. Of course, as long as textbooks give the definition, it's ok, but you are right, it's not a good habit as it can be confused with something ele (however, I would rather write $frac1nBbb Z$ for the set you mention, to avoid confusion). I will remove this one from the answer.
$endgroup$
– Jean-Claude Arbaut
Dec 7 '18 at 7:21
$begingroup$
Yes, I am used to either $mathbb Z_n$ or $mathbb Z/nmathbb Z$. It remains ambiguous whether it is the additive group, the ring, or just the set of elements though. To remove the ambiguity, we should write something like 'the ring $(mathbb Z/nmathbb Z,+,cdot)$ with the usual addition and multiplication', which is usually considered to be a bit long winded.
$endgroup$
– I like Serena
Dec 7 '18 at 14:43
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3027798%2fwhat-do-brackets-mean-for-mod-operation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
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 $bequiv 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, nin mathbb Z$
$endgroup$
add a comment |
$begingroup$
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 $bequiv 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, nin mathbb Z$
$endgroup$
add a comment |
$begingroup$
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 $bequiv 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, nin mathbb Z$
$endgroup$
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 $bequiv 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, nin mathbb Z$
answered Dec 5 '18 at 23:42
I like SerenaI like Serena
3,7471718
3,7471718
add a comment |
add a comment |
$begingroup$
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$
$-3equiv_{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 + 10frac {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.)
$endgroup$
$begingroup$
I disagree with your first sentence. While it's true that $aequiv bpmod{m}$ means that $a$ and $b$ belong to the same equivalence class in $Bbb Z/m$, it does not mean that $a$ and $b$ are themselves classes. Actually, $aequiv bpmod{m}$ means that $a$ and $b$ are integers such that $m$ divides $a-b$. So, solving the modular equation $f(n)equiv a pmod{m}$ does not mean finding an equivalence classe. In general the set of integer solutions $n$ will not be an equivalence class modulo $m$ anyway, for instance consider the equation $2^nequiv 0pmod2$.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 0:01
$begingroup$
9
becomes-1
because9 < 10
so you take9 - 10
?
$endgroup$
– sashaaero
Dec 6 '18 at 0:04
$begingroup$
"9 becomes -1 because 9 < 10 so you take 9 - 10". Yes, an no. Because we are evaluating congruences modulo $10$ we are not concerned with actual integers. We can replace $9$ with $-1$ (or $19$ or $29$) without any consequence because for our purposes $9$ and $-1$ are equivalent. And they are equivalent because $9 = -1 + 10k$ for some $k$. I wouldn't have swapped them out in the other interpretation.
$endgroup$
– fleablood
Dec 6 '18 at 1:13
$begingroup$
$2^n equiv 0pmod 2$ Solve for $n$ is a completely different question.
$endgroup$
– fleablood
Dec 6 '18 at 1:15
$begingroup$
Yes, but your formulation of the problem is extremely misleading. You write "It's a statement about what "universe" of arithmetic you are working in.", however $b$ is simply a integer here. It's "as if" we were working in $Bbb Z/10$ because the equation is polynomial. But that's nowhere stated or explained. Note that I have the same concerns with the accepted answer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 1:32
|
show 2 more comments
$begingroup$
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$
$-3equiv_{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 + 10frac {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.)
$endgroup$
$begingroup$
I disagree with your first sentence. While it's true that $aequiv bpmod{m}$ means that $a$ and $b$ belong to the same equivalence class in $Bbb Z/m$, it does not mean that $a$ and $b$ are themselves classes. Actually, $aequiv bpmod{m}$ means that $a$ and $b$ are integers such that $m$ divides $a-b$. So, solving the modular equation $f(n)equiv a pmod{m}$ does not mean finding an equivalence classe. In general the set of integer solutions $n$ will not be an equivalence class modulo $m$ anyway, for instance consider the equation $2^nequiv 0pmod2$.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 0:01
$begingroup$
9
becomes-1
because9 < 10
so you take9 - 10
?
$endgroup$
– sashaaero
Dec 6 '18 at 0:04
$begingroup$
"9 becomes -1 because 9 < 10 so you take 9 - 10". Yes, an no. Because we are evaluating congruences modulo $10$ we are not concerned with actual integers. We can replace $9$ with $-1$ (or $19$ or $29$) without any consequence because for our purposes $9$ and $-1$ are equivalent. And they are equivalent because $9 = -1 + 10k$ for some $k$. I wouldn't have swapped them out in the other interpretation.
$endgroup$
– fleablood
Dec 6 '18 at 1:13
$begingroup$
$2^n equiv 0pmod 2$ Solve for $n$ is a completely different question.
$endgroup$
– fleablood
Dec 6 '18 at 1:15
$begingroup$
Yes, but your formulation of the problem is extremely misleading. You write "It's a statement about what "universe" of arithmetic you are working in.", however $b$ is simply a integer here. It's "as if" we were working in $Bbb Z/10$ because the equation is polynomial. But that's nowhere stated or explained. Note that I have the same concerns with the accepted answer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 1:32
|
show 2 more comments
$begingroup$
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$
$-3equiv_{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 + 10frac {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.)
$endgroup$
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$
$-3equiv_{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 + 10frac {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.)
answered Dec 5 '18 at 23:56
fleabloodfleablood
68.7k22685
68.7k22685
$begingroup$
I disagree with your first sentence. While it's true that $aequiv bpmod{m}$ means that $a$ and $b$ belong to the same equivalence class in $Bbb Z/m$, it does not mean that $a$ and $b$ are themselves classes. Actually, $aequiv bpmod{m}$ means that $a$ and $b$ are integers such that $m$ divides $a-b$. So, solving the modular equation $f(n)equiv a pmod{m}$ does not mean finding an equivalence classe. In general the set of integer solutions $n$ will not be an equivalence class modulo $m$ anyway, for instance consider the equation $2^nequiv 0pmod2$.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 0:01
$begingroup$
9
becomes-1
because9 < 10
so you take9 - 10
?
$endgroup$
– sashaaero
Dec 6 '18 at 0:04
$begingroup$
"9 becomes -1 because 9 < 10 so you take 9 - 10". Yes, an no. Because we are evaluating congruences modulo $10$ we are not concerned with actual integers. We can replace $9$ with $-1$ (or $19$ or $29$) without any consequence because for our purposes $9$ and $-1$ are equivalent. And they are equivalent because $9 = -1 + 10k$ for some $k$. I wouldn't have swapped them out in the other interpretation.
$endgroup$
– fleablood
Dec 6 '18 at 1:13
$begingroup$
$2^n equiv 0pmod 2$ Solve for $n$ is a completely different question.
$endgroup$
– fleablood
Dec 6 '18 at 1:15
$begingroup$
Yes, but your formulation of the problem is extremely misleading. You write "It's a statement about what "universe" of arithmetic you are working in.", however $b$ is simply a integer here. It's "as if" we were working in $Bbb Z/10$ because the equation is polynomial. But that's nowhere stated or explained. Note that I have the same concerns with the accepted answer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 1:32
|
show 2 more comments
$begingroup$
I disagree with your first sentence. While it's true that $aequiv bpmod{m}$ means that $a$ and $b$ belong to the same equivalence class in $Bbb Z/m$, it does not mean that $a$ and $b$ are themselves classes. Actually, $aequiv bpmod{m}$ means that $a$ and $b$ are integers such that $m$ divides $a-b$. So, solving the modular equation $f(n)equiv a pmod{m}$ does not mean finding an equivalence classe. In general the set of integer solutions $n$ will not be an equivalence class modulo $m$ anyway, for instance consider the equation $2^nequiv 0pmod2$.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 0:01
$begingroup$
9
becomes-1
because9 < 10
so you take9 - 10
?
$endgroup$
– sashaaero
Dec 6 '18 at 0:04
$begingroup$
"9 becomes -1 because 9 < 10 so you take 9 - 10". Yes, an no. Because we are evaluating congruences modulo $10$ we are not concerned with actual integers. We can replace $9$ with $-1$ (or $19$ or $29$) without any consequence because for our purposes $9$ and $-1$ are equivalent. And they are equivalent because $9 = -1 + 10k$ for some $k$. I wouldn't have swapped them out in the other interpretation.
$endgroup$
– fleablood
Dec 6 '18 at 1:13
$begingroup$
$2^n equiv 0pmod 2$ Solve for $n$ is a completely different question.
$endgroup$
– fleablood
Dec 6 '18 at 1:15
$begingroup$
Yes, but your formulation of the problem is extremely misleading. You write "It's a statement about what "universe" of arithmetic you are working in.", however $b$ is simply a integer here. It's "as if" we were working in $Bbb Z/10$ because the equation is polynomial. But that's nowhere stated or explained. Note that I have the same concerns with the accepted answer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 1:32
$begingroup$
I disagree with your first sentence. While it's true that $aequiv bpmod{m}$ means that $a$ and $b$ belong to the same equivalence class in $Bbb Z/m$, it does not mean that $a$ and $b$ are themselves classes. Actually, $aequiv bpmod{m}$ means that $a$ and $b$ are integers such that $m$ divides $a-b$. So, solving the modular equation $f(n)equiv a pmod{m}$ does not mean finding an equivalence classe. In general the set of integer solutions $n$ will not be an equivalence class modulo $m$ anyway, for instance consider the equation $2^nequiv 0pmod2$.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 0:01
$begingroup$
I disagree with your first sentence. While it's true that $aequiv bpmod{m}$ means that $a$ and $b$ belong to the same equivalence class in $Bbb Z/m$, it does not mean that $a$ and $b$ are themselves classes. Actually, $aequiv bpmod{m}$ means that $a$ and $b$ are integers such that $m$ divides $a-b$. So, solving the modular equation $f(n)equiv a pmod{m}$ does not mean finding an equivalence classe. In general the set of integer solutions $n$ will not be an equivalence class modulo $m$ anyway, for instance consider the equation $2^nequiv 0pmod2$.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 0:01
$begingroup$
9
becomes -1
because 9 < 10
so you take 9 - 10
?$endgroup$
– sashaaero
Dec 6 '18 at 0:04
$begingroup$
9
becomes -1
because 9 < 10
so you take 9 - 10
?$endgroup$
– sashaaero
Dec 6 '18 at 0:04
$begingroup$
"9 becomes -1 because 9 < 10 so you take 9 - 10". Yes, an no. Because we are evaluating congruences modulo $10$ we are not concerned with actual integers. We can replace $9$ with $-1$ (or $19$ or $29$) without any consequence because for our purposes $9$ and $-1$ are equivalent. And they are equivalent because $9 = -1 + 10k$ for some $k$. I wouldn't have swapped them out in the other interpretation.
$endgroup$
– fleablood
Dec 6 '18 at 1:13
$begingroup$
"9 becomes -1 because 9 < 10 so you take 9 - 10". Yes, an no. Because we are evaluating congruences modulo $10$ we are not concerned with actual integers. We can replace $9$ with $-1$ (or $19$ or $29$) without any consequence because for our purposes $9$ and $-1$ are equivalent. And they are equivalent because $9 = -1 + 10k$ for some $k$. I wouldn't have swapped them out in the other interpretation.
$endgroup$
– fleablood
Dec 6 '18 at 1:13
$begingroup$
$2^n equiv 0pmod 2$ Solve for $n$ is a completely different question.
$endgroup$
– fleablood
Dec 6 '18 at 1:15
$begingroup$
$2^n equiv 0pmod 2$ Solve for $n$ is a completely different question.
$endgroup$
– fleablood
Dec 6 '18 at 1:15
$begingroup$
Yes, but your formulation of the problem is extremely misleading. You write "It's a statement about what "universe" of arithmetic you are working in.", however $b$ is simply a integer here. It's "as if" we were working in $Bbb Z/10$ because the equation is polynomial. But that's nowhere stated or explained. Note that I have the same concerns with the accepted answer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 1:32
$begingroup$
Yes, but your formulation of the problem is extremely misleading. You write "It's a statement about what "universe" of arithmetic you are working in.", however $b$ is simply a integer here. It's "as if" we were working in $Bbb Z/10$ because the equation is polynomial. But that's nowhere stated or explained. Note that I have the same concerns with the accepted answer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 1:32
|
show 2 more comments
$begingroup$
There is some confusion here, due to two 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 $aequiv bpmod{m}$ (and the divisibility relation is written $m,|,a-b$). In LaTeX, aequiv bpmod{m}
.
Congruences have a number of nice properties that you can find on Wikipédia and in many books of elementary number theory.
For instance, if $aequiv bpmod{m}$ and $cequiv dpmod{m}$, then $a+cequiv b+dpmod{m}$ and $acequiv bdpmod{m}$. And $equiv$ is an equivalence relation.
Modular arithmetic is said to "wrap around", because if $aequiv bpmod{m}$, then $a+kmequiv bpmod{m}$ for all integers $k$.
And given an integer $a$ you can always find a unique integer $rin{0,dots m-1}$ such that $aequiv rpmod{m}$. This $r$ has a precise meaning: $r$ is the remainder in the euclidean division of $a$ by $m$. And the relation $aequiv bpmod{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 $mBbb Z$ (it contains the multiples of some positive integer $m$) and you can consider the quotient ring $Bbb Z/mBbb 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 $asim b$ if $a-bin mBbb 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/mBbb Z$, you then have a canonical homomorphism $p:Bbb ZtoBbb Z/mBbb Z$ that maps any inteer $a$ to its class in $Bbb Z/mBbb Z$.
Then you can prove that $aequiv bpmod{m}$ iff $p(a)=p(b)$. More generally, in an arbitrary ring, and given an ideal $frak a$, you can define $aequiv bpmod{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,/,kinBbb Z}$, ${3k+1,/,kinBbb Z}$ and ${3k+2,/,kinBbb Z}$. Each one can be denoted by any element of the class, for instance $Bbb Z/3Bbb 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/3Bbb 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 $amod b$ to be the remainder in the euclidean division. It's also possible to extend the definition to arbitrary real numbers $a,b$ (with $bne0$), and this also exists for floating-point arithmetic in programming languages.
For integers $a,b$, $amod b$ is thus an integer, and for real $a,b$ it's a real.
Now, there is again a similarity with $aequiv bpmod m$. Specifically, if $0le b<m$, then $b=amod m$ (read $b=(amod m)$ if your are in doubt). Likewise, you have always $aequiv (amod 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 $aequiv bpmod 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/mBbb Z$. Since it's not entirely clear what is meant, and it's too similar to $a=bmod 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 $5mod10$ and $(9b+48)mod 10$: the intersection is where there is equality.
6. How do you solve this equation?
Your equation can be written $5equiv 9b+48pmod{10}$.
Since $5equiv5pmod{10}$, your equation is equivalent to $0equiv 9b+43pmod{10}$ (remember you can subtract two congruences with the same modulus).
Since $bequiv bpmod{10}$ your equation is equivalent to $bequiv 10b+43pmod{10}$.
Finally since you don't change the congruence by adding or subtracting a multiple of the modulus ($10$), your equation is equivalent to
$$bequiv3 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,/,kinBbb Z}$.
$endgroup$
$begingroup$
If it is given that $a,b in mathbb Z/m$, there's nothing wrong with saying that $a=b$, with or without the $bmod{m}$. Nor saying that $aequiv b$, with or without the $pmod{m}$. It's all a matter of context. And even that becomes irrelevant if there is no room for confusion about what we're talking about.
$endgroup$
– I like Serena
Dec 6 '18 at 22:41
$begingroup$
I don't think notation is ever irrelevant. If only because a standard and uniform notation eases reading. If I read $2$, I expect it's an integer, not an "irrelevant detail" according to the writer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 22:50
$begingroup$
Your use of $mathbb Z/m$ is the first time I've seen it. For instance wiki does not mention it. Given the context I immediately understand what you mean, but strictly speaking, it's the set ${0,pm 1/m, pm 2/m,ldots}$. Just saying.
$endgroup$
– I like Serena
Dec 7 '18 at 1:34
$begingroup$
@IlikeSerena I have seen this in several places, but I don't like it either. I thought it was well known. I have also seen $Bbb Z_n$ by the way. Of course, as long as textbooks give the definition, it's ok, but you are right, it's not a good habit as it can be confused with something ele (however, I would rather write $frac1nBbb Z$ for the set you mention, to avoid confusion). I will remove this one from the answer.
$endgroup$
– Jean-Claude Arbaut
Dec 7 '18 at 7:21
$begingroup$
Yes, I am used to either $mathbb Z_n$ or $mathbb Z/nmathbb Z$. It remains ambiguous whether it is the additive group, the ring, or just the set of elements though. To remove the ambiguity, we should write something like 'the ring $(mathbb Z/nmathbb Z,+,cdot)$ with the usual addition and multiplication', which is usually considered to be a bit long winded.
$endgroup$
– I like Serena
Dec 7 '18 at 14:43
add a comment |
$begingroup$
There is some confusion here, due to two 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 $aequiv bpmod{m}$ (and the divisibility relation is written $m,|,a-b$). In LaTeX, aequiv bpmod{m}
.
Congruences have a number of nice properties that you can find on Wikipédia and in many books of elementary number theory.
For instance, if $aequiv bpmod{m}$ and $cequiv dpmod{m}$, then $a+cequiv b+dpmod{m}$ and $acequiv bdpmod{m}$. And $equiv$ is an equivalence relation.
Modular arithmetic is said to "wrap around", because if $aequiv bpmod{m}$, then $a+kmequiv bpmod{m}$ for all integers $k$.
And given an integer $a$ you can always find a unique integer $rin{0,dots m-1}$ such that $aequiv rpmod{m}$. This $r$ has a precise meaning: $r$ is the remainder in the euclidean division of $a$ by $m$. And the relation $aequiv bpmod{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 $mBbb Z$ (it contains the multiples of some positive integer $m$) and you can consider the quotient ring $Bbb Z/mBbb 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 $asim b$ if $a-bin mBbb 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/mBbb Z$, you then have a canonical homomorphism $p:Bbb ZtoBbb Z/mBbb Z$ that maps any inteer $a$ to its class in $Bbb Z/mBbb Z$.
Then you can prove that $aequiv bpmod{m}$ iff $p(a)=p(b)$. More generally, in an arbitrary ring, and given an ideal $frak a$, you can define $aequiv bpmod{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,/,kinBbb Z}$, ${3k+1,/,kinBbb Z}$ and ${3k+2,/,kinBbb Z}$. Each one can be denoted by any element of the class, for instance $Bbb Z/3Bbb 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/3Bbb 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 $amod b$ to be the remainder in the euclidean division. It's also possible to extend the definition to arbitrary real numbers $a,b$ (with $bne0$), and this also exists for floating-point arithmetic in programming languages.
For integers $a,b$, $amod b$ is thus an integer, and for real $a,b$ it's a real.
Now, there is again a similarity with $aequiv bpmod m$. Specifically, if $0le b<m$, then $b=amod m$ (read $b=(amod m)$ if your are in doubt). Likewise, you have always $aequiv (amod 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 $aequiv bpmod 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/mBbb Z$. Since it's not entirely clear what is meant, and it's too similar to $a=bmod 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 $5mod10$ and $(9b+48)mod 10$: the intersection is where there is equality.
6. How do you solve this equation?
Your equation can be written $5equiv 9b+48pmod{10}$.
Since $5equiv5pmod{10}$, your equation is equivalent to $0equiv 9b+43pmod{10}$ (remember you can subtract two congruences with the same modulus).
Since $bequiv bpmod{10}$ your equation is equivalent to $bequiv 10b+43pmod{10}$.
Finally since you don't change the congruence by adding or subtracting a multiple of the modulus ($10$), your equation is equivalent to
$$bequiv3 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,/,kinBbb Z}$.
$endgroup$
$begingroup$
If it is given that $a,b in mathbb Z/m$, there's nothing wrong with saying that $a=b$, with or without the $bmod{m}$. Nor saying that $aequiv b$, with or without the $pmod{m}$. It's all a matter of context. And even that becomes irrelevant if there is no room for confusion about what we're talking about.
$endgroup$
– I like Serena
Dec 6 '18 at 22:41
$begingroup$
I don't think notation is ever irrelevant. If only because a standard and uniform notation eases reading. If I read $2$, I expect it's an integer, not an "irrelevant detail" according to the writer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 22:50
$begingroup$
Your use of $mathbb Z/m$ is the first time I've seen it. For instance wiki does not mention it. Given the context I immediately understand what you mean, but strictly speaking, it's the set ${0,pm 1/m, pm 2/m,ldots}$. Just saying.
$endgroup$
– I like Serena
Dec 7 '18 at 1:34
$begingroup$
@IlikeSerena I have seen this in several places, but I don't like it either. I thought it was well known. I have also seen $Bbb Z_n$ by the way. Of course, as long as textbooks give the definition, it's ok, but you are right, it's not a good habit as it can be confused with something ele (however, I would rather write $frac1nBbb Z$ for the set you mention, to avoid confusion). I will remove this one from the answer.
$endgroup$
– Jean-Claude Arbaut
Dec 7 '18 at 7:21
$begingroup$
Yes, I am used to either $mathbb Z_n$ or $mathbb Z/nmathbb Z$. It remains ambiguous whether it is the additive group, the ring, or just the set of elements though. To remove the ambiguity, we should write something like 'the ring $(mathbb Z/nmathbb Z,+,cdot)$ with the usual addition and multiplication', which is usually considered to be a bit long winded.
$endgroup$
– I like Serena
Dec 7 '18 at 14:43
add a comment |
$begingroup$
There is some confusion here, due to two 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 $aequiv bpmod{m}$ (and the divisibility relation is written $m,|,a-b$). In LaTeX, aequiv bpmod{m}
.
Congruences have a number of nice properties that you can find on Wikipédia and in many books of elementary number theory.
For instance, if $aequiv bpmod{m}$ and $cequiv dpmod{m}$, then $a+cequiv b+dpmod{m}$ and $acequiv bdpmod{m}$. And $equiv$ is an equivalence relation.
Modular arithmetic is said to "wrap around", because if $aequiv bpmod{m}$, then $a+kmequiv bpmod{m}$ for all integers $k$.
And given an integer $a$ you can always find a unique integer $rin{0,dots m-1}$ such that $aequiv rpmod{m}$. This $r$ has a precise meaning: $r$ is the remainder in the euclidean division of $a$ by $m$. And the relation $aequiv bpmod{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 $mBbb Z$ (it contains the multiples of some positive integer $m$) and you can consider the quotient ring $Bbb Z/mBbb 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 $asim b$ if $a-bin mBbb 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/mBbb Z$, you then have a canonical homomorphism $p:Bbb ZtoBbb Z/mBbb Z$ that maps any inteer $a$ to its class in $Bbb Z/mBbb Z$.
Then you can prove that $aequiv bpmod{m}$ iff $p(a)=p(b)$. More generally, in an arbitrary ring, and given an ideal $frak a$, you can define $aequiv bpmod{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,/,kinBbb Z}$, ${3k+1,/,kinBbb Z}$ and ${3k+2,/,kinBbb Z}$. Each one can be denoted by any element of the class, for instance $Bbb Z/3Bbb 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/3Bbb 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 $amod b$ to be the remainder in the euclidean division. It's also possible to extend the definition to arbitrary real numbers $a,b$ (with $bne0$), and this also exists for floating-point arithmetic in programming languages.
For integers $a,b$, $amod b$ is thus an integer, and for real $a,b$ it's a real.
Now, there is again a similarity with $aequiv bpmod m$. Specifically, if $0le b<m$, then $b=amod m$ (read $b=(amod m)$ if your are in doubt). Likewise, you have always $aequiv (amod 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 $aequiv bpmod 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/mBbb Z$. Since it's not entirely clear what is meant, and it's too similar to $a=bmod 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 $5mod10$ and $(9b+48)mod 10$: the intersection is where there is equality.
6. How do you solve this equation?
Your equation can be written $5equiv 9b+48pmod{10}$.
Since $5equiv5pmod{10}$, your equation is equivalent to $0equiv 9b+43pmod{10}$ (remember you can subtract two congruences with the same modulus).
Since $bequiv bpmod{10}$ your equation is equivalent to $bequiv 10b+43pmod{10}$.
Finally since you don't change the congruence by adding or subtracting a multiple of the modulus ($10$), your equation is equivalent to
$$bequiv3 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,/,kinBbb Z}$.
$endgroup$
There is some confusion here, due to two 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 $aequiv bpmod{m}$ (and the divisibility relation is written $m,|,a-b$). In LaTeX, aequiv bpmod{m}
.
Congruences have a number of nice properties that you can find on Wikipédia and in many books of elementary number theory.
For instance, if $aequiv bpmod{m}$ and $cequiv dpmod{m}$, then $a+cequiv b+dpmod{m}$ and $acequiv bdpmod{m}$. And $equiv$ is an equivalence relation.
Modular arithmetic is said to "wrap around", because if $aequiv bpmod{m}$, then $a+kmequiv bpmod{m}$ for all integers $k$.
And given an integer $a$ you can always find a unique integer $rin{0,dots m-1}$ such that $aequiv rpmod{m}$. This $r$ has a precise meaning: $r$ is the remainder in the euclidean division of $a$ by $m$. And the relation $aequiv bpmod{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 $mBbb Z$ (it contains the multiples of some positive integer $m$) and you can consider the quotient ring $Bbb Z/mBbb 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 $asim b$ if $a-bin mBbb 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/mBbb Z$, you then have a canonical homomorphism $p:Bbb ZtoBbb Z/mBbb Z$ that maps any inteer $a$ to its class in $Bbb Z/mBbb Z$.
Then you can prove that $aequiv bpmod{m}$ iff $p(a)=p(b)$. More generally, in an arbitrary ring, and given an ideal $frak a$, you can define $aequiv bpmod{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,/,kinBbb Z}$, ${3k+1,/,kinBbb Z}$ and ${3k+2,/,kinBbb Z}$. Each one can be denoted by any element of the class, for instance $Bbb Z/3Bbb 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/3Bbb 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 $amod b$ to be the remainder in the euclidean division. It's also possible to extend the definition to arbitrary real numbers $a,b$ (with $bne0$), and this also exists for floating-point arithmetic in programming languages.
For integers $a,b$, $amod b$ is thus an integer, and for real $a,b$ it's a real.
Now, there is again a similarity with $aequiv bpmod m$. Specifically, if $0le b<m$, then $b=amod m$ (read $b=(amod m)$ if your are in doubt). Likewise, you have always $aequiv (amod 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 $aequiv bpmod 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/mBbb Z$. Since it's not entirely clear what is meant, and it's too similar to $a=bmod 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 $5mod10$ and $(9b+48)mod 10$: the intersection is where there is equality.
6. How do you solve this equation?
Your equation can be written $5equiv 9b+48pmod{10}$.
Since $5equiv5pmod{10}$, your equation is equivalent to $0equiv 9b+43pmod{10}$ (remember you can subtract two congruences with the same modulus).
Since $bequiv bpmod{10}$ your equation is equivalent to $bequiv 10b+43pmod{10}$.
Finally since you don't change the congruence by adding or subtracting a multiple of the modulus ($10$), your equation is equivalent to
$$bequiv3 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,/,kinBbb Z}$.
edited Dec 7 '18 at 7:22
answered Dec 6 '18 at 10:08
Jean-Claude ArbautJean-Claude Arbaut
14.7k63464
14.7k63464
$begingroup$
If it is given that $a,b in mathbb Z/m$, there's nothing wrong with saying that $a=b$, with or without the $bmod{m}$. Nor saying that $aequiv b$, with or without the $pmod{m}$. It's all a matter of context. And even that becomes irrelevant if there is no room for confusion about what we're talking about.
$endgroup$
– I like Serena
Dec 6 '18 at 22:41
$begingroup$
I don't think notation is ever irrelevant. If only because a standard and uniform notation eases reading. If I read $2$, I expect it's an integer, not an "irrelevant detail" according to the writer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 22:50
$begingroup$
Your use of $mathbb Z/m$ is the first time I've seen it. For instance wiki does not mention it. Given the context I immediately understand what you mean, but strictly speaking, it's the set ${0,pm 1/m, pm 2/m,ldots}$. Just saying.
$endgroup$
– I like Serena
Dec 7 '18 at 1:34
$begingroup$
@IlikeSerena I have seen this in several places, but I don't like it either. I thought it was well known. I have also seen $Bbb Z_n$ by the way. Of course, as long as textbooks give the definition, it's ok, but you are right, it's not a good habit as it can be confused with something ele (however, I would rather write $frac1nBbb Z$ for the set you mention, to avoid confusion). I will remove this one from the answer.
$endgroup$
– Jean-Claude Arbaut
Dec 7 '18 at 7:21
$begingroup$
Yes, I am used to either $mathbb Z_n$ or $mathbb Z/nmathbb Z$. It remains ambiguous whether it is the additive group, the ring, or just the set of elements though. To remove the ambiguity, we should write something like 'the ring $(mathbb Z/nmathbb Z,+,cdot)$ with the usual addition and multiplication', which is usually considered to be a bit long winded.
$endgroup$
– I like Serena
Dec 7 '18 at 14:43
add a comment |
$begingroup$
If it is given that $a,b in mathbb Z/m$, there's nothing wrong with saying that $a=b$, with or without the $bmod{m}$. Nor saying that $aequiv b$, with or without the $pmod{m}$. It's all a matter of context. And even that becomes irrelevant if there is no room for confusion about what we're talking about.
$endgroup$
– I like Serena
Dec 6 '18 at 22:41
$begingroup$
I don't think notation is ever irrelevant. If only because a standard and uniform notation eases reading. If I read $2$, I expect it's an integer, not an "irrelevant detail" according to the writer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 22:50
$begingroup$
Your use of $mathbb Z/m$ is the first time I've seen it. For instance wiki does not mention it. Given the context I immediately understand what you mean, but strictly speaking, it's the set ${0,pm 1/m, pm 2/m,ldots}$. Just saying.
$endgroup$
– I like Serena
Dec 7 '18 at 1:34
$begingroup$
@IlikeSerena I have seen this in several places, but I don't like it either. I thought it was well known. I have also seen $Bbb Z_n$ by the way. Of course, as long as textbooks give the definition, it's ok, but you are right, it's not a good habit as it can be confused with something ele (however, I would rather write $frac1nBbb Z$ for the set you mention, to avoid confusion). I will remove this one from the answer.
$endgroup$
– Jean-Claude Arbaut
Dec 7 '18 at 7:21
$begingroup$
Yes, I am used to either $mathbb Z_n$ or $mathbb Z/nmathbb Z$. It remains ambiguous whether it is the additive group, the ring, or just the set of elements though. To remove the ambiguity, we should write something like 'the ring $(mathbb Z/nmathbb Z,+,cdot)$ with the usual addition and multiplication', which is usually considered to be a bit long winded.
$endgroup$
– I like Serena
Dec 7 '18 at 14:43
$begingroup$
If it is given that $a,b in mathbb Z/m$, there's nothing wrong with saying that $a=b$, with or without the $bmod{m}$. Nor saying that $aequiv b$, with or without the $pmod{m}$. It's all a matter of context. And even that becomes irrelevant if there is no room for confusion about what we're talking about.
$endgroup$
– I like Serena
Dec 6 '18 at 22:41
$begingroup$
If it is given that $a,b in mathbb Z/m$, there's nothing wrong with saying that $a=b$, with or without the $bmod{m}$. Nor saying that $aequiv b$, with or without the $pmod{m}$. It's all a matter of context. And even that becomes irrelevant if there is no room for confusion about what we're talking about.
$endgroup$
– I like Serena
Dec 6 '18 at 22:41
$begingroup$
I don't think notation is ever irrelevant. If only because a standard and uniform notation eases reading. If I read $2$, I expect it's an integer, not an "irrelevant detail" according to the writer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 22:50
$begingroup$
I don't think notation is ever irrelevant. If only because a standard and uniform notation eases reading. If I read $2$, I expect it's an integer, not an "irrelevant detail" according to the writer.
$endgroup$
– Jean-Claude Arbaut
Dec 6 '18 at 22:50
$begingroup$
Your use of $mathbb Z/m$ is the first time I've seen it. For instance wiki does not mention it. Given the context I immediately understand what you mean, but strictly speaking, it's the set ${0,pm 1/m, pm 2/m,ldots}$. Just saying.
$endgroup$
– I like Serena
Dec 7 '18 at 1:34
$begingroup$
Your use of $mathbb Z/m$ is the first time I've seen it. For instance wiki does not mention it. Given the context I immediately understand what you mean, but strictly speaking, it's the set ${0,pm 1/m, pm 2/m,ldots}$. Just saying.
$endgroup$
– I like Serena
Dec 7 '18 at 1:34
$begingroup$
@IlikeSerena I have seen this in several places, but I don't like it either. I thought it was well known. I have also seen $Bbb Z_n$ by the way. Of course, as long as textbooks give the definition, it's ok, but you are right, it's not a good habit as it can be confused with something ele (however, I would rather write $frac1nBbb Z$ for the set you mention, to avoid confusion). I will remove this one from the answer.
$endgroup$
– Jean-Claude Arbaut
Dec 7 '18 at 7:21
$begingroup$
@IlikeSerena I have seen this in several places, but I don't like it either. I thought it was well known. I have also seen $Bbb Z_n$ by the way. Of course, as long as textbooks give the definition, it's ok, but you are right, it's not a good habit as it can be confused with something ele (however, I would rather write $frac1nBbb Z$ for the set you mention, to avoid confusion). I will remove this one from the answer.
$endgroup$
– Jean-Claude Arbaut
Dec 7 '18 at 7:21
$begingroup$
Yes, I am used to either $mathbb Z_n$ or $mathbb Z/nmathbb Z$. It remains ambiguous whether it is the additive group, the ring, or just the set of elements though. To remove the ambiguity, we should write something like 'the ring $(mathbb Z/nmathbb Z,+,cdot)$ with the usual addition and multiplication', which is usually considered to be a bit long winded.
$endgroup$
– I like Serena
Dec 7 '18 at 14:43
$begingroup$
Yes, I am used to either $mathbb Z_n$ or $mathbb Z/nmathbb Z$. It remains ambiguous whether it is the additive group, the ring, or just the set of elements though. To remove the ambiguity, we should write something like 'the ring $(mathbb Z/nmathbb Z,+,cdot)$ with the usual addition and multiplication', which is usually considered to be a bit long winded.
$endgroup$
– I like Serena
Dec 7 '18 at 14:43
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3027798%2fwhat-do-brackets-mean-for-mod-operation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
You do get the solution just further down on the page. I do not know why the programs chose to program it so that if you type it without the brackets it will plot a graph and it won't if you include the brackets. But mathematically it does the same.
$endgroup$
– fleablood
Dec 5 '18 at 23:30
$begingroup$
Thanks guys. I got it.
$endgroup$
– sashaaero
Dec 5 '18 at 23:35