# what does $-2^2$ evaluate to?

What does $-2^2$ evaluate to? My wife is upgrading her math & I'm quite uncertain how to answer.

is it the same as $(-2)^2$ or is it the same as $-(2^2)$?

at the heart of this is whether the minus sign is associated with the 2 or the expression $2^2$.

thank you! mp

• $-2^3 = -(2^3)$ Sep 30 '11 at 18:15
• The usual convention is that exponentiation occurs first, multiplication by constants and negative signs occur later. If you are following the usual conventions, then $-2^2$ would be interpreted as "do $2^2$ first, then multiply the answer by $-1$", to get $-4$. However, this is a convention. In some contexts, it might have been agreed that $-2^2$ means $(-2)^2$. Sep 30 '11 at 18:18
• thank you TheChaz--corrected the title. thank you arturo for setting the super script...didn't see how to do that. your reply is consistant with the book's chapter..."orders of operation". thank you all. Sep 30 '11 at 18:22

There are different conventions. In mathematics the usual one is to write $(-2)^2$ if you want to raise a negative number to a power, whereas $-2^2$ usually means $-(2^2)$.

This is, however, not completely universal. For example, many programming languages (that otherwise follow mathematical conventions for arithmetic expressions) consider a unary minus to bind tighter than any binary operator. In such languages, -2**2 (or whatever their syntax for exponentation is) would mean (-2)**2.

In the end you may be better off checking both interpretations and see which of them makes sense in context. And when writing things yourself, if in doubt err on the side of too many parentheses.

• I think the convention is universal in mathematics, if not within programming languages. I normally either comment or deduct points, saying it's incorrect, if I'm grading something where a student wrote $-2^2$ while clearly intending $(-2)^2$ or where $(-2)^2$ is correct. Sep 30 '11 at 19:12
• Apparently, Microsoft Excel follows the other convention support.microsoft.com/kb/q132686 :) Sep 30 '11 at 20:49
• @Henning: Do you know of any particular examples of a programming language that chooses the opposite convention?
– user14972
Sep 30 '11 at 22:27
• Actually, the C-based languages do not have an exponentiation operator, but use functions instead, so there would be no ambiguity. Fortran uses ** but it places that ahead of negation in precedence, and I would imagine that other languages styled after Fortran use the same precedence. Oct 1 '11 at 3:59
• python reports $-2**2 == -4$ as well, and I'm virtually certain magma and mathematica agree. Since you've mentioned fortran, that completely exhausts the languages I have at least passing familiarity with that I know have a binary exponentiation operator.
– user14972
Oct 1 '11 at 16:36