What’s the 13rd derivative of sin(x)?

What an absurd question - does it even make sense? I think so, but in order to build up some intuition let’s take a few steps back.


Imagine that you lived in the middle ages and you were comfortable with the concepts of addition and multiplication. You even understand exponents, as a shorthand for repeated multiplication. Then someone asks you, what’s 212?

Nonsense, right? 23 means 222. There are three twos. You can’t have half a two.

Well, as I’m sure you know, yes - you can. But think about it for a second. What does it mean? What does it mean to multiply by x half a time?

xn is the number that you get when you multiply x n-times. Thinking about it this way makes the property xaxb=xa+b obvious. If you multiply by x a times, and then b more times, you’ve multiplied by x (a+b) times. And that property is nice, because it makes sense even when n is not an integer. If I do something 12 a time and then I do it again 12 a time, how many times have I done it? 1 time, right?

Which brings us to the (obvious because we already learned it) answer, which is that 212212=21=2, i.e. 212=2.


Let’s generalize a bit and talk about repeated function application.

Consider the function f(x)=x+10. What’s f(f(x))? That’s pretty easy:

f2(x)=f(f(x))=f(x+10)=x+20

Ok, how about f12(x)? Given the setup, I bet you can figure it out. It’s some function that, when applied twice, gives us f(x). What might that be? g(x)=x+5 seems like a good guess.

Let’s check it:

f12(x)=g(x)=x+5g(g(x))=g(x+5)=x+10=f(x)

Ok, how about another this one? If f(x)=2x, what’s f12(x)? Again, you can guess it. It’s g(x)=2x.

Alright, now let’s level up. Previously we were dealing with functions from a number to a number, but functions can take other types of things too. How about a function f which takes, as input, a function h and returns a new function? What does it do to the function? Let’s start with something easy, like it shifts it 10 to the right:

f(h(x))=h(x10)

Can we guess the answer for f12(x)? I’m going to go out on a limb and say yes. If you want to do something twice such that the end result is shifting 10 to the right, shifting 5 to the right each time will probably do the trick.

f12(h(x))=g(h(x))=h(x5)g(g(h(x)))=g(h(x5))=h(x10)

Ok, now for the finale. What if our function takes the derivative of the input function? In other words:

f(h)=ddxh

Eek… that is a bit harder.

Let’s take a quick detour and draw an analogy to linear algebra, specifically eigenvectors. If you want to multiply a vector, v, by a matrix, M, n times (where n is sufficiently large), a fast way to do it is to follow these three steps:

  1. Compute the eigenvectors of the matrix M. These are the vectors that, when multiplied by M, are just scaled by a constant (the constant being the eigenvalue).
  2. Decompose your vector into a linear combination (weighted sum) of those eigenvectors.
  3. Your answer is the linear combination of those eigenvectors, where each eigenvector is first scaled by its eigenvalue to the nth power.

I tried to explain why this works in depth here, but the quick summary is that we found special inputs (the eigenvectors) which were particularly easy compute for our function (multiplication by M), and then we reformulated our answer as a weighted sum of the function applied to those special inputs (n times). In doing so, we turned our somewhat hard problem into a much easier one.

One thing to mention is that this only work for linear functions, i.e. functions f which have the following two properties:

  1. f(u+v)=f(u)+f(v)
  2. (where α is a scalar)f(αu)=αf(u)

Does the derivative function have these properties? Actually yes:

  1. ddx(f+g)=ddx(f)+ddx(g)
  2. (where α is a scalar)ddx(αf)=αddx(f)

The derivative is a linear function (often called a linear operator). So, we can utilize the same trick.

Can you think of any functions which have a derivative that are equal to the function itself (or, maybe, a scaled version of it)?

Yep, you bet: ddx(ex)=ex, and ddx(eαx)=αeαx.

eαx is an eigenfunction of the derivative function. How cool!

