So apparently this "equation" has been floating around the internet recently, and people seem unclear as to what the answer is.
I thought the programmers on here might be interested, so here's my take:
To me, it seemed extremely clear what the technically correct answer is when following the math convention known as PEMDAS.
- Parentheses - parentheses take precedence over everything else
- Exponents - exponents are like an IIFE - evaluate as soon as it's defined (after parentheses, of course)
- Multiplication/Division - these have equal precedence. Evaluated from left to right.
- Addition/Subtraction - again, equal precedence, evaluate from left to right.
So now, let's solve it:
8÷2(2+2)
First of all, this equation is making me feel cramped. Let's space it out:
8 ÷ 2(2 + 2)
I'm going to stop here for a second. I have heard people saying, even knowing PEMDAS, that the 2 should be multiplied with the parentheses first. I think it's the way it was written that confused people. Let's write it slightly differently (in a way that makes absolutely no change to the value):
8 ÷ 2 * (2 + 2)
Looking clearer? I think there's a psychological effect to having the 2 right next to the parentheses, which makes people think the 2 is almost part of the parentheses. Writing it like this makes it more clear.
Now we simply solve from left to right:
8 ÷ 2 * 4
4 * 4 = 16
One more thing: some people have objected, saying that if you approach it using the distributive property, it comes out as 1. But if you follow the left-to-right convention:
8 ÷ 2 * (2 + 2)
4 * (2 + 2)
8 + 8 = 16
Now I want to stress that PEMDAS is only a convention, and this is an ambiguous way of writing the equation. But isn't that why we have PEMDAS in the first place? Sure, it's only a convention, but it was made to make our writing of math more clear.
In the end, meanings are in people, not in what they write. So if you really want to be sure, ask the person who wrote the equation to explain exactly what they meant.