Find the $n$ derivative of $y= e^{2x}\sin^2 x$

We have

\begin{align*} y&= e^{2x}\sin^2 x\\ &= e^{2x}\left(\frac{1-\cos 2x}{2}\right)\\ &= \frac{e^{2x}}{2} - \frac{e^{2x}\cos 2x}{2} \end{align*}

Then

\begin{align*} y^{(n)} &= \left(\frac{e^{2x}}{2}\right)^{(n)} - \left(\frac{e^{2x}\cos 2x}{2}\right)^{(n)}\\ &= 2^{n-1}e^{2x} - \left(\frac{e^{2x}\cos 2x}{2}\right)^{(n)} \end{align*} I don't know how to proceed with the rightmost term. So far I've been applying the Leibniz Rule whenever I've had to find the $n$ derivative of a function of the form $f(x)g(x)$, because is clear that either $f(x)$ or $g(x)$ has a derivative a $k$ derivative ($1<k<n$) equal to zero, which simplifies the expression nicely.

But here

$$\frac{e^{2x}\cos 2x}{2}$$

both functions are infinitely differentiable on $\mathbb{R}$ which makes things a bit different.

My only attempt was to write its n derivative in this form

\begin{align*} &=\frac{1}{2}\sum_{k=0}^n{n \choose k} \big(2^k e^{2x}\big)\bigg(2^{n-k}\cos \left[2x + \frac{\pi(n-k)}{2}\right]\bigg)\\ &=\sum_{k=0}^n {n \choose k} 2^{n-1}e^{2x}\cos \left[2x + \frac{\pi(n-k)}{2}\right] \end{align*}

So

\begin{align*} y^{(n)} &= 2^{n-1}e^{2x} -\sum_{k=0}^n{n \choose k} 2^{n-1}e^{2x}\cos \left[2x + \frac{\pi(n-k)}{2}\right]\\ &= 2^{n-1}e^{2x}\left(1 -\sum_{k=0}^n{n \choose k} \cos \left[2x + \frac{\pi(n-k)}{2}\right]\right) \end{align*}

$$2^{n-1}e^{2x}\left(1 -2^{n/2}\cos \left[2x + \frac{\pi n}{4}\right]\right)$$

For some reason I have the feeling that a little of modular arithmetic has to be applied on $\frac{\pi(n-k)}{2}$

