# Do values attached to integers have implicit parentheses?

Given $5x/30x^2$ I was wondering which is the correct equivalent form.

According to BEDMAS this expression is equivalent to $5*\cfrac{x}{30}*x^2$ but, intuitively, I believe that it could also look like: $\cfrac{5x}{30x^2}$

I asked this question on MathOverflow (which was "Off-topic" and closed) and was told it was ambiguous. I was wondering what the convention was or if such a convention exists. According to Wikipedia the order of operations can be different based on the mnemonic used.

• I think you misread the Wikipedia article. The bit about mnemonics is just a tangential paragraph pointing out that mnemonics can be misleading about the order of operation. The conventional order is correctly documented earlier in the article. It supports the BEDMAS parsing. – whuber Jan 5 '11 at 23:53
• You were asking about the ambiguity, and it was closed as ambiguous? I sense potential irony. – Mateen Ulhaq Sep 25 '11 at 3:24

The programming languages I have used give equal priority to multiply and divide, and do them from left to right. This would support the $5*\cfrac{x}{30}*x^2$ assertion. As Wikipedia says, the acronym BEDMAS may be misleading as it implies that division precedes multiplication and addition precedes subtraction, while each pair is of equal priority. However, I suspect most people writing $5x/30x^2$ do mean $\cfrac{5x}{30x^2}$. I would say there is a tendency in people's minds to make the division slash lower priority than multiplication. But this is an excellent reason to put in parentheses when you are writing, and to check carefully what the author means when reading.

• I think that the interpretation $5x/30x^2 = (5x)/(30x^2)$ would be giving division a lower priority than multiplication. I speculate on why this would be in my answer. – Niel de Beaudrap Jan 6 '11 at 9:40
• If you assume left to right associativity I think this expression would be treated as $((5\times x)/30) \times x^2$. – Quixotic Jan 6 '11 at 12:57
• @Debanjan: you are strictly correct, but the value is the same as shown. – Ross Millikan Jan 6 '11 at 13:50
• I don't think you will find much programming languages that allow you to write $5x/30x^2$ without any sign for the multiplications, but those that do (I know MetaFont does when the left factor is an explicit number) should give higher priority to such implicit multiplications than to explicit multiplications or divisions. – Marc van Leeuwen Dec 11 '12 at 9:16
• Why even use the parentheses? If we're actually writing math for human consumption, we can easily use LaTeX (or other solutions) in most environments anymore. We can avoid both potential ambiguity and the difficulty of reading many nested parentheses. – mach Mar 31 '14 at 6:03

I am going to play Devil's Advocate on this one, because I've given it a little bit of thought after a tangentially related question on MathOverflow about bad notation. There is a good lexical argument to be made for the "intuitive" reading of $5x/30x^2$ as $\frac{5x}{30x^2}$.

Disclaimer. The following argument is not intended to communicate why expressions such as $a/bc$ are unambiguous. By definition, if there is no strong socially agreed upon convention, it is therefore ambiguous. However, I will argue for the hypothesis that almost anyone raised from an early age to read a European language, who quickly reads such an expression without reflecting too much, will probably understand $a/bc = \frac{a}{bc}$. Therefore, there exists a reasonable opportunity to establish such a convention.

One of the responders to the question of bad notation complained about the usage of juxtaposition for multiplication: he thought it introduced too much ambiguitiy. (For instance, does $f(x+y)$) refer to the product of a scalar $f$ with $x + y$, or the value of a function $f$ evaluated at $x + y$, or something else?) In the comments to that answer, I speculated that the reason for this convention is that it reduces the problem of parsing a mathematical expression such as $ax^2 + bx + c$; to the previously-solved problem (for Europeans, anyway) of parsing a written sentence in a European language, which breaks sentences into words. Juxtaposed variables form nice little cohesive "words". This hypothesis can even be extended to account for exponents and subscripts — more notation in which we don't use operator 'symbols' — to play the role of intra-word apostrophes or other diacritical marks.

