1
$\begingroup$

My question is probably very basic. It's related to the order of operations in the following simple formula:

$$\frac{A}{B\times C}.$$

My question arises when I want to write this formula in a single line. For instance: $150/1.5\times 0.33$.

Should I write $150/1.5\times 0.33$ or $150/(1.5\times 0.33)$. Is the answer equal to $300$ or $33.3$? I mean, it's obviously $300$ according to the original formula. But I am a bit confused with the single line formula.

I remember that the multiplication has a preference over the division. So, the parenthesis is not needed... But then the answer might be $33.3$, which is not correct. I get stuck with this quite simple thing.

  • 0
    Multiplication does not have precedence over division. Instead, $A/B\cdot C=(A/B)\cdot C\ne A/(B\cdot C)$.2017-01-22
  • 0
    "the multiplication has a preference over the division" - not really...2017-01-22
  • 1
    See [Order of operations](https://en.wikipedia.org/wiki/Order_of_operations).2017-01-22
  • 0
    If writing in a programming language a sequence of / and * they should have the same precedence - in practice numerical precision will probably be affected, but mathematically you could execute any order of them. What division means is to multiply with the inverse element. So division is actually a multiplication-in-disguise, but with another element - the multiplicative inverse.2017-01-22
  • 0
    @mathreadler: Totally false. Read any reference for any mainstream programming language and you will find that the order of execution is **determined** even if two operations have the same precedence. Secondly, you could have tried the example in this question itself to see that mathematically your claim is bogus.2017-01-31
  • 0
    Not at all true. There's plenty of languages where you can make sure you get the same result either way you do the computation. Arbitrary precision arithmetics, bigints, languages which can do computer algebra. Often you can decide for yourself in the language if you would like to switch precedence even.2017-01-31
  • 0
    @mathreadler: Your claim "mathematically you could execute any order of them" was ridiculous. $\large\color{red}{(6/3)\times 2 \ne 6/(3\times 2)}$. And in numerous mainstream languages including C/C++/Java/Javascript the precedence is **not** the only factor, but also associativity. Go and read a programming language reference. Read the question carefully; it is not about rearranging the numbers but the order of executing operations on the numbers next to them.2017-02-06
  • 0
    They have the exact same precedence mathematically so you need to specify which goes first. That division is decided to go before multiplication in absence of parens is nothing but a **convention** that many programming languages conform to because without parentheses the expression will be ambiguous and requiring parentheses would make expressions very convoluted. It is also true that precedence does matter whenever you have limited precision arithmetics, as is the case in languages where it is assumed the symbols will evaluate conforming to various popular floating point standards.2017-02-06

4 Answers 4

2

The other answers here address the mathematics of "order of operations" - operator precendence in programming languages. They pretty much tell you to use the parentheses.

I want to address this point explicitly:

My question arises when I want to write this formula in a single line.

You are asking here about communication. The important issue is to make your meaning unambiguously clear. So when writing inline you should use the parentheses in the denominator, even if they are unnecessary because your reader or your compiler "knows what you mean".

0
  1. Grouping (fractions, parantheses, $a\choose{b}$, etc)
  2. Exponents ($x^3$ and $\sqrt[a]{x}$)
  3. Multiplication (and division)
  4. Addition (and subtraction)

In $\frac{A}{BC}$ We can split it into $A \div (BC)$, first we do the grouping, the parentheses around $(BC)$, so we multiply $B$ by $C$. Then, we divide $A$ by $BC$.

This applies to all equations, across all mathematics.

0

Multiplication does not have precedence over division; they have the same precedence. And we perform operations with the same precedence from left to right. Same for addition and subtraction. $ \def\lfrac#1#2{{\large\frac{#1}{#2}}} $

Hence $A / B \times C = ( A \div B ) \times C$ which is different from $A / ( B \times C ) = \lfrac{A}{B \times C}$.

Curiously $\lfrac{AB}{C} = ( A \times B ) \div C = A \times B \div C = A \times ( B \div C ) = A \lfrac{B}{C}$.

But $\lfrac{A}{BC} = ( A \div B ) \div C = A \div B \div C \ne A \div ( B \div C ) = A \lfrac{C}{B}$.

Got it?

  • 0
    But be careful of "$a / bc$" which you may find in some books like [this one](https://books.google.co.uk/books?id=Il5wScV2JxUC&pg=PA67&lpg=PA67&dq="1/2π") (compare the earlier page), which may mean "$\lfrac{a}{bc}$". Some authors like this one would write "$1/2π$" for "$\lfrac1{2π}$" whereas others would write exactly the same thing to mean "$\lfrac12 π$".2017-01-31
-1

To understand this we must first explain what division means.

Division is multiplication by an inverse element. In a group or a field there is ensured to exist an inverse element such that if you multiply it it becomes 1 : $\frac{a}{a} = a^{-1}a= aa^{-1} = 1$. What is important is to specify which element should be inverted before multiplication. In many programming languages there is a convention that division has higher precedence. That is just to make sure one knows which number we should find the multiplicative inverse for before performing multiplication with it.

$$\frac{a}{bc} = a(bc)^{-1}, \frac{ab}{c} = ab(c)^{-1}$$ Where $(bc)^{-1}$ is the multiplicative inverse to $bc$ and $(c)^{-1}$ is the multiplicative inverse for $c$.

The horizontal division sign ____ only helps us explaining this for commutative algebras as we otherwise need to also decide from which side the division occurs. Or in other words from which side we should multiply with the multiplicative inverse.

  • 1
    In what programming languages does division have precedence over multiplication? In Java and C-like languages multiplication and division have the same precedence, with left-to-right associativity. So in `a*b/c` the multiplication is done first. While this may make no difference in a pure math environment, in a programming language it may make a great deal of difference (due to overflow, for example).2017-02-06
  • 0
    I tried answering the question, explaining what multiplication and division is and how they are usually defined to work in algebra. If you look closely, you may find that there is no mention of any programming language in the question at all.2017-02-06
  • 0
    I commented on the answer, not the question, because the answer _does_ include a discussion of programming languages. Possibly the answer would be better if it didn't mention programming languages at all (though you also have some comments under the question with similar claims about precedence about which I have similar doubts--there are other things in addition to "precedence" that determine order of operations in programming).2017-02-06
  • 0
    I did mention them because they seemed to be a part of the confusion. We could keep at the programming technicalities, but I don't think it will help with the confusion at this point to expand more on it.2017-02-06
  • 0
    I agree that expanding on it the technical issues is not desirable. I think the solution would be rather to say a lot _less_ about programming languages; it may be best to remove basically everything that's already been said here about them (including my comments).2017-02-06