Are variables always in brackets or just × (times)?

It has been a while since I had basic mathematics, let alone algebra, but I am trying to relearn it again. As I recall correctly, my teacher always said that if you have $$xy$$ in an expression (2 variables without an operation between them), it's exactly the same as $$x\times y$$. Now I need to evaluate an expression, in which I have the wrong answer, but I am not completely sure when to use the brackets.

Question: Evaluate $$-5x^2-(x+y)$$, where $$x=-2$$ and $$y=5$$.

My way would be (step by step):

\begin{align}-5x^2-(x+y)&=-5\times-2^2-(-2+5) \tag{fill in variables}\\ &=-5\times-2^2-3 \tag{brackets first} \\ &=-5\times-4-3 \tag{exponents second}\\ &=20-3 \\ &= 17\end{align}

According to the answer from the answer paper and different step by step calculators, it should be:

\begin{align}-5x^2-(x+y)&=-5(x)^2-(x+y) \tag{put brackets around x}\\ &=-5(-2)^2-(-2+5) \tag{fill in variables}\\ &=-5(-2)^2-3 \tag{brackets first}\\ &=-5\times4-3 \tag{\dagger}\\ &=-20-3 \\ &== -23\end{align}

where $$\dagger$$ is because $$(-2)^2 = (-2)(-2) = 4$$

Is it therefore safe to say if you have variables in an algebraic expression it is always between brackets?

• Well $x^2$ is $x\times x$, so if $x=-2$, then $x^2=x\times x = (-2)\times (-2) =(-2)^2$. – Minus One-Twelfth Jun 21 at 14:07
• Yes, it is never wrong to replace all $x$ by $(x)$ before substituting in the values. – Wouter Jun 21 at 14:16
• True, this is the main reason I am in doubt. In pre-algebra I learned that 2² = 2*2 = 4, -2² = - 2*2 = -4, -(2)² = - (2)(2) = -4and (-2)² = (-2)(-2) = 4. This might be wrong, but this how I learned it from different YouTube channels. – Jeff Jun 21 at 14:17
• It's not just minus signs, any expression other than a positive number has this problem. Suppose you want to substitute $x=2+3$ into $x^2$, you want $(2+3)^2 = 25$, not $2+3^2 = 11$ – Wouter Jun 21 at 14:20
• * immediately followed by - is not allowed. – Yves Daoust Jun 21 at 14:25

You get confused by viewing the evaluation of an expression as a matter of gradually replacing symbols in a formula by other symbols. Doing so is extremely convenient and a great timesaver, but only as long as you know where you need to insert parentheses in the right places such that you won't get nonsense out of it. And the way to know that is to know that symbol manipulation is not the real meaning of the expression.

Rather, an expression is a recipe for which calculation you perform. When you have an expression such as $$-5x^2 + (x+y)$$ this is really nothing more nor less than a compact way to write down these instructions:

1. Find the value of $$x$$.

2. Raise the result of step 1 to the second power.

3. Multiply the result of step 2 by five.

4. Take the negative of the result of step 3.

5. Find the value of $$x$$ (once again!)

6. Find the value of $$y$$.

7. Subtract the result of step 6 from the result of step 5.

8. Add the result of step 4 to the result of step 7.

9. The result of step 8 is, by definition, the value of the entire expression.

Now when you actually follow the recipe, it is clear that in your case with $$x=-2$$, the result of step 1 becomes negative two, and therefore the result of step 2 becomes positive four. The result of the value of $$x$$ is always what is squared in step 2.

So if you want to use symbolic rewriting to keep track of where in the recipe you are, you need to be sure to insert parentheses in the expression as necessary such that the steps of the original recipe what we haven't done yet still stay the same.

If you just replace the symbol $$x$$ textually by the symbols "$$-2$$" and get $$-2^2$$ for $$x^2$$, you've introduced a "negate the result" step after the "take the square" step, so you rewriting does not preserve the meaning. In order to preserve the meaning we need to insert parentheses to get $$(-2)^2$$.

This is the point of parentheses: To make clear how the calculation steps fit together and which results are input to which other steps.

Part of the source of the confusion here is that we don't have a single symbol that means "negative two". If we want an expression for that number, the best we can do is to write it $$-2$$ -- but that notation is really a two-step recipe:

1. Take the number two.

2. Take the negative of the result of step 1.

Inserting this recipe in place of all of the "find the value of $$x$$" in the original one means that we now have steps from different recipes in the same list of steps. So in order to write down those steps as an algebraic expression, we might need to write new parentheses to clarify the relation between steps that came from different sources:

$$-5(-2)^2 + (x+y)$$

(All of the PEMDAS stuff that some school teachers place an inordinate importance on are not more than the convention for how to get from the algebraic expression to a step-by-step recipe. Even though the rules say "parentheses first", nobody cares whether you actually carry out the addition in step 8 before you begin steps 2, etc -- the addition will give the same result no matter when you carry it out, as long as you're clear on which numbers it is you add. The importance of the parenthesis in the original expression says that the result of adding $$x$$ and $$y$$ is one of the inputs to the other addition, and not the other way around.)

• Instead of a linear recipe I would say an expression represents a tree with numbers or variables at the leaves and operations at the branches. I think elementary schools even use these trees before writing them down using parentheses. Maybe an answer using trees would be more appropriate. I don't have the time to prepare one myself though :-/ – Christoph Jun 21 at 15:26
• @Christoph: Yes, that would be even better, though at the risk of confusing lay readers who are not used to thinking in trees. – Henning Makholm Jun 21 at 15:28

When you say that filling in the variable $$x=-2$$ and $$y=5$$ results in:

1. -5*-2²-(-2+5)` (fill in variables)

you are changing the unary operator '-' (that takes a number $$x$$ and outputs $$-x$$ ... this is what the '-' does to the '2' in '-2') into a binary operator that subtracts a number from another number. That is really the mistake you make here. So the problem is not with the $$xy$$ being short for $$x * y$$, but how the minus sign is being used.