Under this hypothesis, I can make a strong case for prefering the reading $a/bc$ as $\frac{a}{bc}$. Unlike multiplication or exponentiation, we introduce an actual symbol — a prominent punctuation mark, if you will, as intrusive as the $+$ symbol — into the expression. This divides the expression into two "words", $a$ and $bc$, upon which we perform the operation of division; thus leading to the reading $a/(bc)$. This is especially likely in the case where $a$ is effectively a place-holder, as in $1/2x$, where for "fluent speakers of mathematics" the $1$ is only there as a placeholder to allow the concept of multiplicative inverse to be expressed. Add to this the fact that it makes no sense at all to write $a/bc$ if you wish to convey the meaning $ac/b$, and one can almost safely say that anyone who writes $a/bc$ means $\frac{a}{bc}$.

The above is meant as a descriptivist (as opposed to prescriptivist) argument for how people read and write mathematics. If this is going to happen anyway, and if (as appears to be the case) it doesn't entail any heavy modification of our existing conventions, why not accept it in order to allow more flexibility in our notational repertoire? We can cut down on parentheses, and get rid of this phony ambiguity between something which can be better expressed anyway and an expression which at present we can only confidently convey with parentheses or with extra vertical space.

Now, of course, there is no solid existing agreement about whether to read $a/bc$ as $\frac{a}{bc}$ or as $\left(\frac ab\right)c$, except to accept that latter because of BEDMAS or what-have-you. So if your job is to evaluate your student's ability to communicate, then you should conclude that they aren't doing such a good job. But if you are trying to evaluate what they mean — and if you believe that they learned to read a European language from a tender age — then chances that when they write $5x/30x^2$, they mean $\frac{5x}{30x^2}$.

• Some related evidence: I searched for examples of $a/bc$ in actual mathematical literature, and found several that meant $a/(bc)$, and none that meant $(a/b)\cdot c$. math.stackexchange.com/a/213416 – MJD Mar 4 '14 at 15:03
• @MJD: I agree with you that multiplication using an operator should read left-to-right with division using an in-line operator, but multiplication without an operator should be grouped tighter than anything else; of course, if division is written with the dividend above a line and divisor below, the line should establish the grouping. Whether (a / (b * c)) should be written as a/bc or a/(bc) may be a judgement call, but the interpretation of a/bc is not. – supercat Mar 4 '14 at 19:17
• @MJD: Slight correction: it should group tighter than any other operators. Exponentiation written using a superscript should only grab the rightmost item. – supercat Mar 4 '14 at 19:47

It's just sloppy notation. You should never, ever write an expression like it, and you should complain to whoever gave it to you.

• I don't have a choice, students might write it like that and I was wondering what they meant. – Joe Jan 6 '11 at 0:06
• If a student wrote it I would assume (5x)/(30x^2) because the alternate would be less intuitive. But you should tell your students not to write expressions like this. – Qiaochu Yuan Jan 6 '11 at 0:08
• I am a lowly programmer and the system allows for such shenanigans. – Joe Jan 6 '11 at 0:12
• $\rm a/bc\$ is ambiguous. It could mean $\rm\ a/(bc)\$ or $\rm\ (a/b)c$ – Bill Dubuque Jan 6 '11 at 1:30
• @Joe: the requirements of software and the requirements of education are different. Software has to be as flexible as possible, but education is supposed to prepare the student for either the real world or more education, so it's natural to emphasize teaching your students how to communicate clearly. And a/bc is not clear communication. – Qiaochu Yuan Jan 6 '11 at 11:43

The conventions that $a/bc$ means $a/(bc)$, that $\ln 2x$ means $\ln(2x)$, and so on were universally established and very useful. Unfortunately, the combined influence of computer-style notation and excessive safe-playing by mathematics examiners has led to the present clutter of parentheses. Just pick up any maths book printed before 1970 (and many more recent ones), and you will see that absolutely no ambiguity arises. We need conventions like these; otherwise we will find ourselves having to write $\sin(4x) = (2\sin(2x))\cos(2x)$ for $\sin 4x = 2 \sin 2x \cos 2x$, to prove that we don't mean $(\sin 4)x = 2 \sin((2x \cos2)x)$, etc.

