# Why Divide does not give the same answer? [closed]

I saw a question on Facebook $$8\div2 (2 + 2)=?$$

Consider these inputs.

Divide[8, 2 (2 + 2)]


1

$$8\div2 (2 + 2)$$ using esc+div+esc

16

Why the results are different.

I also tried these entries.

8/2 (2 + 2)


16

8/(2 (2 + 2))


1

Precedence /@ {Plus, Subtract, Times, Divide}


{310., 310., 400., 470.}

• Try using Trace[] to see how the evaluation is performed. – Anjan Kumar Aug 1 '19 at 14:58
• Is Mathematica just following the usual order of operations: en.m.wikipedia.org/wiki/Order_of_operations ? – JimB Aug 1 '19 at 15:02
• @OkkesDulgerci The arguments to Divide are treated as if you had parenthesis around each one. There is no spilling from denominator to numerator because of operator precedence like you can have when you are writing / as infix operator. – Thies Heidecke Aug 1 '19 at 15:08
• The answer to the question should be "It is X if I follow these rules, and Y if I follow these rules." It would be nice if that is what the Facebook poster is after. But my bias is that it is not an attempt at enlightenment. – JimB Aug 1 '19 at 15:20
• "There is no Supreme Court for mathematical notation; there were no commandments handed down on Sinai concerning operational precedence; all there is, is convention, and different people are free to adhere to different conventions. Wise people will stick in enough parentheses to make it impossible for anyone to mistake the meaning. If they mean, (48÷2)(9+3), they'll write it that way; if they mean 48÷(2(9+3)), they'll write it that way." - from here. – J. M. is in limbo Aug 2 '19 at 8:02

First, since the precedence of Divide is higher than Times, you should expect to parse 8 ÷ 2(2+2) as:

Divide[8, 2] (2+2)


You can also verify this by entering the input into a cell and using Cell | Show Expression to see what the boxes look like. The rendered version:

8 ÷ 2 (2 + 2)

and the version after using Cell | Show Expression:

Cell[BoxData[ RowBox[{ RowBox[{"8", "\[Divide]", "2"}], RowBox[{"(", RowBox[{"2", "+", "2"}], ")"}]}]], "Input", CellLabel->"In:="]

The boxes show that 8 ÷ 2 (with the boxes RowBox[{"8" "\[Divide]", "2"}]) is being multiplied by 2 + 2 (with the boxes RowBox[{"2", "+", "2"}]).

• Also FullForm[Hold[8/2 (2 + 2)]] might be easier to understand than "show expression" – Gustavo Delfino Aug 1 '19 at 18:36
• Thanks. This clears things a bit. But my main concern was, on help page for Divide it says you can use esc+div+esc for shorthand $\div$ and I expected to get the same result as Divide[8, 2 (2 + 2)]=1 but it didn't. – OkkesDulgerci Aug 1 '19 at 22:58