My Favorite One-Liners: Part 114

In this series, I’m compiling some of the quips and one-liners that I’ll use with my students to hopefully make my lessons more memorable for them.

I’ll use today’s one-liner whena step that’s usually necessary in a calculation isn’t needed for a particular example. For example, consider the following problem from probability:

Let X be uniformly distributed on \{-1,0,1\}. Find \hbox{Cov}(X,X^2).

The first step is to write \hbox{Cov}(X,X^2) = E(X \cdot X^2) - E(X) E(X^2) = E(X^3) - E(X) E(X^2). Then we start computing the expectations. To begin,

E(X) = (-1) \cdot \displaystyle \frac{1}{3} + 0 \cdot \displaystyle \frac{1}{3} + 1 \cdot \displaystyle \frac{1}{3} = 0.

Ordinarily, the next step would be computing E(X^2). However, this computation is unnecessary since E(X^2) will be multiplied by E(X), which we just showed was equal to 0. While I might calculate E(X^2) if I thought my class needed the extra practice with computing expectations, the answer will not ultimately affect the final answer. Hence my one-liner:

To paraphrase the great philosopher The Rock, it doesn’t matter what E(X^2) is.

P.S. This example illustrates that the covariance of two dependent random variables (X and X^2) can be zero. If two random variables are independent, then the covariance must be zero. But the reverse implication is false.

Facebook Birthday Problem: Part 5

Recently, I devised the following problem:

Suppose that you have n friends, and you always say “Happy Birthday” to each friend on his/her birthday. On how many days of the year will you not say “Happy Birthday” to one of your friends?

Until somebody tells me otherwise, I’m calling this the Facebook birthday problem in honor of Facebook’s daily alerts to say “Happy Birthday” to friends.

Here’s how I solved this problem. Let I_k be an indicator random variable for “no friend has a birthday on day k, where k = 366 stands for February 29 and k = 1, \dots, 365 stand for the “usual” 365 days of the year. Therefore, the quantity N, representing the number of days of the year on which no friend has a birthday, can be written as

N = I_1 + \dots + I_{365} + I_{366}

In yesterday’s post, I began the calculation of the standard deviation of N by first computing its variance. This calculation is complicated by the fact that I_1, \dots, I_{366} are dependent. Yesterday, I showed that

\hbox{Var}(N) = 365\displaystyle \left( \frac{1457}{1461} \right)^n \left[ 1 - \left( \frac{1457}{1461} \right)^n \right] + \displaystyle \left( \frac{1460}{1461} \right)^n \left[ 1 - \left( \frac{1460}{1461} \right)^n \right]

+ \displaystyle (365)(364) \left[ \displaystyle \left( \frac{1453}{1461} \right)^n - \displaystyle \left( \frac{1457}{1461} \right)^{2n} \right] + 2 \sum_{k=1}^{365}\hbox{Cov}(I_k,I_{366}).

To complete this calculation, I’ll now find \hbox{Cov}(I_k,I_{366}), where 1 \le k \le 365. I’ll use the usual computation formula for a covariance,

\hbox{Cov}(I_k,I_{366}) = E(I_k I_{366}) - E(I_k) E(I_{366}).

We have calculated E(I_k) earlier in this series. In any four-year span, there are 4 \times 365 + 1 = 1461 days, of which only one is February 29. Assuming the birthday’s are evenly distributed (which actually doesn’t happen in real life), the chance that someone’s birthday is not on day k is

\displaystyle 1 - \frac{4}{1461} = \displaystyle \frac{1457}{1461},

so that the probability that no friend has a birthday on day k is

\displaystyle \left( \frac{1457}{1461} \right)^n.

Therefore, since the expected value of an indicator random variable is the probability that the event happens, we have

E(I_k) = \displaystyle \left( \frac{1457}{1461} \right)^n

for k = 1, \dots, 365. Similarly,

E(I_{366}) = \displaystyle \left( \frac{1460}{1461} \right)^n,

so that

\hbox{Cov}(I_k,I_{366}) = E(I_k I_{366}) - \displaystyle \left( \frac{1457}{1461} \right)^n \left( \frac{1460}{1461} \right)^n.

