12th order derivative using Leibniz I don't fully understand the rule of Leibniz and I'm trying to find the 12th order derivative of: $x\cos  \left(x\right)$
How do I find this using the Leibniz rule?
 A: The answer in summation notation is
$$\sum_{k=0}^{12}{\binom{12}{k}\frac{d^k}{dx^k}x\frac{d^{n-k}}{dx^{n-k}}{\cos{x}}}$$
This looks formidable, but most of the terms are 0. If we write it out we get
$$x\frac{d^{12}}{dx^{12}}\cos x+12\frac{d^{11}}{dx^{11}}\cos x$$
or
$$x\cos{x}+12\sin{x}$$
This is because derivatives of $x$ beyond the first are 0. To explain the trigonometric terms, note that the cosine function is its own fourth derivative.
A: The Leibniz rule says that
$$(fg)'=f'g + fg'$$
So, in your case, we have $f(x)=\cos(x)$ and $g(x)=x$. I assume you have the identities handy that $f'(x)=-\sin(x)$ and $g'(x)=1$. So, plugging this into the above gives the first derivative as
$$-x\sin(x)+\cos(x)$$
What we should notice is that, the next time we differentiate, we have $-x\sin(x)$ being the product of two terms - but the derivative of $-x$ is $-1$ and the derivative of $\sin(x)$ is $\cos(x)$, which, plugging that into Leibniz rule yields the derivative of $-x\sin(x)$ to be
$$-x\cos(x)-\sin(x)$$
and, adding that to the derivative of $\cos(x)$ to get the second derivative of your function yields:
$$-x\cos(x)-2\sin(x).$$
You can proceed thusly, since now we have another $x\cos(x)$ term. You will probably notice a pattern as you compute the 12 derivatives, but it's not prohibitively difficult to do by hand.
A: For brevity, let's write $c:=\cos x$ and $s:=\sin x$, and write the $n$th derivative of $y_0:=xc$ with respect to $x$ as $y_n$ ($n=1,2,...$). It's pretty easy to spot the pattern of the even-numbered derivatives as $$y_{2n}=(-1)^n(xc+2ns)\;\;(n=0,1,...),$$ and this can be proved straightforwardly by induction.
A: By observation I found 
$$\frac{d^n}{dx^n}x\cos x =
\begin{cases}
(-1)^{n/2}n \sin x + (-1)^{n/2}x\cos x,  & \text{if $n$ is even} \\
(-1)^{(n-1)/2}n \cos x + (-1)^{(n+1)/2}x\sin x, & \text{if $n$ is odd}
\end{cases}$$
which could be proved by induction and product rule. Plugging in we get
$$\frac{d^{12}}{dx^{12}}x\cos x = 12\sin x + x\cos x$$
