I'm simply asking for a citation to the order of preference convention
that you have indicated is universally accepted (outside of computer
programming). Unless you are claiming that its acceptance is (and
always has been?) so universal that it has never been authoritatively
declared--even in textbooks purporting to be the basis for teaching
unfamiliar students the fundamentals of the language to be used in
high-school algebra. Onus or not, I just find it odd that a thread can
have gone on this long with noone citing a source for a universally
accepted convention, other than assertions about broad usage.
First, we can agree that a convention on operator precedence is exactly
that --- a convention. A particular convention is not demanded by the
logic of mathematics.
Someone noted that the definition of "-x" as the additive inverse of an
element x in a ring does not by itself determine the meaning of an
expression such as "-x^2" --- that the meaning of "-x^2" depends on one's
operator precedence convention. That's correct. There are two operators in
the expression "-x^2", and you have to decide by convention which will be
done first.
It IS the case that there is a generally accepted convention for operator
precedence in mathematics. For the elementary operations, it is (highest
to lowest):
exponentiation
unary minus
multiplication and division (left associative)
addition and subtraction (left associative)
(People sometimes forget the associativity and just remember "My Dear Aunt
Sally" or something like that, but the associativity is part of the
precedence rules.) It is taught this way --- certainly in the U.S. --- I
would guess around middle or high school. (By the way, for people
complaining about a lack of citations, this may be one reason why no one
gave any earlier. I started hunting around and found that the most
elementary textbook I have here at home is at the calculus level.)
In other words, any mathematician would say that -3^2 is -9 and the
graph of y = -x^2 is a parabola opening downward. (I'm a math professor,
So I guess I'm citation #1.
In fact, pointing out that "-3^2 = -9,
not 9" is something most of us do to point out a "standard mistake".
But I guess people want "real" citations. If the following aren't
satisfactory, when I go into my office I'll get out some high school
algebra books and come up with all the citations anyone wants. (If people
want to check this themselves, that's where to look --- algebra books at
the high school or middle school level.)
"Brief Calculus" by Ron Larson and Bruce Edwards (6th edition). The order
of operations is listed on page 72, as I've given it above. To pick an
example at random, on page 78, problem 57 shows the graph of y = -x^2 + 2
--- a parabola opening downward.
I looked in calculus books by Anton, Stewart, and Smith and Minton and
easily found examples or problems which make it clear that "-x^2" means
"square first, then negate". For instance, the example cited by someone
earlier of (the normal probability density function) y = ce^(-x^2/2)
occurs in nearly all calc books (e.g. Smith and Minton, 2nd edition, page
469).
Other examples of this convention are readily available. Mathematica tells
me that -3^2 is -9. So does maxima. So does gap. So does my TI calculator.
For programmers, check out the yacc grammar on page 250 of "The UNIX
Programming Environment" by Brian Kernighan and Rob Pike. Note that
exponentiation has higher precedence than unary minus.
Note, by the way, that if "-x^2" were interpreted to mean "(-x)^2", then
there would never be any reason to write "-x^2", since it would be simpler
to write "x^2" instead. Moreover, if you wanted to square first, then
negate, you'd need to write the cumbersome "-(x^2)".
Yeah, it's a convention, but there IS an established convention in math,
and it says -3^2 is -9. If Excel does it differently, they're using a
different convention --- and I can understand how that would happen, in
trying to remain compatible with older software. My guess is one of the
original spreadsheet authors screwed it up, and people have been trying to
maintain compatibility since then. Actually, I'm glad this came up --- the
stat people in our department were tossing around the idea of using Excel
in their courses instead of a stat package, but this is a reason for
rejecting that idea. If Excel doesn't follow such a standard mathematical
convention, I don't think I'd want students using it in our courses.
Bruce I.