To find E(I_k I_{366}), we note that since I_k is equal to either 0 or 1 and I_{366} is equal to either 0 or 1, the product I_k I_{366} can only equal 0 and 1 as well. Therefore, I_k I_{366} is itself an indicator random variable. Furthermore, I_k I_{366} = 1 if and only if I_k = 1 and I_{366} = 1, which means that no friends has a birthday on either day k or day 366 (that is, February 29). The chance that someone doesn’t have a birthday on day k or February 29 is

\displaystyle 1 - \frac{4}{1461} - \frac{1}{1461} = \displaystyle \frac{1456}{1461},

so that the probability that no friend has a birthday on day k or February 29 is

\displaystyle \left( \frac{1456}{1461} \right)^n.

Therefore, as before,

E(I_k I_{366}) = \displaystyle \left( \frac{1456}{1461} \right)^n,

so that

\hbox{Cov}(I_k,I_{366}) = \displaystyle \left( \frac{1456}{1461} \right)^n - \displaystyle \left( \frac{1457}{1461} \right)^n \left( \frac{1460}{1461} \right)^n.

Therefore,

\hbox{Var}(N) = 365\displaystyle \left( \frac{1457}{1461} \right)^n \left[ 1 - \left( \frac{1457}{1461} \right)^n \right] + \displaystyle \left( \frac{1460}{1461} \right)^n \left[ 1 - \left( \frac{1460}{1461} \right)^n \right]

+ \displaystyle (365)(364) \left[ \displaystyle \left( \frac{1453}{1461} \right)^n - \displaystyle \left( \frac{1457}{1461} \right)^{2n} \right] + 2(365) \left[ \left( \frac{1456}{1461} \right)^n - \displaystyle \left( \frac{1457}{1461} \right)^n \left( \frac{1460}{1461} \right)^n \right],

and we find the standard deviation of N using

\hbox{SD}(N) = \sqrt{\hbox{Var}(N)}.

The graph below shows the expected value of N, which was shown earlier to be

E(N) = 365 \displaystyle \left( \frac{1457}{1461} \right)^n + \left( \frac{1460}{1461} \right)^n,

along with error bars representing two standard deviations.

Interestingly, the standard deviation of N changes for different values of n; a direct calculation shows that the \hbox{SD}(N) is maximized at n = 459 with maximum value of approximately 6.1. Accordingly, for n = 450 and n = 500, the error bars in the above figure have a total width of approximately 24 days (two standard deviations both above and below the expected value).

Facebook Birthday Problem: Part 4

Recently, I devised the following problem:

Suppose that you have n friends, and you always say “Happy Birthday” to each friend on his/her birthday. On how many days of the year will you not say “Happy Birthday” to one of your friends?

Until somebody tells me otherwise, I’m calling this the Facebook birthday problem in honor of Facebook’s daily alerts to say “Happy Birthday” to friends.

Here’s how I solved this problem. Let I_k be an indicator random variable for “no friend has a birthday on day k, where k = 366 stands for February 29 and k = 1, \dots, 365 stand for the “usual” 365 days of the year. Therefore, the quantity N, representing the number of days of the year on which no friend has a birthday, can be written as

N = I_1 + \dots + I_{365} + I_{366}

In yesterday’s post, I began the calculation of the standard deviation of N by first computing its variance. This calculation is complicated by the fact that I_1, \dots, I_{366} are dependent. Yesterday, I showed that

\hbox{Var}(N) = 365\displaystyle \left( \frac{1457}{1461} \right)^n \left[ 1 - \left( \frac{1457}{1461} \right)^n \right] + \displaystyle \left( \frac{1460}{1461} \right)^n \left[ 1 - \left( \frac{1460}{1461} \right)^n \right]

+ \displaystyle 2 \!\!\!\!\! \sum_{1 \le j < k \le 365} \!\!\!\!\! \hbox{Cov}(I_j,I_k) + 2 \sum_{k=1}^{365} \hbox{Cov}(I_k,I_{366})

To complete this calculation, I’ll now find the covariances. I’ll begin with \hbox{Cov}(I_j,I_k) if 1 \le j < k \le 365; that is, if j and k are days other than February 29. I’ll use the usual computation formula for a covariance,

\hbox{Cov}(I_j,I_k) = E(I_j I_k) - E(I_j) E(I_k).

We have calculated E(I_k) earlier in this series. In any four-year span, there are 4 \times 365 + 1 = 1461 days, of which only one is February 29. Assuming the birthday’s are evenly distributed (which actually doesn’t happen in real life), the chance that someone’s birthday is not on day k is