• There is a missing binomial coefficient in the summation. I've posted a way forward. – Mark Viola Nov 21 '16 at 20:41
• @Dr.MV Ups!. I fixed that (: – Jazz Nov 21 '16 at 20:54

You're correct that Leibniz's Rule is a sound way forward. Note that we have

\begin{align} e^{2x}\sin^2(x)=\frac12 e^{2x}-\frac12 e^{2x}\cos(2x) \end{align}

Then, taking the $n$'th order derivative, we have

\begin{align} \frac{d^n}{dx^n}\left(e^{2x}\sin^2(x)\right)&=\frac{d^n}{dx^n}\left(\frac12 e^{2x}-\frac12 e^{2x}\cos(2x)\right)\\\\ &=2^{n-1}e^{2x}-\frac12 \sum_{k=0}^n\binom{n}{k}\frac{d^{n-k}e^{2x}}{dx^{n-k}}\frac{d^k\cos(2x)}{dx^k}\\\\ &=2^{n-1}e^{2x}\left(1-\sum_{k=0}^n\binom{n}{k}\frac{d^k\cos(2x)}{d(2x)^k}\right)\\\\ \end{align}

So, the problem boils down to taking the $k$'th derivative of the cosine function. But we can express that derivative as $\cos(x+k\pi/2)$. Hence, we have

\begin{align} \frac{d^n}{dx^n}\left(e^{2x}\sin^2(x)\right)&=2^{n-1}e^{2x}\left(1-\sum_{k=0}^n\binom{n}{k}\cos(x+k\pi/2)\right)\\\\ &=2^{n-1}e^{2x}\left(1-\text{Re}\left(\sum_{k=0}^n\binom{n}{k}e^{i(x+k\pi/2)}\right)\right)\\\\ &=2^{n-1}e^{2x}\left(1-\text{Re}\left(e^{ix}(1+i)^n\right)\right)\\\\ &=2^{n-1}e^{2x}\left(1-\text{Re}\left(2^{n/2}e^{i(x+n\pi/4)}\right)\right)\\\\ &=2^{n-1}e^{2x}\left(1-2^{n/2}\cos(x+n\pi/4)\right)\\\\ \end{align}

as was to be shown!

• What a clever way to do it. It never crossed my mind to take this approach. Thanks!! – Jazz Nov 21 '16 at 20:57
• You're welcome! My pleasure. -Mark – Mark Viola Nov 21 '16 at 21:02
• I have a little doubt (:. How from here $\frac{\mathrm{d}^k\cos(2x)}{\mathrm{d}x^k}$ one goes to $\frac{\mathrm{d}^k\cos(2x)}{\mathrm{d}(2x)^k}$?. I've been trying to do the step in between, but I' not getting it. I passed this $2^k$ from $2^{n-k}$, which is obtained by expanding $\frac{\mathrm{d}^{n-k}e^{2x}}{\mathrm{d}x^{n-k}}$, to the side of the cosine and then multiplied and divided the last factor by $2$, to get this $\frac{2^{k+1}}{2}\frac{\mathrm{d}^k\cos(2x)}{\mathrm{d}x^k}$. Certainly in the denominator we get $\mathrm{d}(2x)^k$ but I'm not able to get $\mathrm{d}^k\cos(2x)$ – Jazz Nov 21 '16 at 21:32
• From the $nxk$'th derivative on $e^{2x}$, we get a factor $2^{n-k}$, and from the $k$,th derivative on $\cos(2x)$, we get a factor $2^{k}$. Multiplying these leave $2^n$, which is independent of the index of summation. – Mark Viola Nov 21 '16 at 21:53

Calculate the fist few derivatives and see if a recognizable pattern shows up.

$f(x) = \frac {e^{2x}}{2} + \frac {e^{2x}\cos2x}{2}\\ f'(x) = e^{2x} + e^{2x} \cos 2x - e^{2x}\sin 2x\\ f''(x) = 2e^{2x} - 2e^{2x}\cos 2x - 2e^{2x}\sin 2x - 2e^{2x}\sin 2x - 2e^{2x} \cos 2x = 2e^{2x} - 4e^{2x}\sin 2x\\ f'''(x) = 4e^{2x} - 8 e^{2x}\sin 2x - 8 e^{2x}\cos 2x\\ f^{(4)} = 8e^{2x} - 16\cos 2x$

Do you see a pattern? Can you prove that the pattern will continue?

If you know a little bit about complex exponential you could say:

$f(x) = \frac {e^{2x}}{2} + Re[\frac {e^{(2+2i)x}}{2}]\\ f^{(n)}(x) = 2^n\frac {e^{2x}}{2} + \frac {(2\sqrt2)^n}{2} Re[\frac {e^{(2+2i)x + \frac {n\pi}{4}i}}{4}]\\ f^{(n)}(x) = 2^n\frac {e^{2x}}{2} + \frac {(2\sqrt2)^n}{2} e^{2x} \cos(2x + \frac {n\pi}{4})\\$

We know that $$\sin^2(x) = \dfrac{1 - \cos(2x)}{2}= \dfrac{1}{2} -\dfrac{1}{2}\Re(\exp(2ix)),$$ where $\Re$ is the real part of a complex number.

It follows that

$$y =\exp(2x)\sin^2(x) = \dfrac{\exp(2x)}{2} - \dfrac{1}{2}\Re(\exp(zx)),$$ with $z = 2+2i.$

Using complex-valued derivatives:

$$\dfrac{dy}{dx} = \exp(2x)- \dfrac{z}{4}\exp(zx)- \dfrac{z^{*}}{4}\exp(z^{*}x),$$ which leads to

$$\dfrac{d^ny}{dx^n} = 2^{n-1}\exp(2x) - \dfrac{z^n}{4}\exp(zx) - \dfrac{z^{*n}}{4}\exp(z^{*}x) = 2^{n-1}\exp(2x) - \dfrac{1}{2}\Re (z^n \exp(zx)).$$

The crux of the problem boils down to computing the $n$th derivative of the function $f(u)=e^u\cos u$. (Note that if $g(x)=f(2x)$, then $g^{(n)}(x)=2^nf^{(n)}(2x)$.) Using $\cos u=\Re(e^{iu})$ and $1+i=\sqrt2e^{i\pi/4}$, we find

$$f(u)=\Re(e^{(1+i)u})\implies f^{(n)}(u)=\Re((1+i)^ne^{(1+i)u})=2^{n/2}e^u\Re(e^{(u+n\pi/4)i})=2^{n/2}e^u\cos\left(u+{n\pi\over4}\right)$$

Applied to the OP's problem, we have

$$y(x)={e^{2x}\over2}-{f(2x)\over2}\implies y^{(n)}(x)={2^ne^{2x}\over2}-{2^nf^{(n)}(2x)\over 2}=2^{n-1}e^{2x}\left(1-2^{n/2}\cos\left(2x+{n\pi\over4} \right)\right)$$

Taking into consideration just the second part, let's call $$p(x)=e^{2x}\cos 2x$$ then \begin{align} &p^{(1)}(x)=2e^{2x}\cos 2x-2e^{2x}\sin 2x\\ &p^{(1)}(x)=2e^{2x}(\cos 2x-\sin 2x)=2e^{2x}\sqrt{2}\left(\frac{\sqrt{2}}{2}\cos 2x-\frac{\sqrt{2}}{2}\sin 2x\right)\\ &p^{(1)}(x)=2^{3/2}e^{2x}\left(\cos(\pi/4)\cos 2x-\sin(\pi/4)\sin 2x\right)\\ &p^{(1)}(x)=2^{3/2}e^{2x}\cos\left( 2x+\pi/4 \right) \end{align} and following the same calculation that we just did we can conclude that $$p^{(2)}(x)=2^{3/2}2^{3/2}e^{2x}\cos\left( 2x+\pi/4+\pi/4 \right)$$ Now we can see the pattern. So we can prove by finite induction that $$p^{(n)}(x)=2^{3n/2}e^{2x}\cos\left( 2x+n\pi/4\right)$$ and finaly: $$\left(\frac{e^{2x}\cos 2x}{2}\right)^{(n)}=2^{3n/2-1}e^{2x}\cos\left( 2x+n\pi/4\right)$$