Monday, August 11, 2014

When Are Parentheses Required for Substitution?

In my remedial algebra classes, on introducing the substitution of numerical values for variables, I've always said that it's safest to perform this substitution inside parentheses, especially for negative numbers. Of course, we all intuit times when that's not strictly necessary. So in this lecture I usually get one of the brighter students asking, "Exactly when is it necessary?". I've found this to be a surprisingly difficult question to answer. After a rather embarrassingly long consideration, here's what I've come up with.

Parentheses are basically required in the following two situations:
  1. Separating juxtaposed signs and numbers, and
  2. Collecting expressions with one operation under a higher-order operation that is not also a grouping symbol.

For situation #1, I'm assuming that we're not ever inserting new operational symbols like × or in cases of juxtaposed multiplication -- just the substituted expression and possibly parentheses. Parentheses are probably only needed for factors after the first one (i.e., after the coefficient).

For situation #2, we're mostly talking about multiplication and exponents, with some lower-order operation in the expression being substituted. Contrast with fraction bars (for division) and radicals, which have grouping built into the symbol, and thus no general requirement for new parentheses.

Here are a few examples of each. For the following, let x = 1, y = –2, z = ab, and w = a + b. Examples of separating juxtaposed signs and numbers:

Examples of collecting expressions with one operation under a higher-order operation:

We can explain the first example immediately above in that the negative sign acts the same as multiplying by –1, and therefore must be collected under the exponentiation operation. However, this does get slightly complicated by the use of the minus sign for both unary negation (i.e., multiplying by –1), and binary subtraction, which have different placements in the order of operations. For example, the following may be taken as a slightly ambiguous case:

Here, in substituting any numerical values at all for x and y, parentheses will definitely be necessary. However, this particular instance doesn't have juxtaposed numerals -- the real reason may be taken to be that without the parentheses, this would read as subtraction (lower order than the initial juxtaposed multiplication).

A few notes on specific cases of substitution:
  • If substituting one variable for another, then parentheses are never needed (the order of operations is clearly identical before and after).
  • If substituting a whole number, then only the situation of juxtaposed numbers after the coefficient can apply. Obviously a whole number has no written sign, and includes no operations to interfere with higher-order interactions.
  • If substituting a negative number, then any of the situations are possible. It does have an attached sign, may need separation from an advance factor (as above), and operates similarly to a multiplication (and thus needing collection under an exponent). 

Note that Wikipedia articles do show use of juxtaposed signs, e.g., 7 + –5 = 2, and discusses possibly superscripting the unary negation in elementary contexts and the computer language APL (link one, two), something that I've also seen on some calculators, in which cases parentheses would not be necessary. However, that's not something I've ever seen in textbooks (either college-level or otherwise), so I take that as nonstandard and not qualifying as well-written algebra. 

What do you think? Have I missed any important cases or examples?


  1. I think my answer to this would be: parenthesize like crazy. It can't hurt. You might end up with a "messy" expression, but at least it'll evaluate correctly.

    PEMDAS is, after all, just a convention. You can completely ignore it if you explicitly parenthesize the entire expression. When you want to "clean up" your expression by removing parentheses, remove one pair and apply the PEMDAS rules. If the order of evaluation doesn't change, it was safe to remove them. But if it's different, put them back and try another pair.

    1. Sure, I agree. I really push my students hard in class to get them in the habit of parenthesizing by default. But then you do run into something like (a+b)^2 with a=3, b=4 and it does seem a little extravagant to be nesting parentheses there; so I was wondering what the formal expression of the rule would be.

      But on the other hand, my quiz on order-of-operations at actually does include potentially extra nested parentheses like ((3)+(4)), to make sure that people are accustomed to dealing with that when it does arise (even though I've gotten at least one complaint to take it out).

  2. Here's a new theory: Parentheses are necessary anytime more than a single symbol is being substituted (like -3, x+y, or 5x), or when it's juxtaposed to another symbol (lacking an operation symbol separator).

    1. Although still not needed in a+b if a = 5x and b = 3, say.