Order of operations involving mod (%) The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Order of operations in evaluating a polynomialconfused about order of operationsThe Order of Operations with BracketsHow do I solve operations involving fractional surds?Transformations of Functions - What are the Order of Operations?Order of Inverse OperationsOrder of math operationsOrder of operations when using the ÷ symbol.Simplifying Order of OperationsBasic error in order of operations
Can the DM override racial traits?
Can a flute soloist sit?
Using dividends to reduce short term capital gains?
Are there continuous functions who are the same in an interval but differ in at least one other point?
What is the role of 'For' here?
Python - Fishing Simulator
Was credit for the black hole image misappropriated?
Circular reasoning in L'Hopital's rule
One-dimensional Japanese puzzle
Could an empire control the whole planet with today's comunication methods?
Student Loan from years ago pops up and is taking my salary
1960s short story making fun of James Bond-style spy fiction
The following signatures were invalid: EXPKEYSIG 1397BC53640DB551
Did the new image of black hole confirm the general theory of relativity?
Keeping a retro style to sci-fi spaceships?
How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time
What was the last x86 CPU that did not have the x87 floating-point unit built in?
Is this wall load bearing? Blueprints and photos attached
Why not take a picture of a closer black hole?
How to support a colleague who finds meetings extremely tiring?
Didn't get enough time to take a Coding Test - what to do now?
Do ℕ, mathbbN, BbbN, symbbN effectively differ, and is there a "canonical" specification of the naturals?
Loose spokes after only a few rides
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
Order of operations involving mod (%)
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Order of operations in evaluating a polynomialconfused about order of operationsThe Order of Operations with BracketsHow do I solve operations involving fractional surds?Transformations of Functions - What are the Order of Operations?Order of Inverse OperationsOrder of math operationsOrder of operations when using the ÷ symbol.Simplifying Order of OperationsBasic error in order of operations
$begingroup$
I was taking a programming test last night that had a math equation that simplified to 11 % 2 * 3, no () or likewise. When I compute it, being taught modulous occurs at the same level of multiplication or division. As a result I get
11 % 2 * 3
1 * 3
3
Final result I get is 3. When I checked my math in spotlight calculator on my mac I get 5. And then we jump into the rabbit hole.
I go to my preferred math calculator and visit WolframAlpha. Answer is 5.
Google the formula and get 3.
So we have two possible ways to handle this equation,
(11%2)*3 = 3
11%(2*3) = 5
Which way is correct and definitive? I need sources as if Wolfram alpha is doing incorrectly, I would like to have them change it.
algebra-precalculus
$endgroup$
add a comment |
$begingroup$
I was taking a programming test last night that had a math equation that simplified to 11 % 2 * 3, no () or likewise. When I compute it, being taught modulous occurs at the same level of multiplication or division. As a result I get
11 % 2 * 3
1 * 3
3
Final result I get is 3. When I checked my math in spotlight calculator on my mac I get 5. And then we jump into the rabbit hole.
I go to my preferred math calculator and visit WolframAlpha. Answer is 5.
Google the formula and get 3.
So we have two possible ways to handle this equation,
(11%2)*3 = 3
11%(2*3) = 5
Which way is correct and definitive? I need sources as if Wolfram alpha is doing incorrectly, I would like to have them change it.
algebra-precalculus
$endgroup$
2
$begingroup$
There might be differences in the correct order of operations for mathematics and for various programming languages.
$endgroup$
– naslundx
Apr 24 '14 at 16:57
$begingroup$
For cases like this, where there is no ubiquitous convention, the denotation is ambiguous, so you should always use parentheses to disambiguate.
$endgroup$
– Bill Dubuque
Apr 24 '14 at 17:08
$begingroup$
I would but with a test question they don't alway do stuff like that.
$endgroup$
– traisjames
Apr 24 '14 at 17:42
1
$begingroup$
@naslundx: examples show the order for Google is not the same as for the other softwares tested. Which is order "for mathematics"? $amod bcdot c=amod (bcdot c)$ or $amod bcdot c=(amod b)cdot c$? Shouldn't this be the answer?
$endgroup$
– MattAllegro
Apr 24 '14 at 19:25
add a comment |
$begingroup$
I was taking a programming test last night that had a math equation that simplified to 11 % 2 * 3, no () or likewise. When I compute it, being taught modulous occurs at the same level of multiplication or division. As a result I get
11 % 2 * 3
1 * 3
3
Final result I get is 3. When I checked my math in spotlight calculator on my mac I get 5. And then we jump into the rabbit hole.
I go to my preferred math calculator and visit WolframAlpha. Answer is 5.
Google the formula and get 3.
So we have two possible ways to handle this equation,
(11%2)*3 = 3
11%(2*3) = 5
Which way is correct and definitive? I need sources as if Wolfram alpha is doing incorrectly, I would like to have them change it.
algebra-precalculus
$endgroup$
I was taking a programming test last night that had a math equation that simplified to 11 % 2 * 3, no () or likewise. When I compute it, being taught modulous occurs at the same level of multiplication or division. As a result I get
11 % 2 * 3
1 * 3
3
Final result I get is 3. When I checked my math in spotlight calculator on my mac I get 5. And then we jump into the rabbit hole.
I go to my preferred math calculator and visit WolframAlpha. Answer is 5.
Google the formula and get 3.
So we have two possible ways to handle this equation,
(11%2)*3 = 3
11%(2*3) = 5
Which way is correct and definitive? I need sources as if Wolfram alpha is doing incorrectly, I would like to have them change it.
algebra-precalculus
algebra-precalculus
asked Apr 24 '14 at 16:54
traisjamestraisjames
1313
1313
2
$begingroup$
There might be differences in the correct order of operations for mathematics and for various programming languages.
$endgroup$
– naslundx
Apr 24 '14 at 16:57
$begingroup$
For cases like this, where there is no ubiquitous convention, the denotation is ambiguous, so you should always use parentheses to disambiguate.
$endgroup$
– Bill Dubuque
Apr 24 '14 at 17:08
$begingroup$
I would but with a test question they don't alway do stuff like that.
$endgroup$
– traisjames
Apr 24 '14 at 17:42
1
$begingroup$
@naslundx: examples show the order for Google is not the same as for the other softwares tested. Which is order "for mathematics"? $amod bcdot c=amod (bcdot c)$ or $amod bcdot c=(amod b)cdot c$? Shouldn't this be the answer?
$endgroup$
– MattAllegro
Apr 24 '14 at 19:25
add a comment |
2
$begingroup$
There might be differences in the correct order of operations for mathematics and for various programming languages.
$endgroup$
– naslundx
Apr 24 '14 at 16:57
$begingroup$
For cases like this, where there is no ubiquitous convention, the denotation is ambiguous, so you should always use parentheses to disambiguate.
$endgroup$
– Bill Dubuque
Apr 24 '14 at 17:08
$begingroup$
I would but with a test question they don't alway do stuff like that.
$endgroup$
– traisjames
Apr 24 '14 at 17:42
1
$begingroup$
@naslundx: examples show the order for Google is not the same as for the other softwares tested. Which is order "for mathematics"? $amod bcdot c=amod (bcdot c)$ or $amod bcdot c=(amod b)cdot c$? Shouldn't this be the answer?
$endgroup$
– MattAllegro
Apr 24 '14 at 19:25
2
2
$begingroup$
There might be differences in the correct order of operations for mathematics and for various programming languages.
$endgroup$
– naslundx
Apr 24 '14 at 16:57
$begingroup$
There might be differences in the correct order of operations for mathematics and for various programming languages.
$endgroup$
– naslundx
Apr 24 '14 at 16:57
$begingroup$
For cases like this, where there is no ubiquitous convention, the denotation is ambiguous, so you should always use parentheses to disambiguate.
$endgroup$
– Bill Dubuque
Apr 24 '14 at 17:08
$begingroup$
For cases like this, where there is no ubiquitous convention, the denotation is ambiguous, so you should always use parentheses to disambiguate.
$endgroup$
– Bill Dubuque
Apr 24 '14 at 17:08
$begingroup$
I would but with a test question they don't alway do stuff like that.
$endgroup$
– traisjames
Apr 24 '14 at 17:42
$begingroup$
I would but with a test question they don't alway do stuff like that.
$endgroup$
– traisjames
Apr 24 '14 at 17:42
1
1
$begingroup$
@naslundx: examples show the order for Google is not the same as for the other softwares tested. Which is order "for mathematics"? $amod bcdot c=amod (bcdot c)$ or $amod bcdot c=(amod b)cdot c$? Shouldn't this be the answer?
$endgroup$
– MattAllegro
Apr 24 '14 at 19:25
$begingroup$
@naslundx: examples show the order for Google is not the same as for the other softwares tested. Which is order "for mathematics"? $amod bcdot c=amod (bcdot c)$ or $amod bcdot c=(amod b)cdot c$? Shouldn't this be the answer?
$endgroup$
– MattAllegro
Apr 24 '14 at 19:25
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
There is no well established convention for the order of precedence between "the modulus operator" and multiplication (or addition, for that matter, because the same problem arises if you replace multiplication with addition in your question.) You have in your hands an example demonstrating that they can't be used with equal precedence.
The acceptability of the final answer hinges entirely upon the choice made for precedence.
While % can certainly be treated as a binary operation of natural numbers, it is not really the main way mathematicians use modulus. Rather than looking at it as an operation, we think of it as indicating the 'environment' where arithmetic is taking place. So $pmod n$ indicates that we are not working in the natural numbers but with a quotient ring of the integers.
In that context, you can establish an identity between modulus and $+/*$ operations. You could state it this way:
$$(a+b)%n = ((a %n)+(b%n)) %n$$
and
$$(a*b)%n = ((a %n)*(b%n)) %n$$
$endgroup$
add a comment |
Your Answer
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%2f767595%2forder-of-operations-involving-mod%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
There is no well established convention for the order of precedence between "the modulus operator" and multiplication (or addition, for that matter, because the same problem arises if you replace multiplication with addition in your question.) You have in your hands an example demonstrating that they can't be used with equal precedence.
The acceptability of the final answer hinges entirely upon the choice made for precedence.
While % can certainly be treated as a binary operation of natural numbers, it is not really the main way mathematicians use modulus. Rather than looking at it as an operation, we think of it as indicating the 'environment' where arithmetic is taking place. So $pmod n$ indicates that we are not working in the natural numbers but with a quotient ring of the integers.
In that context, you can establish an identity between modulus and $+/*$ operations. You could state it this way:
$$(a+b)%n = ((a %n)+(b%n)) %n$$
and
$$(a*b)%n = ((a %n)*(b%n)) %n$$
$endgroup$
add a comment |
$begingroup$
There is no well established convention for the order of precedence between "the modulus operator" and multiplication (or addition, for that matter, because the same problem arises if you replace multiplication with addition in your question.) You have in your hands an example demonstrating that they can't be used with equal precedence.
The acceptability of the final answer hinges entirely upon the choice made for precedence.
While % can certainly be treated as a binary operation of natural numbers, it is not really the main way mathematicians use modulus. Rather than looking at it as an operation, we think of it as indicating the 'environment' where arithmetic is taking place. So $pmod n$ indicates that we are not working in the natural numbers but with a quotient ring of the integers.
In that context, you can establish an identity between modulus and $+/*$ operations. You could state it this way:
$$(a+b)%n = ((a %n)+(b%n)) %n$$
and
$$(a*b)%n = ((a %n)*(b%n)) %n$$
$endgroup$
add a comment |
$begingroup$
There is no well established convention for the order of precedence between "the modulus operator" and multiplication (or addition, for that matter, because the same problem arises if you replace multiplication with addition in your question.) You have in your hands an example demonstrating that they can't be used with equal precedence.
The acceptability of the final answer hinges entirely upon the choice made for precedence.
While % can certainly be treated as a binary operation of natural numbers, it is not really the main way mathematicians use modulus. Rather than looking at it as an operation, we think of it as indicating the 'environment' where arithmetic is taking place. So $pmod n$ indicates that we are not working in the natural numbers but with a quotient ring of the integers.
In that context, you can establish an identity between modulus and $+/*$ operations. You could state it this way:
$$(a+b)%n = ((a %n)+(b%n)) %n$$
and
$$(a*b)%n = ((a %n)*(b%n)) %n$$
$endgroup$
There is no well established convention for the order of precedence between "the modulus operator" and multiplication (or addition, for that matter, because the same problem arises if you replace multiplication with addition in your question.) You have in your hands an example demonstrating that they can't be used with equal precedence.
The acceptability of the final answer hinges entirely upon the choice made for precedence.
While % can certainly be treated as a binary operation of natural numbers, it is not really the main way mathematicians use modulus. Rather than looking at it as an operation, we think of it as indicating the 'environment' where arithmetic is taking place. So $pmod n$ indicates that we are not working in the natural numbers but with a quotient ring of the integers.
In that context, you can establish an identity between modulus and $+/*$ operations. You could state it this way:
$$(a+b)%n = ((a %n)+(b%n)) %n$$
and
$$(a*b)%n = ((a %n)*(b%n)) %n$$
answered Oct 1 '15 at 10:37
rschwiebrschwieb
108k12104253
108k12104253
add a comment |
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%2f767595%2forder-of-operations-involving-mod%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
2
$begingroup$
There might be differences in the correct order of operations for mathematics and for various programming languages.
$endgroup$
– naslundx
Apr 24 '14 at 16:57
$begingroup$
For cases like this, where there is no ubiquitous convention, the denotation is ambiguous, so you should always use parentheses to disambiguate.
$endgroup$
– Bill Dubuque
Apr 24 '14 at 17:08
$begingroup$
I would but with a test question they don't alway do stuff like that.
$endgroup$
– traisjames
Apr 24 '14 at 17:42
1
$begingroup$
@naslundx: examples show the order for Google is not the same as for the other softwares tested. Which is order "for mathematics"? $amod bcdot c=amod (bcdot c)$ or $amod bcdot c=(amod b)cdot c$? Shouldn't this be the answer?
$endgroup$
– MattAllegro
Apr 24 '14 at 19:25