Why $f^2(x) \ne f(x)^2$?

I am working on an exploration which starts with the following affirmation:

In this section you studied the Binomial theorem. Recall function composition from earlier in the course. In this context (in working with a function under the operation of a composition) when we raise a function to a power like $$f^2$$, this means $$(f \circ f)(x)$$. In other words, we apply the composition twice.

After this affirmation, the exploration asks a few questions relating compositions with binomial expansions.

My question is: isn't it wrong to state that raising a function to a given power is the same as applying a composition that number of times? A simple counter example would be $$f(x) = 2x$$.

This invalidates the whole analysis.

Also, does this make the following question not relevant/meaningful? How could I go about approaching this problem? (assumning the question really means composition)

"Will binomial expansion work for function composition? Why or why not? Use your results to make a conjecture about the binomial theorem."

(given that we are actually not raising the function to a given power, the question seem off, but of course I could be wrong)

• It's a question of notation. They are generally not the same, and $f^2$ is ambiguous without context. May 20 at 17:14
• For that reason, I, as a personal choice, prefer to write $f^{\circ n}$ for the $n$-fold composition. May 20 at 17:26
• The ambiguity of the notation shows up most often in trigonometry, where the 2's in $\sin^2(x)$ and $\cos^2(x)$ denote squaring, but the -1's in $\sin^{-1}(x)$ and $\cos^{-1}(x)$ indicate function inverses, not the -1 power (reciprocal).
– Dan
May 21 at 5:24

It is true that very often, $$f(x)\cdot f(x)\neq f(f(x))$$. However, both of these operations behave somewhat "product-like" (e.g. linear algebra, where composition of linear maps corresponds precisely to matrix multiplication).

This means that when we write $$f^2(x)$$, it could reasonably mean either of them. Your source is clarifying that they want $$f^2(x)$$ to mean $$f(f(x))$$, rather than $$f(x)\cdot f(x)$$.

Mathematical notation alone does not mean anything until one defines what it means. One can define whatever one wants for any notation. Though it is wise to follow certain conventions for effective communication.

Under different contexts, the same written expression may have completely different meanings. For instance, the notation $$f^2(x)$$ is commonly used in two different ways:

• In the case when $$f$$ is a real-valued or complex-valued function, people may define $$f^2(x):=(f(x))^2$$. For example, the expression $$\sin^2(x)$$ is commonly understood as $$(\sin(x))^2$$.
• When $$f:X\to X$$ is a map on a set $$X$$, it does not make sense to multiply two elements. So the only reasonable way to interpret $$f^2(x)$$ is the function composition $$f\circ f(x)$$. This case the very common in linear algebra when one considers a linear transformation $$T:V\to V$$ on a vector space $$V$$.

Isn't it wrong to state that raising a function to a given power is the same as applying a composition that the number of times?

Yes. But when one writes $$f^2(x)=(f(x))^2$$, one does not mean to say that $$f\circ f(x)=(f(x))^2$$ (unless one explicitly claims so), but rather, one means that the right-hand side is the definition of the left.

"Will binomial expansion work for function composition? Why or why not? Use your results to make a conjecture about the binomial theorem."

In general, no. Think about the example of matrices in linear algebra. Specifically consider two $$2\times 2$$ matrices $$A$$ and $$B$$. Note that they can be regarded as functions from $$\mathbf{R}^2$$ to $$\mathbf{R}^2$$. But $$(A+B)^2=A^2+AB+BA+B^2\;.$$ You would have $$(A+B)^2=A^2+2AB+B^2$$ only when $$AB=BA$$. But matrices multiplications are not necessarily commutative.

More generally, given two functions $$f$$ and $$g$$ from $$X$$ to itself, it is not necessarily true that $$f\circ g=g\circ f$$.

• I'm a bit confused that in several parts of your answer you write functions as $X\to Y$ yet compose them with each other. To me that would only make sense of you have $X=Y$ i.e. your functions are endofunctions $X\to X$. That's certainly the easiest situation to use for examples, so personally I'd stick to that. Want to edit or did you pick different sets for a strong reason?
– MvG
May 29 at 9:33
• @MvG: thank you for pointing that out. Yes, one should have $X=Y$. I edited the answer. May 29 at 12:12

This is just a definition of what in this course you ar attending the expression f^2 will mean. In other circumstances - and this is more used . f^2 mein f times f.

Consider the following set: $$S:= Hom_{Sets}(\mathbb{R},\mathbb{R}),$$ that is, a collection of functions of the form $$f:\mathbb{R}\to\mathbb{R}$$. We can introduce binary operations on $$S$$: $$\{+,\cdot,\circ\}$$ where: $$(f+g)(x):= f(x)+g(x)$$ $$(f\cdot g)(x):= f(x)\cdot g(x),$$ using the field structure of $$\mathbb{R}$$ in the image and $$(f\circ g)(x):= f\big(g(x)\big).$$ We have left- and right-distribution of $$\cdot$$ over $$+$$: from which we may derive: $$(f+g)^2 := (f+g)\cdot (f+g) = (f+g)\cdot f + (f+g)\cdot g = f\cdot f+g\cdot f + f\cdot g +g\cdot g$$ $$= f^2 +2f\cdot g + g^2,$$ where we have used commutativity of times from the field property and used superscript for power of times. Similar considerations lead to binomial equation in terms of $$\{+,\cdot\}$$.

On the other hand, combining the definitions of the operations yields right-distribution of composition over plus and times: $$(f+g)\circ h = f\circ h + g\circ h$$ and $$(f\cdot g)\circ h = (f\circ h)\cdot (g\circ h).$$ But we need left-distribution of composition over addition for the binomial theorem construction to work. Is this true? $$f\circ (g+h) = f\circ g+f\circ h?$$ This property is part of the property called linearity and it is easy to construct a counter example (any nonlinear function).

Cx: Let $$f(x):= x^2$$ (times power). Then $$f(g+h) = g^2+2gh+h^2 \neq g^2+h^2 = f\circ g+f\circ h$$.

Another reason the expansion would fail would be that composition is not commutative (as user1046533 points out)!

The situation may complicate when different domains and codomains are considered.