\displaystyle 1 - \frac{4}{1461} = \displaystyle \frac{1457}{1461},

so that the probability that no friend has a birthday on day k is

\displaystyle \left( \frac{1457}{1461} \right)^n.

Therefore, since the expected value of an indicator random variable is the probability that the event happens, we have

E(I_k) = \displaystyle \left( \frac{1457}{1461} \right)^n

for k = 1, \dots, 365. Therefore,

\hbox{Cov}(I_j,I_k) = E(I_j I_k) - \displaystyle \left( \frac{1457}{1461} \right)^n \left( \frac{1457}{1461} \right)^n = E(I_j I_k) - \displaystyle \left( \frac{1457}{1461} \right)^{2n}.

To find E(I_j I_k), we note that since I_j is equal to either 0 or 1 and I_k is equal to either 0 or 1, the product I_j I_k can only equal 0 and 1 as well. Therefore, I_j I_k is itself an indicator random variable, which I’ll call I_{jk}. Furthermore, I_{jk} if and only if I_j = 1 and I_k = 1, which means that no friends has a birthday on either day j or day k. The chance that someone doesn’t have a birthday on day j or day k is

\displaystyle 1 - \frac{4}{1461} - \frac{4}{1461} = \displaystyle \frac{1453}{1461},

so that the probability that no friend has a birthday on day j or k is

\displaystyle \left( \frac{1453}{1461} \right)^n.

Therefore, as before,

E(I_j I_k) = \displaystyle \left( \frac{1453}{1461} \right)^n,

so that

\hbox{Cov}(I_j,I_k) = \displaystyle \left( \frac{1453}{1461} \right)^n - \displaystyle \left( \frac{1457}{1461} \right)^{2n}.

Since there are \displaystyle {365 \choose 2} = \displaystyle \frac{365\times 364}{2} pairs (j,k) so that 1 \le j < k \le 365, we have

\hbox{Var}(N) = 365\displaystyle \left( \frac{1457}{1461} \right)^n \left[ 1 - \left( \frac{1457}{1461} \right)^n \right] + \displaystyle \left( \frac{1460}{1461} \right)^n \left[ 1 - \left( \frac{1460}{1461} \right)^n \right]

+ \displaystyle 2 \times \displaystyle \frac{365\times 364}{2} \left[ \displaystyle \left( \frac{1453}{1461} \right)^n - \displaystyle \left( \frac{1457}{1461} \right)^{2n} \right] + 2 \sum_{k=1}^{365}\hbox{Cov}(I_k,I_{366}),

or

\hbox{Var}(N) = 365\displaystyle \left( \frac{1457}{1461} \right)^n \left[ 1 - \left( \frac{1457}{1461} \right)^n \right] + \displaystyle \left( \frac{1460}{1461} \right)^n \left[ 1 - \left( \frac{1460}{1461} \right)^n \right]

+ \displaystyle (365)(364) \left[ \displaystyle \left( \frac{1453}{1461} \right)^n - \displaystyle \left( \frac{1457}{1461} \right)^{2n} \right] + 2 \sum_{k=1}^{365}\hbox{Cov}(I_k,I_{366}).

The calculation of \hbox{Cov}(I_k,I_{366}) is similar to the above calculation; I’ll write this up in tomorrow’s post.

Facebook Birthday Problem: Part 3

Recently, I devised the following problem:

Suppose that you have n friends, and you always say “Happy Birthday” to each friend on his/her birthday. On how many days of the year will you not say “Happy Birthday” to one of your friends?

Until somebody tells me otherwise, I’m calling this the Facebook birthday problem in honor of Facebook’s daily alerts to say “Happy Birthday” to friends.

Here’s how I solved this problem. Let I_k be an indicator random variable for “no friend has a birthday on day k, where k = 366 stands for February 29 and k = 1, \dots, 365 stand for the “usual” 365 days of the year. Therefore, the quantity N, representing the number of days of the year on which no friend has a birthday, can be written as

N = I_1 + \dots + I_{365} + I_{366}

In yesterday’s post, I showed that

E(N) = E(I_1) + \dots + E(I_{365}) + E(I_{366}) = 365 \displaystyle \left( \frac{1457}{1461} \right)^n + \left( \frac{1460}{1461} \right)^n.