• Funny... contrary to what you say Principia Mathematica has ambiguity in it, and it got written long before computers. Also, you don't need any of these conventions or parentheses. Sin (4.x) could get written Sin .4x or Sin 4x. where "." indicates multiplication – Doug Spoonwood Apr 12 '12 at 4:17
• I don't understand the downvotes to this answer. I am quite used to "/" not being the same as the binary division symbol from grade school. For example I would never read $1/2\pi$ as $\pi/2$, and I agree with John Bentin that computer parsing is a likely reason anyone would think those are identical. – Carl Mummert Jul 28 '12 at 2:32

Not even calculator manufacturers agree on the subject of precedence:

• Not all calculators even agree on $2+3×4$. – badjohn Jul 12 '17 at 19:57

I think it depends on what is meant by the symbol $/$.

If the symbol $/$ is solely an indication of the binary division operator, sometimes also written $\div$, then the rule that all multiplications and divisions are performed together, working left-to-right, applies (that is, $a/bc$ should be taken to mean $\frac{a}{b}c$). If, however, the symbol $/$ is a vinculum (and, despite what Wikipedia says there, I have heard people use "vinculum" in the non-horizontal case) indicating division and grouping simultaneously, then $a/bc$ should be taken to mean $\frac{a}{bc}$.

However, if the latter sense is intended, I would expect the vinculum to appear bigger than a standard slash (in fact, at least for me, MathJax typesets $/$ to appear slightly bigger than a standard /) and I would also expect the "numerator" to be offset higher and the "demoninator" to be offset lower, e.g. $^a/_{bc}$

I suspect that the predominant interpretation at the moment is the former, that $/$ is equivalent to $\div$. I also know that on some earlier-model graphing calculators from Texas Instruments (the TI-81, I believe; none from the TI-82 onward), the latter interpretation was used (e.g., the input 8/2*2 would return 2).

In hand-written form, a horizontal line is a better delimiter for division. In type-set form, ditto: as in $\frac{5x}{30 x^2}$. Those of us of a certain age learned that a horizontal line was a grouping symbol. The slash creates the apparent ambiguity and should be avoided without parenthetical disambiguation. Observe that in $\TeX$, an over-use of braces is not harmful. The same is true with parentheses. Maturing math students should write mathematical expressions in correct form; otherwise, humans and machines will misinterpret the meaning.

Although this is really not what is being asked here but I am trying to answer from the perspective that leads to these kind of questions, that is, images circulating around the Internet showing calculators giving different results. Take a look at this question which I can not answer because it has been marked as duplicate although it really is not.

