We are probably all familiar with the following identities from basic calculus:

\[\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}x}e^x &= e^x, & \frac{\mathrm{d}}{\mathrm{d}x}\sin(x) &= \cos(x), & \frac{\mathrm{d}}{\mathrm{d}x}\cos(x) &= -\sin(x). \end{aligned}\]

A consequence of these facts is that, at least for the exponential, sine and cosine functions, if you differentiate them often enough you end up with the original function again:

\[\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}x}e^x &= e^x, & \frac{\mathrm{d}^2}{\mathrm{d}x^2}e^{-x} &= e^{-x}, & \frac{\mathrm{d}^4}{\mathrm{d}x^4}\sin(x) &= \sin(x), & \frac{\mathrm{d}^4}{\mathrm{d}x^4}\cos(x) &= \cos(x). \end{aligned}\]

We can represent these identities as a chain, where each link indicates differentiation and we stop once we reach the original function again:

\[\begin{aligned} e^x &\to e^x, & \sin(x) &\to \cos(x) \to -\sin(x) \to -\cos(x) \to \sin(x),\\ e^{-x} &\to -e^{-x} \to e^x, & \cos(x) &\to -\sin(x) \to -\cos(x) \to \sin(x) \to \cos(x). \end{aligned}\]

So the first-order derivative of \(e^x\) is \(e^x\) again; the chain has length one. The chain for \(e^{-x}\) has length two, because you have to differentiate \(e^{-x}\) twice before you get \(e^{-x}\) again. For the sine function, the chain has length four because the fourth order derivative of \(\sin(x)\) is \(\sin(x)\) again. Similarly, for the cosine function, we also have a chain of length four.

This suggests the following little recreational math problem:

For any \(n\), which functions \(f\) satisfy \(f^{(n)} = f\)?

Let’s introduce the following set:

\[\mathcal{F}_n = \{ f: \mathbb{C} \to \mathbb{C} \mid f^{(n)} = f \}.\]

Then obviously \(e^x \in \mathcal{F}_n\) for any \(n \geq 1\), \(e^{-x} \in \mathcal{F}_{2n}\) and \(\sin(x), \cos(x) \in \mathcal{F}_{4n}\). But can we be more general than this?

It is actually very easy to find at least one element of \(\mathcal{F}_n\) for every \(n\). Consider the function

\[f(x) = \alpha\exp(\beta x).\]

where \(\alpha\) and \(\beta\) are non-zero complex numbers. Note that

\[f^{(k)}(x) = \alpha\beta^k\exp(\beta x).\]

Therefore, if we let \(\beta\) be an \(n\)th root of unity, we have \(\beta^n = 1\) and we obtain the desired result:

Define the following function for any \(n > 0\):

\[F_n(x) = \exp\left(\exp\left(\frac{2\pi i}{n}\right)x\right).\]

This function satisfies

\[\frac{\mathrm{d}^k}{\mathrm{d}x^k}F_n(x) = \exp\left(\frac{2k\pi i}{n}\right)\exp\left(\exp\left(\frac{2\pi i}{n}\right)x\right).\]

In particular, \(F_n^{(n)} = F_n\) and so \(F_n \in \mathcal{F}_n\).

We recognize a few particular cases. For \(n = 1\), we find the exponential function, as expected:

\[F_1(x) = \exp\left(\exp\left(2\pi i\right)x\right) = e^x.\]

For \(n = 2\), we find the negative exponential:

\[F_2(x) = \exp\left(\exp\left(\pi i\right)x\right) = e^{-x}.\]

For \(n = 4\), we have

\[\exp\left(\exp\left(\frac{\pi i}{2}\right)x\right) = e^{ix} = \cos(x) + i\sin(x).\]

Hence the real part of \(F_4(x)\) equals the cosine function and the imaginary part is the sine. However, we also already know that the sine and cosine are individual members of \(\mathcal{F}_4\), so this suggests a broader solution than that given by our formula for \(F_n\).

For other values of \(n\) I don’t really recognize familiar functions, but there is the following nice result:

For every \(n\), the function \(F_n\) can be written as

\[F_n(x) = e^{x\alpha}\left(\cos(x\beta) + i\sin(x\beta)\right)\]

where