The calculation of the standard deviation of N is considerably more complicated, however, since the I_1, \dots, I_{366} are dependent. So we will begin by computing the variance of N:

\hbox{Var}(N) = \displaystyle \sum_{k=1}^{366} \hbox{Var}(I_k) + 2 \!\!\!\!\! \sum_{1 \le j < k \le 366} \!\!\!\!\! \hbox{Cov}(I_j,I_k),

or

\hbox{Var}(N) = \displaystyle \sum_{k=1}^{365} \hbox{Var}(I_k) + \hbox{Var}(I_{366}) + 2 \!\!\!\!\! \sum_{1 \le j < k \le 365} \!\!\!\!\! \hbox{Cov}(I_j,I_k) + 2 \sum_{k=1}^{365} \hbox{Cov}(I_k,I_{366})

For the first term, we recognize that, in any four-year span, there are 4 \times 365 + 1 = 1461 days, of which only one is February 29. Assuming the birthday’s are evenly distributed (which actually doesn’t happen in real life), the chance that someone’s birthday is not on day k is

\displaystyle 1 - \frac{4}{1461} = \displaystyle \frac{1457}{1461}.

Therefore, the chance that all n friends don’t have a birthday on day k is

\displaystyle \left( \frac{1457}{1461} \right)^n.

Using the formula \hbox{Var}(I) = p(1-p) for the variance of an indicator random variable, we see that

\hbox{Var}(I_k) = \displaystyle \left( \frac{1457}{1461} \right)^n \left[ 1 - \left( \frac{1457}{1461} \right)^n \right]

for k = 1, \dots, 365. Similarly, for the second term,

\hbox{Var}(I_{366}) = \displaystyle \left( \frac{1460}{1461} \right)^n \left[ 1 - \left( \frac{1460}{1461} \right)^n \right]

Therefore, so far we have shown that

\hbox{Var}(N) = 365\displaystyle \left( \frac{1457}{1461} \right)^n \left[ 1 - \left( \frac{1457}{1461} \right)^n \right] + \displaystyle \left( \frac{1460}{1461} \right)^n \left[ 1 - \left( \frac{1460}{1461} \right)^n \right]

+ \displaystyle 2 \!\!\!\!\! \sum_{1 \le j < k \le 365} \!\!\!\!\! \hbox{Cov}(I_j,I_k) + 2 \sum_{k=1}^{365} \hbox{Cov}(I_k,I_{366})

In tomorrow’s post, I’ll complete this calculation by finding the covariances.

Facebook Birthday Problem: Part 2

Recently, I devised the following problem:

Suppose that you have n friends, and you always say “Happy Birthday” to each friend on his/her birthday. On how many days of the year will you not say “Happy Birthday” to one of your friends?

Until somebody tells me otherwise, I’m calling this the Facebook birthday problem in honor of Facebook’s daily alerts to say “Happy Birthday” to friends.

Here’s how I solved this problem. Let I_k be an indicator random variable for “no friend has a birthday on day k, where k = 366 stands for February 29 and k = 1, \dots, 365 stand for the “usual” 365 days of the year. Therefore, the quantity N, representing the number of days of the year on which no friend has a birthday, can be written as

N = I_1 + \dots + I_{365} + I_{366}

Let’s start with any of the “usual” days. In any four-year span, there are 4 \times 365 + 1 = 1461 days, of which only one is February 29. Assuming the birthday’s are evenly distributed (which actually doesn’t happen in real life), the chance that someone’s birthday is not on day k is

\displaystyle 1 - \frac{4}{1461} = \displaystyle \frac{1457}{1461}.

Therefore, the chance that all n friends don’t have a birthday on day k is

\displaystyle \left( \frac{1457}{1461} \right)^n.

Since the expected value of an indicator random variable is the probability of the event, we see that

E(I_k) = \displaystyle \left( \frac{1457}{1461} \right)^n

for k = 1, \dots, 365. Similarly, the expected value for the indicator for February 29 is

E(I_{366}) = \displaystyle \left( \frac{1460}{1461} \right)^n.

Since E(X+Y) = E(X) + E(Y) even if X and Y are dependent, we therefore conclude that

E(N) = E(I_1) + \dots + E(I_{365}) + E(I_{366}) = 365 \displaystyle \left( \frac{1457}{1461} \right)^n + \left( \frac{1460}{1461} \right)^n.

This function is represented by the red dots on the graph below.

