# $n$-derivative of function $f(x)=e^x \sin x$ at $x=0$

I have function $$f(x) = e^x \sin{x}$$ and must found $$f^{(n)}(0)$$

$$f'(x) = e^x(\sin{x} + \cos{x})$$

$$f''(x) = 2 e^x \cos{x}$$

$$f'''(x) = 2 e^x (\cos{x} - \sin{x})$$

$$f''''(x) = -4 e^x \sin{x}$$

$$f'''''(x) = -4 e^x (\sin{x} + \cos{x})$$

I think $$f^{(n)}(0) = \alpha (-1)^n x^{2n+1}$$ but I can't find $$\alpha$$

• Have you heard of the Taylor series? – Git Gud Oct 30 '16 at 20:16
• Yes, but I must found Maclaurin series – Stepan Vanzuriak Oct 30 '16 at 20:19
• Maclaurin series is simply the Taylor series at $0$. – Git Gud Oct 30 '16 at 20:20
• How it's can help? @GitGud – Stepan Vanzuriak Oct 30 '16 at 20:22
• You can find the Maclaurin series of $f$ by finding the cauchy product of the intervening functions. – Git Gud Oct 30 '16 at 20:25

Observe \begin{align} f(x)=e^x\sin x = \operatorname{Im} [e^{(1+i)x}]. \end{align} Using Taylor series for the exponential function, we have \begin{align} \operatorname{Im}e^{(1+i)x} = \operatorname{Im} \sum^\infty_{n=0}\frac{(1+i)^nx^n}{n!}. \end{align} Thus, it follows \begin{align} f^{(n)}(0) = \operatorname{Im}\ (1+i)^n = \operatorname{Im} (\sqrt{2}e^{i\frac{\pi}{4}})^n. \end{align} It should be elementary from here on.

You have already found a pattern:

$f^{(1)}(x) = e^x(\sin{x} + \cos{x})$

$f^{(2)}(x) = 2 e^x \cos{x}$

$f^{(3)}(x) = 2 e^x (\cos{x} - \sin{x})$

$f^{(4)}(x) = -4 e^x \sin{x}$

$f^{(5)}(x) = -4 e^x (\sin{x} + \cos{x})$

This means that $f^{(5)}(x) = -4 f^{(1)}(x)$, $f^{(6)}(x) = -4 f^{(2)}(x)$ and so on.

You can now easily find $f^{(4i)}(x)$, $f^{(4i+1)}(x)$, $f^{(4i+2)}(x)$ and $f^{(4i+3)}(x)$ for all $i \geq 0$ – use induction in $i$. Moreover, since $e^0 = 1$ and $\sin 0 = 0$ and $\cos 0 = 1$, you can now easily find the values of these derivatives at $0$.

I think the most appropriate approach is already given by @JackyChong.

Slightly more elaborated we have \begin{align*} \color{blue}{\left.\frac{d^n}{dx^n}\left(e^x\sin x\right)\right|_{x=0}} &=\left.\frac{d^n}{dx^n}\left(\Im e^{(1+i)x}\right)\right|_{x=0}\\ &=\Im \left.\left(\frac{d^n}{dx^n}e^{(1+i)x}\right)\right|_{x=0}\\ &=\Im\left.\left((1+i)^ne^{(1+i)x}\right)\right|_{x=0}\\ &=\Im(1+i)^n\\ &=\Im\left(\sqrt{2}\left(\cos \frac{\pi}{4}+i\sin\frac{\pi}{4}\right)^n\right)\\ &=2^{\frac{n}{2}}\Im\left(\cos\frac{n\pi}{4}+i\sin\frac{n\pi}{4}\right)\\ &\color{blue}{=2^{\frac{n}{2}}\sin\frac{n\pi}{4}} \end{align*}

Let us try to discover a general formula. I see two possible approaches.

The first one is to use induction: assume that $f^{(n)} (x) = \Bbb e ^x (a_n \cos x + b_n \sin x)$. We have $a_0 = 0$ and $b_0 = 1$. Then

$$f^{(n+1)} = \Bbb e ^x (a_n \cos x + b_n \sin x) + \Bbb e ^x (- a_n \sin x + b_n \cos x) = \Bbb e ^x [(a_n + b_n) \cos x + (b_n - a_n) \sin x ] ,$$

which gives us a recurrence relation that can be written in matrix form as

$$\begin{pmatrix} a_{n+1} \\ b_{n+1} \end{pmatrix} = \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix} \begin{pmatrix} a_n \\ b_n \end{pmatrix} = \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix} ^2 \begin{pmatrix} a_{n-1} \\ b_{n-1} \end{pmatrix} = \dots = \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix} ^{n+1} \begin{pmatrix} a_0 \\ b_0 \end{pmatrix} .$$

If $I$ is the identity matrix, prove by induction (it is easy) that

$$\begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix} ^{4n} = (-4)^n I .$$

It follows that

$$\begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix} ^{4n+1} = (-4)^n \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix} , \\ \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix} ^{4n+2} = (-4)^n \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix}^2 = (-4)^n \begin{pmatrix} 0 & 2 \\ -2 & 0 \end{pmatrix} , \\ \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix} ^{4n+3} = (-4)^n \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix}^3 = (-4)^n \begin{pmatrix} -2 & 2 \\ -2 & -2 \end{pmatrix} ,$$

whence it follows that

$$\begin{pmatrix} a_{4n} \\ b_{4n} \end{pmatrix} = (-4)^n \begin{pmatrix} 0 \\ 1 \end{pmatrix} , \\ \begin{pmatrix} a_{4n+1} \\ b_{4n+1} \end{pmatrix} = (-4)^n \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \end{pmatrix} = (-4)^n \begin{pmatrix} 1 \\ 1 \end{pmatrix} , \\ \begin{pmatrix} a_{4n+2} \\ b_{4n+2} \end{pmatrix} = (-4)^n \begin{pmatrix} 0 & 2 \\ -2 & 0 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \end{pmatrix} = (-4)^n \begin{pmatrix} 2 \\ 0 \end{pmatrix} , \\ \begin{pmatrix} a_{4n+3} \\ b_{4n+3} \end{pmatrix} = (-4)^n \begin{pmatrix} -2 & 2 \\ -2 & -2 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \end{pmatrix} = (-4)^n \begin{pmatrix} 2 \\ -2 \end{pmatrix} , \\$$

which gives the result

$$f^{(4n)} (x) = \Bbb e^x (-4)^n \sin x , \\ f^{(4n+1)} (x) = \Bbb e^x (-4)^n (\cos x + \sin x), \\ f^{(4n+2)} (x) = \Bbb e^x (-4)^n 2 \cos x , \\ f^{(4n+3)} (x) = \Bbb e^x (-4)^n (2 \cos x - 2 \sin x) ,$$

whence one finally gets

$$f^{(4n)} (0) = 0 , \\ f^{(4n+1)} (0) = (-4)^n , \\ f^{(4n+2)} (0) = 2 (-4)^n , \\ f^{(4n+3)} (0) = 2 (-4)^n .$$

An alternative approach would be to use Leibniz's general formula

$$(fg)^{(n)} = \sum _{k=0} ^n \binom n k f^{(n-k)} g^{(k)}$$

whence it follows that

$$\tag{*} (\Bbb e ^x \sin x) ^{(n)} (0) = \sum _{k=0} ^n \binom n k \sin^{(k)} (0) .$$

It is easy now (again, induction) to see that

$$\sin^{(4n)} = \sin, \quad \sin^{(4n+1)} = \sin' = \cos, \quad \sin^{(4n+2)} = \cos' = -\sin, \quad \sin^{(4n+3)} = -\sin' = -\cos ,$$

meaning that

$$\sin^{(4n)} (0) = 0, \quad \sin^{(4n+1)} (0) = 1, \quad \sin^{(4n+2)} (0) = 0, \quad \sin^{(4n+3)} (0) = -1 .$$

Plugging these in (*) will give you a result, but you would have to work on it a little bit in order to reach the same form obtained through the first method.

Referring to my past answer, we get the recurrence relation: $$f^{(n)}=2\left[f^{(n-1)}-f^{(n-2)}\right], f^{(0)}(0)=0, f^{(1)}(0)=1$$ which has the solution: $$f^{(n)}(0)=\frac12i\left((1-i)^n-(1+i)^n\right)=\\ \frac12 i (2^{n/2} e^{-iπn/4} - 2^{n/2} e^{iπn/4})=\\ 2^{n/2}\sin \left(\frac{\pi n}{4}\right).$$ For example: $$f^{(10)}(0)=2^5;\ \ \ \ \\ f^{(20)}(0)=0;\ \ \ \ \ \\ f^{(21)}(0)=-2^{10}.$$