Division, Associativity, and Operator Precedence Conventions
Primary tabs
We recently came upon an online discussion that asked what $12/2/3/2$ was. Several people remarked that it was $1$ and others remarked that it was $9$. In typical internet fashion the venom came out and one individual who believed it was $9$ become more and more insulting to those who thought it was $1$. So what is the correct answer?
Let's first answer a simpler question. What is 12/2/3? We can actually do this in two ways. The first way is to work from left to right:
\begin{eqnarray}
12/2/3&=&6/3\\
&=&2.\\
\end{eqnarray}The second way is to think of everything to the right of / being in the denominator:
\begin{eqnarray}
12/2/3&=&\frac{12}{\left(2/3\right)}\\
&=&\frac{12}{2}\cdot\frac{3}{1}\\
&=&18.
\end{eqnarray}In other words, we are working from right to left in this solution. So is the correct answer 2 or 18?
The confusion lies in understanding the concept of associativity. Many math formulas contain more than one operator. By operator we mean things like addition, subtraction, multiplication, and division. For example, $2+5-6$ contains the addition and subtraction operators while $18-7*6$ contains the subtraction and multiplication operators. Associativity becomes important in equations where there is more than one of the same operator. For example, $3*5*2$ and $12/2/3$. In each of these equations which operation do you do first? Do you do $3*5$ first and them multiply that by $2$ or do you multiply $5*2$ first then multiply that answer by 3? This is exactly our issue here. Do I divide $12$ by $2$ and then divide that answer by $3$? Or do I divide $2$ by $3$ first? What I am really asking here is whether $12/2/3=(12/2)/3$ or does $12/2/3=12/(2/3)$?
A mathematical operation is considered associative when the order in which we do the operations does not matter. Consider our example of $3*5*2$. If we do $(3*5)*2$ we get $30$ because $(3*5)*2=15*2=30$. If we do $3*(5*2)$ we get $30$ because $3*(5*2)=3*10=30$. Multiplication is considered associative because the order in which we do the multiplication does not matter. In other words,
\begin{equation}
(3*5)*2=3*(5*2).
\end{equation}
We really don't care if $3*5*2=(3*5)*2$ or if $3*5*2=3*(5*2)$. They both give the same answer of $30$.
The confusion is that division is not associative. In math terms,
\begin{equation}
(12/2)/3\neq 12/(2/3)
\end{equation}
as we showed above.
In fact, one could argue that $12/2/3$ doesn't even make sense. There isn't enough information. Does this mean $(12/2)/3$ or does it mean $12/(2/3)$?
To help in these situations we use Operator Precedence conventions to standardize what we mean. The extra information we need to solve $12/2/3$ is a convention or agreement by everyone in the scientific community on which we do first - $12/2$ or $2/3$. The convention is to go from left to right. So when we see $12/2/3$ we should take this to mean $(12/2)/3=2$ and not $12/(2/3)=18$.
So with this convention we will all agree that when we see $12/2/3/2$ that we mean $((12/2)/3)/2=1$.