In tomorrow’s post, I’ll calculate of the standard deviation of N.

My Favorite One-Liners: Part 84

In this series, I’m compiling some of the quips and one-liners that I’ll use with my students to hopefully make my lessons more memorable for them.

Every once in a while, I’ll show my students that there’s a difficult way to do a problem that I don’t want them to do for homework. For example, here’s the direct derivation of the mean of the binomial distribution using only Precalculus; this would make an excellent homework problem for the Precalculus teacher who wants to torture his/her students:

E(X) = \displaystyle \sum_{k=0}^n k {n \choose k} p^k q^{n-k}

= \displaystyle \sum_{k=1}^n k  {n \choose k} p^k q^{n-k}

= \displaystyle \sum_{k=1}^n k  \frac{n!}{k!(n-k)!} p^k q^{n-k}

= \displaystyle \sum_{k=1}^n \frac{n!}{(k-1)!(n-k)!} p^k q^{n-k}

= \displaystyle \sum_{k=1}^n \frac{n (n-1)!}{(k-1)!(n-k)!} p^k q^{n-k}

= \displaystyle \sum_{i=0}^{n-1} \frac{n (n-1)!}{i!(n-1-i)!} p^{i+1} q^{n-1-i}

= \displaystyle np \sum_{i=0}^{n-1} \frac{(n-1)!}{i!(n-1-i)!} p^i q^{n-1-i}

= \displaystyle np(p+q)^{n-1}

= np \cdot 1^{n-1}

=np.

However, that’s a lot of work, and the way that I really want my students to do this, which is a lot easier (and which will be used throughout the semester), is by writing the binomial random variable as the sum of indicator random variables:

E(X) = E(I_1 + \dots + I_n) = E(I_1) + \dots + E(I_n) = p + \dots + p = np.

So, to reassure my students that they’re going to be asked to reproduce the above lengthy calculation, I’ll tell them that I wrote all that down for my own machismo, just to prove to them that I really could do it.

Since my physical presence exudes next to no machismo, this almost always gets a laugh.

My Favorite One-Liners: Part 30

In this series, I’m compiling some of the quips and one-liners that I’ll use with my students to hopefully make my lessons more memorable for them. Today’s quip is a follow-up to yesterday’s post and is one that I’ll use when I need my students to remember something that I taught them earlier in the semester — perhaps even the previous day.

For example, in my applied statistics class, one day I’ll show students how to compute the expected value and the standard deviation of a random variable:

E(X) = \sum x \cdot P(X=x)

E(X^2) = \sum x^2 \cdot P(X=x)

\hbox{SD}(X) = \sqrt{ E(X^2) - [E(X)]^2 }

Then, the next time I meet them, I start working on a seemingly new topic, the derivation of the binomial distribution:

P(X = k) = \displaystyle {n \choose k} p^k q^{n-k}.

This derivation takes some time because I want my students to understand not only how to use the formula but also where the formula comes from. Eventually, I’ll work out that if n = 3 and p = 0.2,

P(X = 0) = 0.512

P(X = 1) = 0.384

P(X = 2) = 0.096

P(X = 3) = 0.008

Then, I announce to my class, I next want to compute E(X) and \hbox{SD}(X). We had just done this the previous class period; however, I know full well that they haven’t yet committed those formulas to memory. So here’s the one-liner that I use: “If you had a good professor, you’d remember how to do this.”

Eventually, when the awkward silence has lasted long enough because no one can remember the formula (without looking back at the previous day’s notes), I plunge an imaginary knife into my heart and turn the imaginary dagger, getting the point across: You really need to remember this stuff.

My Favorite One-Liners: Part 8

In this series, I’m compiling some of the quips and one-liners that I’ll use with my students to hopefully make my lessons more memorable for them.

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.

green lineI 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.”

 

What to Expect When You’re Expecting to Win the Lottery

I can’t think of a better way to tease this video than its YouTube description:

Recounting one of the stories included in his book How Not to Be Wrong: The Power of Mathematical Thinking, Jordan Ellenberg (University of Wisconsin-Madison) tells how a group of MIT students exploited a loophole in the Massachusetts State Lottery to win game after game, eventually pocketing more than $3 million.

A personal note: though I haven’t talked with him in years, Dr. Ellenberg and I were actually in the same calculus class about 30 years ago.

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.

green lineI 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.”