Table of Contents

  1. Parentheses
  2. Exponents
  3. Multiplication and Division
  4. Addition and Subtraction
  5. Examples in R

The acronym PEMDAS helps to remember the order of operations in algebra. It stands for Parentheses, Exponents, Multiplication and Division (from left to right), Addition and Subtraction (from left to right).

Parentheses

First, perform all operations inside parentheses.

\\($ (a + b) \times c $\)

Exponents

Then, solve the exponents (or powers).

\\($ a^b $\)

Multiplication and Division

Next, perform multiplication and division from left to right.

\\($ \frac{a \times b}{c} $\)

Addition and Subtraction

Finally, perform addition and subtraction from left to right.

\\($ a + b - c $\)

Examples in R

Let's see some examples of these operations using R programming language.

Evaluating an expression with all operations.

# Expression: (3 + 2) ^ 2 - 4 * 2
result <- (3 + 2) ^ 2 - 4 * 2
print(result)

Evaluating a more complex expression.

# Expression: ((2 * 3) - (4 / 2)) ^ 2 + 6
result <- ((2 * 3) - (4 / 2)) ^ 2 + 6
print(result)

You should know PEMDAS by heart, the order of operations is crucial for correctly solving algebraic expressions.