# Answer of $5 - 0 \times 3 + 9 / 3 =$

According to order of operations the answer should be $\mathbf{2}$ But Google and Wolfram calculates as 8

This is last proccess: $5-0+3$

This is how I think: $5-(0+3)$

This is how Google answers: $(5-0)+3$

So, question is which operation is first $+$ or $-$?

• Why is there a vote to close as not a real question? Looks like a question about mathematics to me.
– t.b.
Commented Aug 7, 2012 at 18:02
• Verily, this is a real question about expression parsing, which can be delicate matter of interest. Commented Aug 16, 2012 at 0:21

You proceed from left to right down the hierarchy. $$5- 0\cdot3 + 9/3 = 5 - 0 + 3 = 5 + 3 = 8.$$ You make the mistake of distributing the $-$ to two terms in the absence of parentheses.

• Could be computers automatically removes '-0' someone told me something like that. According to her, -0 represents nothing. Commented Aug 7, 2012 at 15:47
• That would be an error in the code for their parser. We know $-0 = 0$. Commented Aug 7, 2012 at 15:57

The operations + and - have the same priority, therefore google is right: $a - b + c$ is read as $(a-b) + c$.

$\times$ and $\div$ are higher precedence than $+$ and $-$, but each are associated left-to-right. First, the multiplication and division. Next, the leftmost addition/subtraction. Finally, the last addition. $$\begin{array}{c} 5-\color{#C00000}{0\times3}+\color{#C00000}{9/3}\\ \color{#C00000}{5-0}+3\\ \color{#C00000}{5+3}\\ 8 \end{array}$$

The $0$ is meant to "confuse" but if you write things in a very explicit $+,\times$ only notation it gets clearer:

\begin{align} &5-0\times 3+9/3 =\\ &5 + (-1)\times 0\times 3 + 9/3 =\\ & 5 + 0 + 3 = 8 \end{align}

Remember that $a-b$ is actually $a+(-1)b$, and multiplication takes precedence over addition, so $(-1)\times 0 + 3$ is not the same as $(-1)\times(0+3)$.

$$5-(0+3)=5-0-3=2$$ but $$(5-0)+3=5-0+3=8$$ There's no priority between $+$ and $-$, but most people prefer to start from right to do the calculation.

• As far as I always knew (and I haven't taught this stuff since my last kid was in junior high), the order between product/division and sum-substraction gets determined from left to right. Commented Aug 19, 2012 at 17:49