Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was given a homework assignment to find a closed solution for the nth derivative of the function:

$f(x) = e^x \sin x$

So far I have been able to obtain the derivative as:

$f^{(n)}(x) = e^x S_n \sin x + e^x C_n \cos x$

The sequences S and C are defined as below:

$S_n = S_{n-1} - C_{n-1}$

$C_n = S_{n-1} + C_{n-1}$

$S_0 = 1$, $C_0 = 0$

I have been able to further simply this by combining the two equations and obtaining:

$C_n = 2S_{n-2}$

$S_n = S_{n-1} - 2 S_{n-3}$

However, I have no idea what to do now. Can anyone help me find the closed form solution?

share|cite|improve this question
up vote 4 down vote accepted

The recurrence $S_n=S_{n-1}-2S_{n-3}$ can be solved mechanically. Its auxiliary equation is $x^3-x^2+2=0$. By inspection $-1$ is a solution, so $x+1$ is a factor of the cubic: $$x^3-x^2+2=(x+1)(x^2-2x+2)\;.$$ The other roots are $$\frac{2\pm\sqrt{-4}}2=1\pm i\;,$$ so the solution is of the form $S_n=A(-1)^n+B(1+i)^n+C(1-i)^n$. From the initial values $S_0=S_1=1$ and $S_2=0$ we get

$$\left\{\begin{align*} &A+B+C=1\\ &-A+B+C+Bi-Ci=1\\ &A+2Bi-2Ci=0 \end{align*}\right.$$

This system has the solution $A=0,B=C=\frac12$, so $$S_n=\frac12\left((1+i)^n+(1-i)^n\right)$$ and $$C_n=(1+i)^{n-2}+(1-i)^{n-2}\;.$$

Now $1+i=\sqrt2 e^{i\pi/4}$ and $1-i=\sqrt2 e^{-i\pi/4}$, so

$$\left\{\begin{align*} &S_n=2^{(n-2)/2}\left(e^{in\pi/4}+e^{-in\pi/4}\right)=2^{n/2}\cos\frac{n\pi}4\\ &C_n=2^{(n-2)/2}\left(e^{i(n-2)\pi/4}+e^{-i(n-2)\pi/4}\right)=2^{n/2}\cos\frac{(n-2)\pi}4=2^{n/2}\sin\frac{n\pi}4\;. \end{align*}\right.$$

share|cite|improve this answer

Note that $S_{n+4} = -4 S_n$ and $C_{n+4} =-4 C_n$. So $S_{4k+j} = (-4)^k S_j$ and $C_{4k+j} = (-4)^k C_j$. List the cases $j = 0$ to $3$ and you're done.

share|cite|improve this answer

\begin{align} \left( \begin{array}{r} S_n\\C_n\\ \end{array} \right) &= \left( \begin{array}{rr} 1 &-1\\ 1 &1\\ \end{array} \right) \left(\begin{array}{c} S_{n-1}\\C_{n-1}\\ \end{array} \right)\\ &=\left( \begin{array}{rr} 1 &-1\\ 1 &1\\ \end{array} \right)^n \left(\begin{array}{c} S_{0}\\C_{0}\\ \end{array} \right) \end{align}

Approach 1: Compute eigen-decomposition of the matrix and continue.

Approach 2: Eigenvalues are $(1+i)$ and $(1-i)$. Therefore, $S_n$ must be of the form $A(1+i)^n+B(1-i)^n$. Now, use values of $S_0$ and $S_1$ to compute $A$ and $B$. $A=B=1/2$.

After further simplification, we get $$S_n = \sqrt{2^n} \cos \frac{n\pi}{4}, C_n = \sqrt{2^n} \sin \frac{n\pi}{4}$$

share|cite|improve this answer
In fact, you can use euler's formula and definition of $\sin x$ and $\cos x$ in terms of $e^{ix}$ to simplify further. – Shitikanth Oct 6 '12 at 0:09

$$\sin x=\frac{e^{ix}-e^{-ix}}{2i}$$

so $$f(x)=\frac{e^{(1+i)x}-e^{(1-i)x}}{2i}$$

Thus $$f'(x)=\frac{(1+i)e^{(1+i)x}-(1-i)e^{(1-i)x}}{2i}$$ $$f''(x)=\frac{(1+i)^2e^{(1+i)x}-(1-i)^ne^{(1-i)x}}{2i}$$ Following in similar manner gives, $$f^n(x)=\frac{(1+i)^ne^{(1+i)x}-(1-i)^ne^{(1-i)x}}{2i}$$

share|cite|improve this answer
Thank you for this very interesting method. I am sure this technique will be useful for future problems. – Lalaland Oct 6 '12 at 2:10

Here's a nice way that makes use of complex exponentials and involves no nasty recurrence relations.

Start by noticing that $\sin x$ is the imaginary part of $e^{ix}$.

Define a function $F$ as follows:

$F(x)=e^xe^{ix}=e^x\cos x+i e^x \sin x$

The function $f(x)=e^x\sin x$ can now be expressed as the imaginary part of $F$:


If you write $F$ as $F(x)=e^{(1+i)x}$ you can easily find its $nth$ derivative:

$F^{(n)}(x)=(1+i)^ne^{(1+i)x}=e^x \cdot(1+i)^ne^{ix}$

To make the extraction of the imaginary part of the above expression easier we can rewrite $1+i$ in polar form:

$1+i=\sqrt2 e^{i\pi /4}$

With this we finally write $F^{(n)}(x)$ as:

$F^{(n)}(x)=e^x\cdot 2^{n/2}e^{in\pi /4}e^{ix}=2^{n/2}e^x e^{i(x+n\pi /4)}$

If you now take the imaginary part you find:

$f^{(n)}(x)=Im(F^{(n)}(x))=2^{n/2}e^x \sin (x+n\pi /4)$

share|cite|improve this answer

I introduced a complete solution to the problem of finding the $n$th derivative and the $n$th anti derivative of many classes of elementary and special functions. The problem you are trying to solve is covered under the power exponential class. See this reference (section 6) or Ph.D. thesis, 2004 (page 85), where you find the general method.

Here is a formula found based on the general method

$$ f^{(n)}(x)={{\rm e}^{x}}{2}^{\frac{n}{2}}\sin \left( x+\frac{n\pi}{4} \right)\,. $$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.