Incredibly basic notation question: Is $-1^2$ 1 or -1? How about $-x^2$ where $x$ is $1$?

84 Views Asked by At

Notation question: Is $-1^2$ equal to $1$ (because it's $(-1)^2$, as seems obvious) or $-1$ (because it's $-(1^2)$). E.g., is the $-1$ a single thing (token or whatever) in the equation? Similarly, let $x$ be $1$. Is $-x^2$ $1$ or $-1$?

I believe $-1^2$ is $1$ because "$-1$" is a single thing (a negative number), but that $-x^2$ where $x$ is $1$ is $-1$ because it's $-(x^2)$, the "$-x$" is not a single thing and exponeniation happens before negation.

Am I correct or incorrect? Or correct, but for the wrong reason?

This may seem incredibly odd to ask, but I'm suddenly unsure of something I've been sure of for more than four decades. Why would I question it? Because in JavaScript, -1 is not a numeric literal, it's a unary - operator followed by a numeric literal for the number 1, and this had pretty major ramifications for adding an exponentiation operator to the language, because the unary - has very high precedence. But I'm sure...ish that $-1$ in math notation is a literal number (and that exponentiation happens before negation).

2

There are 2 best solutions below

1
On BEST ANSWER

The exponent binds first, so $-1^2 = -1\cdot 1 = -1.$

3
On

You’re confusing $(-1)^2$ with $-1^2$. Recall that exponents have the priority, so you get

$$-1^2 = -(1)^2 = -1\cdot 1 = -1$$

On the other hand, for $(-1)^2$, you get

$$(-1)^2 = (-1)\cdot(-1) = +1$$

The same idea applies to all negative numbers raised to an even power. If the whole negative number is in parentheses, your answer becomes positive, but if the number is not within parentheses, the exponent comes first so the answer becomes negative.