# Order of operations and negative numbers

#### conwy

##### New member
Dear FreeMathHelp community,

This seemingly simple math problem really has me stumped:

$y = f(x) = x^2-4x+3$
$f(2) = ?$
I tried to apply PEMDAS to solve this problem.

Well, PEMDAS says that multiplication goes after parens and exponents, right? And subtraction goes last, right?

So I figured... Ok, I'll solve it in this order:

1. Parens - nothing to do here
2. Exponents - [imath]x^2 = 2^2 = 4[/imath]
3. Multiplication - [imath]4x = 4 * 2 = 8[/imath]
4. Division - nothing to do here
5. Addition - [imath]8 + 3 = 11[/imath]
6. Subtraction - [imath]4 - 11 = -7[/imath]
So the result should be -7, shouldn't it?

But no! Apparently there's some hidden rule I didn't know about, because the correct answer is actually [imath]-1[/imath].

It seems like this has something to do with [imath]-4x[/imath] being considered together as a negative number, rather than as a subtraction of [imath]4x[/imath] from [imath]x^2[/imath].

Can anyone please explain to me how this is the case?

And if so, how can we differentiate between a genuine subtraction operation vs. a negative number?

Is there a rule that can be consistently applied to an equation, to figure out whether we're subtracting [imath]4x[/imath] from [imath]x^2[/imath] or adding [imath]-4x[/imath] and [imath]x^2[/imath] together?

Many thanks in advance to anyone who can help.

#### conwy

##### New member
A couple of clumsy diagrams to try to communicate my confusion lol

I hope they help you to see where I'm coming from!

#### jonah2.0

##### Full Member
Beer induced reaction follows.
Dear FreeMathHelp community,

This seemingly simple math problem really has me stumped:

$y = f(x) = x^2-4x+3$
$f(2) = ?$
I tried to apply PEMDAS to solve this problem.

Well, PEMDAS says that multiplication goes after parens and exponents, right? And subtraction goes last, right?

So I figured... Ok, I'll solve it in this order:

1. Parens - nothing to do here
2. Exponents - [imath]x^2 = 2^2 = 4[/imath]
3. Multiplication - [imath]4x = 4 * 2 = 8[/imath]
4. Division - nothing to do here
5. Addition - [imath]8 + 3 = 11[/imath]
6. Subtraction - [imath]4 - 11 = -7[/imath]
So the result should be -7, shouldn't it?

But no! Apparently there's some hidden rule I didn't know about, because the correct answer is actually [imath]-1[/imath].

It seems like this has something to do with [imath]-4x[/imath] being considered together as a negative number, rather than as a subtraction of [imath]4x[/imath] from [imath]x^2[/imath].

Can anyone please explain to me how this is the case?

And if so, how can we differentiate between a genuine subtraction operation vs. a negative number?

Is there a rule that can be consistently applied to an equation, to figure out whether we're subtracting [imath]4x[/imath] from [imath]x^2[/imath] or adding [imath]-4x[/imath] and [imath]x^2[/imath] together?

Many thanks in advance to anyone who can help.
It's impressive that you're familiar with LaTex.
Too drunk right now to help with your present concern.

#### pka

##### Elite Member
This seemingly simple math problem really has me stumped:
$y = f(x) = x^2-4x+3$I tried to apply PEMDAS to solve this problem.
$y = f(x) = x^2-4x+3$$y = f(x) = (2)^2-4(2)+3$$y = f(x) = 4-8+3=?$

#### Dr.Peterson

##### Elite Member
And subtraction goes last, right?

Has no one ever taught you that addition and subtraction are done together (from left to right)?

The rule does NOT say subtraction is after addition.

See, for example, here:

It seems like this has something to do with −4x being considered together as a negative number, rather than as a subtraction of 4x from x^2.

Can anyone please explain to me how this is the case?
No, that is not what is going on.
how can we differentiate between a genuine subtraction operation vs. a negative number?
Between two numbers, it's a subtraction. Without a number before it (such as in parentheses) it's negation.

#### conwy

##### New member
Ok, so it sounds like PEMDAS is really PEMD(AS), with the "AS" part grouped together and interchangeable in order. That is, PEMDAS or PEMDSA.

And the ultimate rule is left-to-right, correct?

So basically, PEMD is the same as one would intuitively guess, but only for AS, there is a special (secret) rule which says that you should read left-to-right as they occur in the expression, rather than first A then S?

Ok... got it. Thanks for telling me that. No, no one ever told me that, nor did I ever read it in a book.

As a programmer with 20 years of experience, glad I finally (maybe) reached Grade 1 level math!

People who say math is hard... they are infinitely right about that!

Anyway thanks for your help Dr.Peterson.

#### Dr.Peterson

##### Elite Member
Ok, so it sounds like PEMDAS is really PEMD(AS), with the "AS" part grouped together and interchangeable in order. That is, PEMDAS or PEMDSA.

And the ultimate rule is left-to-right, correct?
Actually, it's more like P[E(MD)(AS)], which is pretty much what the site says explicitly. The same issue arises with MD.

And, no, this is not secret. People just tend to put too much weight on PEMDAS, as if it said everything. You are supposed to learn the proper rules and just use PEMDAS, if at all, as a reminder. But either teachers fail to do that, or people remember only the misleading summary.

Programming languages have manuals that define operator precedence; math isn't defined by a committee or company, so you have to trust teachers to explain it clearly, and too many don't.

You may be interested in this page from a series in my blog: Order of Operations: Common Misunderstandings

#### conwy

##### New member
Ok thanks for your explanation, it's making more sense. I will read the two links you left and think harder about this problem.

#### JeffM

##### Elite Member
PEMDAS is a mnemonic to help us remember rather than a detailed explanation of a set of conventions. For example, P does not literally mean “parentheses.” It means “grouping symbols generally.”

16 - 9 - 2. If we go right to left, we get 16 - (9 - 2) = 16 - 7 = 11.
If we go left to right, we get (16 - 9) - 2 = 7 - 2 = 5.

Which is correct has nothing to do with any fundamental aspect of mathematics. Which is correct is determined by an agreement on how symbols are to be interpreted. The first rule of that agreement is left to right.

#### lev888

##### Elite Member
It seems like this has something to do with [imath]-4x[/imath] being considered together as a negative number, rather than as a subtraction of [imath]4x[/imath] from [imath]x^2[/imath].
In my opinion it doesn't matter whether you consider this as a negative number or subtraction. You didn't follow rules applicable to either case. I don't see anything there has to do with 4x. You already calculated 4x = 8.
You have: 4-8+3 = ?
If "-" makes 8 a negative number, and you want to go right to left, fine: -8+3 = -5, 4-5 = -1.
If "-" is subtraction: 4-8 = -4, -4+3 = -1.