Why is there this recurring pattern in the derivative of $x\cdot e^{-k\cdot x}$? I was doing an exercise for which I needed to take the derivative(s) of the function
$$f_k(x)=x\cdot e^{-k\cdot x}$$
Doing this a few times, I noticed some sort of recurring pattern. I concluded that one can write the $n$-th  derivative of the function as
$$\frac{\partial^n}{\partial x^n}f_k(x)=k^{n-1}\cdot e^{-kx}((-1)^nkx-(-1)^n\cdot n)$$
or perhaps, to improve readability
$$\frac{\partial^n}{\partial x^n}f_k(x)=k^{n-1}\cdot e^{-kx}(-kx+n)$$
for odd $n$ and
$$\frac{\partial^n}{\partial x^n}f_k(x)=k^{n-1}\cdot e^{-kx}(kx-n)$$
for even $n$.
While I know how to compute each derivative, I do not understand why the derivative follows this pattern-like structure. Is there any intuitive idea behind this?
Clarification: By "intuitive", I mean anything that does not purely rely on blindly computing each integral. A very beautiful way to represent derivatives visually is shown in this 3blue1brown video; I don't know if anything like this is possible to explain the above described pattern. Basically, I am looking for something which actually explains why there is a pattern instead of just noticing it.

Note: This is not the actual homework assignment, it just came up when doing it.

Following the hint of @HansLundmark is quite convenient.

The general Leibniz rule gives us
\begin{align*}
\color{blue}{\frac{\partial^n}{\partial x^n}}\color{blue}{\left(x e^{-k\cdot x}\right)}
&=\sum_{j=0}^n\binom{n}{j}\left(\frac{\partial^j}{\partial x^j} x\right)\left(\frac{\partial^{n-j}}{\partial x^{n-j}} e^{-k x}\right)\tag{1}\\
&=\binom{n}{0}x\left(\frac{\partial^{n}}{\partial x^{n}}e^{-k x}\right)+\binom{n}{1}\left(\frac{\partial^{n-1}}{\partial x^{n-1}}e^{-k x}\right)\tag{2}\\
&=x\left(-k\right)^ne^{-k x}+n\left(-k\right)^{n-1}e^{-k x}\\
&\,\,\color{blue}{=(-1)^nk^{n-1}e^{-kx}\left(kx-n\right)}
\end{align*}
Here we do not have to look for a common pattern, since the Leibniz rule gives us the wanted expression right at hand.

Comment:

*

*In (1) we get by the general Leibniz rule more or less the final expression without the need to calculate derivatives iteratively.


*In (2) we use the nice fact that $\left(\frac{\partial^j}{\partial x^j} x\right)=0$ if $j>1$ so that only two summands give a contribution.
