# Functions that commute

At the bottom of this post is a one-liner that I use in my classes the first time I present a theorem where two functions are permitted to commute. At many layers of the mathematics curriculum, students learn about that various functions can essentially commute with each other. In other words, the order in which the operations is performed doesn’t affect the final answer. Here’s a partial list off the top of my head:

1. Arithmetic/Algebra: $a \cdot (b + c) = a \cdot b + a \cdot c$. This of course is commonly called the distributive property (and not the commutative property), but the essential idea is that the same answer is obtained whether the multiplications are performed first or if the addition is performed first.
2. Algebra: If $a,b > 0$, then $\sqrt{ab} = \sqrt{a} \sqrt{b}$.
3. Algebra: If $a,b > 0$ and $x$ is any real number, then $(ab)^x = a^x b^x$.
4. Precalculus: $\displaystyle \sum_{i=1}^n (a_i+b_i) = \displaystyle \sum_{i=1}^n a_i + \sum_{i=1}^n b_i$.
5. Precalculus: $\displaystyle \sum_{i=1}^n c a_i = c \displaystyle \sum_{i=1}^n a_i$.
6. Calculus: If $f$ is continuous at an interior point $c$, then $\displaystyle \lim_{x \to c} f(x) = f(c)$.
7. Calculus: If $f$ and $g$ are differentiable, then $(f+g)' = f' + g'$.
8. Calculus: If $f$ is differentiable and $c$ is a constant, then $(cf)' = cf'$.
9. Calculus: If $f$ and $g$ are integrable, then $\int (f+g) = \int f + \int g$.
10. Calculus: If $f$ is integrable and $c$ is a constant, then $\int cf = c \int f$.
11. Calculus: If $f: \mathbb{R}^2 \to \mathbb{R}$ is integrable, $\iint f(x,y) dx dy = \iint f(x,y) dy dx$.
12. Calculus: For most differentiable function $f: \mathbb{R}^2 \to \mathbb{R}$ that arise in practice, $\displaystyle \frac{\partial^2 f}{\partial x \partial y} = \displaystyle \frac{\partial^2 f}{\partial y \partial x}$.
13. Probability: If $X$ and $Y$ are random variables, then $E(X+Y) = E(X) + E(Y)$.
14. Probability: If $X$ is a random variable and $c$ is a constant, then $E(cX) = c E(X)$.
15. Probability: If $X$ and $Y$ are independent random variables, then $E(XY) = E(X) E(Y)$.
16. Probability: If $X$ and $Y$ are independent random variables, then $\hbox{Var}(X+Y) = \hbox{Var}(X) + \hbox{Var}(Y)$.
17. Set theory: If $A$, $B$, and $C$ are sets, then $A \cup (B \cap C) = (A \cup B) \cap (A \cup C)$.
18. Set theory: If $A$, $B$, and $C$ are sets, then $A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$.

However, there are plenty of instances when two functions do not commute. Most of these, of course, are common mistakes that students make when they first encounter these concepts. Here’s a partial list off the top of my head. (For all of these, the inequality sign means that the two sides do not have to be equal… though there may be special cases when equality happens to happen.)

1. Algebra: $(a+b)^x \ne a^x + b^x$ if $x \ne 1$. Important special cases are $x = 2$, $x = 1/2$, and $x = -1$.
2. Algebra/Precalculus: $\log_b(x+y) = \log_b x + \log_b y$. I call this the third classic blunder.
3. Precalculus: $(f \circ g)(x) \ne (g \circ f)(x)$.
4. Precalculus: $\sin(x+y) \ne \sin x + \sin y$, $\cos(x+y) \ne \cos x + \cos y$, etc.
5. Precalculus: $\displaystyle \sum_{i=1}^n (a_i b_i) \ne \displaystyle \left(\sum_{i=1}^n a_i \right) \left( \sum_{i=1}^n b_i \right)$.
6. Calculus: $(fg)' \ne f' \cdot g'$.
7. Calculus $\left( \displaystyle \frac{f}{g} \right)' \ne \displaystyle \frac{f'}{g'}$
8. Calculus: $\int fg \ne \left( \int f \right) \left( \int g \right)$.
9. Probability: If $X$ and $Y$ are dependent random variables, then $E(XY) \ne E(X) E(Y)$.
10. Probability: If $X$ and $Y$ are dependent random variables, then $\hbox{Var}(X+Y) \ne \hbox{Var}(X) + \hbox{Var}(Y)$.

All this to say, it’s a big deal when two functions commute, because this doesn’t happen all the time.

I wish I could remember the speaker’s name, but I heard the following one-liner at a state mathematics conference many years ago, and I’ve used it to great effect in my classes ever since. Whenever I present a property where two functions commute, I’ll say, “In other words, the order of operations does not matter. This is a big deal, because, in real life, the order of operations usually is important. For example, this morning, you probably got dressed and then went outside. The order was important.”

## 6 thoughts on “Functions that commute”

This site uses Akismet to reduce spam. Learn how your comment data is processed.