So, if we could represent our input function h as a weighted sum of exponential functions, then we can trivially take the derivative any number of times (where that number doesn’t have to be an integer).

Oh, what’s that you say? The fourier transform can convert any function into a integral (read: weighted sum) of complex exponential functions (sometimes called complex sinusoids)?

f^(ω)=f(x)e2πixωdxf(x)=f^(ω)e2πixωdω

So, we’ve rewritten our function as a weighted sum of eigenfunctions of the derivative operator. The weights are f^(ω) and the eigenfunctions are e2πiωx. So, now we can trivially1 take the nth derivative:

dndxnf(x)=(2πiω)nf^(ω)e2πixωdω

At this point, we’ve solved how to take the nth derivative in the general case, but we haven’t technically answered our original question: what’s the 13rd derivative of sin(x)?

Lucky for us, the fourier transform of sin(x) is quite simple. To get a handle on it, let’s first graph f(t)=eit. Unfortunately, since eit is a complex number for a given t, in order to graph the function for a range of t values I’d need 3 dimensions. So, instead, I’ll graph eit as a function of time (time will by my 3rd dimension).

So that’s a single complex exponential function. What if we add one more which rotates at exactly the same rate but in the opposite direction, and then add the two values together?

The imaginary (vertical) components cancel each other out perfectly and all we’re left with is a real number, which is twice a sin curve.

Analytically,

f(x)=sin(x)=12(ieix+ieix)

Why multiply eix by i and eix by i? Since sin starts at 0, I want the counter-clockwise complex exponential (eix) to start out pointing down (and multiplication by i will rotate clockwise by π/2. Similarly, I want the clockwise one (eix) to start out pointing up (and multiplying by i will do that).

Let’s test our function for a few values of x:

sin(0)=12(iei0+iei0)=12(i+i)=0sin(π/2)=12(ieiπ/2+ieiπ/2)=12(ii+ii)=12(1+1)=1sin(π)=12(ieiπ+ieiπ)=12(i1+i1)=12(i+i)=0sin(3π/2)=12(iei3π/2+iei3π/2)=12(ii+ii)=12(1+1)=1

So far so good. How about its derivative?

ddxsin(x)=ddx(12(ieix+ieix))=12(eix+eix)

Well, we know what it should come out to, cos(x). Does it?

Yes, and here’s one way to think about it (you could also plug in a few values of x to really convince yourself). The form of this equation looks similar to the form of our equation for sin(x), except that the two complex exponential functions aren’t multiplied by i and i, respectively. That just means they both start out pointing directly to the right, instead of one pointing down and one pointing up like in the sin(x) case. You can look at the animation above and verify for yourself that if you start watching when the red and blue components are both pointing right, the graph looks like a cos(x) curve.

What this also makes apparent, though, is that cos(x) and sin(x) are generated by the same process, it’s just that cos(x) is just π/2 “ahead” of sin(x). This probably sounds familiar - that sin(x+π/2) and cos(x) are the same thing. One easy way to prove to yourself that this is to consider the fact that cos(a)=sin(b) in the (left) right triangle below and that b=a+π/2.

Ok, this interesting and all, but let’s solve the problem.

d1/3dx1/3sin(x)=d1/3dx1/3(12(ieix+ieix))=12(ii1/3eix+i(i)1/3eix)(using the fact that i=eiπ/2)=12(ieiπ/23eix+ieiπ/23eix)=12(iei(x+π/6)+iei(x+π/6))=sin(x+π/6)

And, in general:

dndxnsin(x)=sin(x+nπ/2)

Ok, one last thing (I promise!). We’ve been focusing on fractional derivatives, but how about negative ones? We have a general formula in terms of n, is there anything wrong with taking the derivative “-1” times? Nope! That should just correspond to taking the anti-derivative.

So, in conclusion, the 1πth derivative of sin(x) is (obviously) sin(x1/2).

  1. Note this is using the mathematician’s definition of trivial, i.e. “theoretically possible”