\[\begin{aligned} \alpha &= \cos\frac{2\pi}{n}, & \beta &= \sin\frac{2\pi}{n}. \end{aligned}\]

This characterizes a class of functions \(F_n\) where the \(n\)th derivative of \(F_n\) is the derivative of smallest order so that \(F_n^{(n)} = F_n\). Furthermore, because of the properties of the derivative, we also have the following observations:

  1. If \(f \in \mathcal{F}_n\) then \(af \in \mathcal{F}_n\) for every \(a \in \mathbb{C}\).

  2. If \(g \in \mathcal{F}_n\) and \(h \in \mathcal{F}_n\), then \(g + h \in \mathcal{F}_n\) as well.

From the above observations it follows that \(\mathcal{F}_n\) actually forms a vector space, which means we can completely characterize it by finding a basis. For \(n = 1\), the only functions in \(\mathcal{F}_1\) are known to be multiples of \(e^x\). This is because, if \(f\) is any function with \(f' = f\), then we can define \(g(x) = f(x)e^{-x}\) and observe that

\[g'(x) = f'(x)e^{-x} - f(x)e^{-x} = 0.\]

Therefore, by simple integration, \(g\) must be constant, \(g(x) = c\), which implies \(f(x) = ce^x\). Hence

\[\mathcal{F}_1 = \mathrm{span}\{ e^x \},\]

which also shows that \(\mathrm{dim}(\mathcal{F}_1) = 1\). It is instructive to investigate this property from the point of view of linear independence. Specifically, if we claim that \(\mathcal{F}_1\) is spanned by two linearly independent functions,

\[\mathcal{F}_1 = \mathrm{span}\{ f_1, f_2 \},\]

then this is tantamount to the claim that all solutions of the following differential equation,

\[\label{eq:f1}\tag{1} F' - F = 0\]

are linear combinations of \(f_1\) and \(f_2\):

\[F = af_1 + bf_2.\]

However, we already know that all solutions of \(\eqref{eq:f1}\) are given by

\[F = Ce^x.\]

And so it follows that \(\mathcal{F}_1\) has only one basis function.

This reasoning generalizes to \(\mathcal{F}_n\). For if we claim that \(\mathcal{F}_n\) is spanned by \(m\) basis functions, then this is equivalent to saying that all solutions of the differential equation

\[\label{eq:fn}\tag{2} F^{(n)} - F = 0\]

are linear combinations of the \(m\) basis functions:

\[F = a_1f_1 + \dots + a_mf_m.\]

It is a basic result that the solutions of a differential equation of the form \(\eqref{eq:fn}\) can be found via the characteristic polynomial, which in this case takes the special form

\[\chi_n(\lambda) = \lambda^n - 1.\]

The roots of \(\chi_n\) are given by the roots of unity,

\[\lambda_n = \exp\left(\frac{2\pi i}{n}\right) = \cos\left(\frac{2\pi}{n}\right) + i\sin\left(\frac{2\pi}{n}\right).\]

The solutions of \(\eqref{eq:fn}\) are therefore all linear combinations of the functions

\[\begin{aligned} &x^ke^{\alpha x}\cos(\beta x), & &x^ke^{\alpha x}\sin(\beta x) \end{aligned}\]

where

\[\begin{aligned} \alpha &= \cos\frac{2\pi}{n}, & \beta &= \sin\frac{2\pi}{n} \end{aligned}\]

and \(k = 0, \dots, n-1\). This finally completes our picture:

Every function \(f \in \mathcal{F}_n\) takes the form

\[f(x) = \sum_{k=0}^{n-1}x^ke^{x\alpha}\left(a_k\cos(x\beta) + ib_k\sin(x\beta)\right)\]

for constants \(a_0, \dots, a_{n-1} \in \mathbb{C}\) and \(b_0, \dots, b_{n-1} \in \mathbb{C}\) where

\[\begin{aligned} \alpha &= \cos\frac{2\pi}{n}, & \beta &= \sin\frac{2\pi}{n}. \end{aligned}\]

In particular, this implies

\[\mathrm{dim}(\mathcal{F}_n) \leq 2n.\]

The functions \(F_n\) which formed our initial guess for \(\mathcal{F}_n\) are clearly special cases, with \(a_0 = b_0 = 1\) and \(a_k = b_k = 0\) for \(k > 0\).