# Writing a general formula for nth derivative of $\cos(ax)$

So as stated in the title I have to create a general formula for nth derivative of $f(x) = \cos(ax)$ and proving it with induction.

I get $f(x) = \cos(ax)$

$f'(x) = -a\sin(ax)$

$f''(x) = -a^2\cos(ax)$

$f'''(x) = a^3\sin(ax)$

$f''''(x) = a^4\cos(ax)$

How are you supposed to algrebraically write a formula for this? I obviously see a pattern but I don't know how to approach this. Any help would be greatly appriciated.

• Nov 25, 2017 at 7:01

When $n=1$, you get $-a \sin ax$.
When $n=3$, you get $a^3 \sin ax$.
When $n=5$, you get $-a^5 \sin ax$.

So at each step you multiply by $-a^2$. So $f^{(n)} (x)=(-a^2)^{(n-1)/2}(-a)\sin ax,$ for $n$ odd.

When $n=0$, you get $\cos ax$.
When $n=2$, you get $-a^2 \cos ax$.
When $n=4$, you get $a^4 \cos ax$.

So at each step you multiply by $-a^2$. So $f^{(n)} (x)=(-a^2)^{n/2}\cos ax,$ for $n$ even.

• But for even derivatives according to your formula, would't the constant $a$ always be positive? At n =2 as an example. Nov 25, 2017 at 2:31
• @AliasaZarownyPseudonymia: I don't see where you see anything to that effect. Nov 25, 2017 at 8:33
• @AliasaZarownyPseudonymia $n=2$ would give $$f^{(n)}(x)=f^{(2)}(x)=(-a^2)^{2/2}\cos ax=-a^2 \cos ax$$ which is correct. Whether $a$ is positive or negative is not relevant. Does that clear up your problem? Nov 25, 2017 at 18:34

You can write $$f(x)=\cos(ax)=\frac{e^{iax}+e^{-iax}}{2}$$ so $$f^{(n)}(x)=a^n\frac{i^ne^{iax}+(-i)^ne^{-iax}}{2}$$ Now observe that $i=e^{i\pi/2}$ and $-i=e^{-i\pi/2}$, so $$i^ne^{iax}=e^{i(ax+n\pi/2)} \qquad\text{and}\qquad (-i)^n=e^{-i(ax+n\pi/2)}$$ Finally you get $$f^{(n)}(x)=a^n\cos\left(ax+n\frac{\pi}{2}\right)$$

$f^{(4k)}(x)=a^{4k}\cos(ax)$, $f^{(4k+1)}(x)=-a^{4k+1}\sin(ax)$, $f^{(4k+2)}(x)=-a^{4k+2}\cos(ax)$, $f^{(4k+3)}(x)=a^{4k+3}\sin(ax)$, $k=0,1,2,...$

• What did you do to understand that you have to take n = 4k? Nov 25, 2017 at 2:32
• I don't follow? In principle I am considering the remainder of dividing by $4$, that the pattern has a loop after four trials, of course @John Doe provided a more efficient answer. Nov 25, 2017 at 2:35
• For some reason this is still a little confusing for me. Did you use 4k because the series repeats on the 4th multipel? Nov 25, 2017 at 3:07
• Yes, it repeats, as you can see for number fifth, sixth, ... Nov 25, 2017 at 3:08
• This might sound stupid. But I just want to affirm(sorry). So what's the reason for including $k=0,1,2,3..$, is it just to say that for every positive integer $k$ it will return the same value? Nov 25, 2017 at 3:15

In one formula it is $$f^{(k)}(x)=a^k\cos\left(ax+k\frac\pi2\right)$$ using the symmetries of sine and cosine $\sin(x+\frac\pi2)=\cos(x)$ and $\cos(x+\frac\pi2)=-\sin(x)$.

We can get the obvious parts down and slowly work our way to the general derivative. Obviously$$f^{(n)}(x)=a^n\times\text{something}$$Where $f(x)=\cos ax$. To find what the 'something' is, we employ an old rule that\begin{align*} & \sin\left(x+\tfrac 12\pi\right)=\cos x\\ & \cos\left(x+\tfrac 12\pi\right)=\sin x\end{align*}Since $f(x)$ without a derivative is $\cos ax$, so we will be using the latter formula. And based off the rest of the observations, we can guess that$$f^{(n)}(x)=a^n\cos\left(ax+\tfrac 12 n\pi\right)$$For integral $n$.

Let's use induction to prove it. The first few steps (substituting $n=0$) will be left as an exercise for the OP, but the essential part is using$$f^{(n+1)}(x)=\left[f^{(n)}(x)\right]'$$Hence\begin{align*}f^{(n+1)}(x) & =\left[f^{(n)}(x)\right]'\\ & =-a^{n+1}\sin\left(ax+\tfrac 12n\pi\right)\\ & =a^{n+1}\cos\left(ax+\tfrac 12n\pi+\tfrac \pi2\right)\end{align*} Where the last line follows from$$\cos\left(\theta+\frac {\pi}2\right)=-\sin\theta$$and $\theta$ is the expression inside the cosine function.