Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

#1: Initial revision by user avatar Derek Elkins‭ · 2021-09-03T02:00:06Z (over 2 years ago)
This question contains a lot of confusion. First, an equation is something like $f(x) = g(x)$ (i.e. there's an equality sign). Solving an equation means finding (all) values for the free variables such that both sides become equal. In the above example, this would mean finding values for $x$ such that $f(x) = g(x)$.

PEMDAS is often described as a mnemonic for "order of operations" or "order of evaluation" meaning it tells you which subexpressions need to be evaluated first, but this is incorrect. Before getting to that, it probably helps to define "expression" and "evaluating an expression". Informally^[See [this grammar](https://en.wikipedia.org/wiki/Context-free_grammar#Example:_Algebraic_expressions) for a formal description of algebraic expression. That page also gives links to more formal definitions of the various words I'm only informally defining here.], an expression (or term) is some (well-formed) combination of operations, literals such as numbers, and variables. Which operations, literals, and variables are allowed depends on the type of expression it is, e.g. an arithmetic expression might not allow any variables and only allow +, -, *, / as operations. Semantically, an expression has a (typically numeric) value. (By contrast, an equation doesn't have a value but is rather something that holds or doesn't hold.^[That said, we can sometimes view equations as expressions that are Boolean-valued. Most of the time, though, there is a formal distinction between terms/expressions which have values in some domain, and formulas which can be either true or false.]) *Evaluating* an expression usually means reducing it to some normalized, "simplified" form^[Evaluation may also be a matter of *interpreting* an expression into some semantic domain.]. For example, $3^2$ is an expression and evaluating it would produce the number $9$.

Returning to PEMDAS, the first thing to note is this is only for expressions having a certain set of operations (exponentiation, multiplication, division, addition, and subtraction). It is not a general rule for all types of expressions. Regardless, PEMDAS doesn't have anything directly to do with evaluation and is instead about *precedence*. To put it one way, PEMDAS and precedence in general are about telling us where to insert parentheses in expressions.^[To put it a different way, it is information needed to produce a unique [(abstract) syntax tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree) from an expression represented as a string. When formally manipulating expressions, it usually makes more sense to think in terms of these trees and not strings of characters.] Exponentiation being higher precedence than addition means `3^2+5` corresponds to `(3^2)+5` and not `3^(2+5)`, and that's it. It says nothing about what order things are evaluated in and doesn't involve or require evaluation at all. Instead, it lets us know what the subexpressions are. In mathematics (as opposed to programming), we can evaluate subexpressions in any order. In `3^2+5` using the precedence rules that PEMDAS refers to `3^2` is a subexpression, `2+5` is not. Indeed, "what are the subexpressions of this expression" is a question that PEMDAS helps answer but doesn't involve evaluation.

It is rare but not unheard of to use different precedences for the operations PEMDAS refers to. This is just a matter of notation and is generally not considered a mathematically interesting alternative choice any more than using a different natural language would be. For operations, like modulus, that PEMDAS doesn't cover, their precedences will either be specified, or they won't be used in ambiguous ways, e.g. they will always have parentheses to disambiguate. Admittedly, authors aren't always that clear about these precedences, and sometimes they aren't specified so much as implied as one precedence leads to expressions that make sense and a different precedence leads to nonsense. For example, it is intuitively obvious that `=` has lower precedence than arithmetic operations as `3+(4=7)` makes no sense, while `(3+4)=7` makes sense.