Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question
    
$-2^3 = -(2^3)$ –  The Chaz 2.0 Sep 30 '11 at 18:15
1  
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$. –  Arturo Magidin 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. –  x-ray Sep 30 '11 at 18:22

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
3  
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. –  Michael Hardy Sep 30 '11 at 19:12
    
Apparently, Microsoft Excel follows the other convention support.microsoft.com/kb/q132686 :) –  Srivatsan Sep 30 '11 at 20:49
    
@Henning: Do you know of any particular examples of a programming language that chooses the opposite convention? –  Hurkyl 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. –  Daniel R Hicks 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. –  Hurkyl Oct 1 '11 at 16:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.