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.
Introduce an auxiliary variable $\lambda$, and put $$f(x,\lambda):=xe^{\lambda x}={\partial\over\partial\lambda}\bigl(e^{\lambda x}\bigr)\ .$$ The exchangeability of partial derivatives then implies $${\partial^n\over\partial x^n}f(x,\lambda)={\partial\over\partial\lambda}{\partial^n\over\partial x^n}\bigl(e^{\lambda x}\bigr)={\partial\over\partial\lambda}\bigl(\lambda^n e^{\lambda x}\bigr)=\lambda^{n-1}(n+\lambda x)e^{\lambda x}\ .$$ When $\lambda:=-k$ we have your formulas.