Let us take a simple innocuous looking expression $6/2(2+1)$ and try to evaluate it. Now, my Android phone (and a friend's scientific calculator) tells me that the answer is 9 but my scientific calculator (Casio fx-991ES Plus) tells me that the answer is 1. So which is the correct answer? I'm going to try and e kixplain what's actually going on, that is, why we are getting different answers in the first place even when we are using scientific calculators.

First thing first: it has got nothing to do with $BODMAS$ or $PEMDAS$ per se. No, we are not going to debate the order of precedence of operators. For the record, if you have taken a computer science class, you'd know that $D$ and $M$ enjoy the same order of precedence and we evaluate it from left to right. Moreover, there is no difference between an implicit or an explicit multiplication in computer science.

Let's get back to the issue hand. It's nothing too complicated and anyone who has studied computer science in high school or above should be familiar with this - Reverse Polish Notation or RPN.

We learned it as something called 'Postfix Expression' where every operator follows its operands. Softwares and apps designed for computers and phones use RPN for evaluating these expressions. We normally use infix expressions in our daily lives. For example, $A+B$ is an infix expression whereas the corresponding postfix expression would be $AB+$. The main reason for using postfix expression is that it removes the need of using parentheses and order of precedence of operators in expressions like the one we started with. We can then use a simple data structure called a 'stack' to evaluate the postfix expression. (At this point, I'd very much like to explain the algorithm for evaluating a postfix expression using a stack but I'll resist the urge. You can find it any introductory textbook on data structures and algorithms. But you are free to check out the Wikipedia page). And did I say it's relatively very easy to program the algorithm on a computer? So the main takeaway is that our phones gives us an answer which is absolutely correct as far as RPN goes. Phones and computers don't understand $BODMAS/PEMDAS$. They do what they are programmed to do and to do it fast, programmers tend to use RPN while coding them.

And that brings us to the next part of our answer: Scientific calculators don't usually use RPN. Some calculators may have a RPN mode but in general they don't use it and there is a very good reason for that. They use a much more intuitive algebraic method. In fact the algorithm used here tries to 'interpret how the user might be visually seeing the expression'.

For example, if I have a fraction whose numerator is 6 and denominator is 2(2+1), that is, something like $\frac{6}{2(2+1)}$ then I'd most likely type $6/2(2+1$) into the calculator, and if it were the using "RPN method" mentioned earlier, it would give an incorrect answer. So they evaluate the expression using the supposedly intuitive method. They probably use proprietary algorithms to achieve that.

In fact, Casio uses something called Natural Visually Perfect Algebraic Method which actually tries to implement BODMAS/PEMDAS with a caveat that it gives implicit multiplications a priority over explicit multiplication. It's an algorithm for evaluating infix expression and as the name suggests, expressions can be written as they are normally (or rather, naturally) written. In fact, if you look closely you'll find the acronym $'V. P. A. M.'$ written right above the display.

You may now say that all this is okay, but ask in frustration what is the correct answer- the very question that we, or at any rate I, had set out answer! Well, I'd say that both answers are correct... if you know what you are doing. If you are simply asked to evaluate such an expression then you could happily show the guy your middle finger express your anger with the person as the question is not “well defined“ (it needs more brackets). But if you have an expression that is well defined (like our 'fraction example') then you should be aware how your calculator plans to solve the said expression. There is, in fact, a popular saying among coders - 'Garbage In Garbage Out', and that's what's you should keep in mind. If you don't know what you are doing, you are going to get into trouble.

As an afterthought, I'd like add that maybe this is why one should not use cellphone calculators while solving numerical problems. But if you are going to use your phone, you can try emulating a scientific calculator instead of using those knockoff apps that just looks like a scientific calculator. It should also be noted that some older Casio calculators do not use $V.P.A.M.$ and this leads to funny situations like this or like the one in @sergiol's answer above.

Addendum: In my experience, such paradoxes come about when we try to evaluate an implicit multiplication before an explicit one. A Casio calculator treats $A(B+C)$ and $A*(B+C)$ differently because it interprets the former as $AB+AC=A(B+C)$ and respects a distributive law. Our original example with the fraction still holds. For example, a Casio calculator using $V.P.A.M.$ interprets $(3+7)/5(3+1)$ as $\frac{(3+7)}{5(3+1)}$ and gives us the result $\frac{1}{2}$. But when you key in the expression as $(3+7)/5*(3+1)$ it gives us $8$, thus giving priority to the implicit multiplication. The best way to avoid these kind of problems is to be sure about what you are typing and use parentheses wherever ambiguity may arise.

I think that the ambiguity originates, not from what is written, but from whom does the writing.

One who is completing her math assignment should write $\frac{a}{b}$ on her paper. One who is shingling your roof should write $1-1/2"\times 25 \div 7$ on a piece of plywood.

Hierarchy or Order Of Operations (PEMDAS/BODMAS)

1. First rule. Evaluate operations inside groupings indicated by ( ) [ ] { } These have the highest precedence in the Hierarchy of Operations. Example of groupings priority is (2+3) or [2(a+2)].

2. Second rule. Evaluate eponents or powers or orders like factorials and roots. e.g. x² or 5³ or 6! 10!!, √9

3. Third rule, Moving from left to right, evaluate Multiplication and Division in the order in which they appear.

Note: This third rule, applies only when it is written in the explicit symbols like × or • or *.

But when multiplication is implied only by parentheses like ( ), it has higher precedence or level of priorty. For instance;

In a÷b(c) we mean a÷[b(c)] or a÷(bc) while In a÷b×c we mean (a÷b)×c or (a/b)c

1. Fourth rule, the last rule. Moving from left to right, evaluate Addition and Substraction in the order in which they appear. e.g 2+3-4 we mean (2+3)-4 while 2-3+1 we mean (2-3)+4.

This is the standard used of different schools and individual mathematucians from different countries and territories, at least the majority of them.