When browsing the posts flaired Mathematics at r/askscience, I lighted upon the same question!
u/KyleG substantiates this comment:
It's arbitrary because all of written math is arbitrary symbolic
notation invented by humans. There are plenty of programming languages
and other types of notation systems that don't follow PEMDAS. For
example, Reverse Polish Notation (which was favored by early computer
scientists) is written "operand operand operator." So, for example 3 4
+ 7 / evaluates to 1 because, from left to right, 3 4 + evaluates to 3+4=7. Then you have 7 /, so the 7 that came from 3 4 + you divide by
For what it's worth, both exponents and parentheses are relatively
recent additions to math notation, so it makes sense that our
arbitrarily defined writing system would adapt to new symbols by
saying "everything works exactly the same as before, but before doing
that, we have to do the new stuff and get it out of the way."
Never the less, u/paolog ventures a reason for PEDMAS:
Essentially we use PEDMAS because we've found it to be useful in arithmetic and algebra (although there are areas of mathematics where this isn't necessarily the case). There's nothing to stop us from using, say, ~~SAMDEP~~ PSAMDE if we wanted to, but things would get very messy if we did.
Let's just consider the DMAS bit. Why do multiplication and division come before addition and subtraction? Because it makes sense to do it that way. I might send you out to buy me three half-dozen boxes of eggs and two boxes containing a dozen. The total number of eggs is 3 x 6 + 2 x 12. The real-life situation this describes requires us to interpret this as (3 x 6) + (2 x 12), or 42 in total, rather than 3 x (6 + 2) x 12. Multiplication before addition occurs naturally all the time, so it makes sense to do the operations in that order.
Furthermore, PEDMAS allows us to simplify algebra. We can write an expression like:
$c = 4a^2 + 5b + 1$
and we know this means we have compute $a \times a \times 4$ and $5 \times b$, add these together and add 1. If the order were SAMDEP, this would have to be written as:
$c = [4(a^2)] + (5b) + 1$
which is less easy to read.
Why do things work out this way? Well, multiplication is really repeated addition, and exponentiation is just repeated multiplication. Suppose a = 3 in the above expression, and we expand it out:
$c = 4 \times 3^2 + 5b + 1$
= 4 x (3 x 3) + b + b + b + b + b + 1
= 3 x 3 + 3 x 3 + 3 x 3 + 3 x 3 + b + b + b + b + b + 1
= 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + b + b + b + b + b + 1
Now we have only one operation so we can do the additions in any order, but you can see that if we go backwards to the original expression, each time we collect up addends into a multiplication, we get a single product that needs to be added to another result. So we end up adding together products, meaning multiplication must come before addition. Exponentiation bundles together multiplicands ready for multiplication by other terms, hence the exponentiation needs to be done before the multiplication.
If we consider integers only, division can be viewed as just repeated subtraction, and subtraction is just addition of negative terms, hence division comes at the same level as multiplication and subtraction at the same level as addition.
Parentheses give us a way of overriding the existing order, so P has to come before everything else so we can more easily solve word problems like the following: "How many ounces of vegetables are there in three bags of mixed vegetables each containing four ounces of carrots and six ounces of peas?" (Answer: $3 \times (4 + 6)$ oz = 3 x 10 oz = 30 oz.) Without parentheses, we would have to write $3 \times 4 + 3 \times 6$, essentially expanding the parentheses. Imagine if the parentheses contained some much more complicated expression - we would need to write it out in full several times over if parentheses weren't available.
TL;DR: For integers, exponentiation is repeated multiplication and collects up multiplicands ready for multiplication by or addition to other terms, while multiplication is repeated addition and collects up addends for addition to other terms. Hence it is useful to do exponentiation before multiplication (and division), and multiplication before addition (and subtraction). Parentheses give a way of overriding the order.
u/DirichletIndicator ventures another reason - polynomials.
It's because of polynomials.
Polynomials used to be one of the most studied objects back when this sort of notation was being formalized. Originally you'd have to write them like
$(2(x^2 )) + (3x) - 5$
which is just ridiculous. People are lazy, so they eventually dropped the parentheses and experienced mathematicians knew what they meant. But for new students, they had to explain how to read these nonsensical shorthands like
$2x^2 + 3x - 5.$
Well, the exponent is applied to x before you multiply it by 2. Then you multiply 2 by $x^2$ and 3 by x. Then you add everything together.
It's really nothing more than a typesetting rule, like "always put the period before the quotation mark." It was, at one point, the most convenient way to do things, and at some point it got formalized.