Write down explicitly the expression for the $ n$-th derivative of the function $f(x)=x^2e^{3x}$. Write down explicitly the expression for the $ n$-th derivative of the function $f(x)=x^2e^{3x}$.
I tried to differentiate $f$ and substitute the value of $f,f',f''$ wherever necessary.
However it is giving me a complicated recurrence relation.
$$ f(x)=x^2e^{3x}$$
$$f'(x)=2xe^{3x}+3x^2e^{3x}$$
$$f'(x)=2xe^{3x}+3f(x)$$
$$f''(x)=2(e^{3x}+3xe^{3x})+3f'(x)$$
$$f'''(x)=2(3e^{3x}+9xe^{3x}+3e^{3x})+3f''(x)$$
$$f'''(x)=12e^{3x}+9(f''(x)-3f'(x))+3f''(x)
$$
The expression for $f'''(x)$ gives simplifies the expression for $f^n(x)$
that is
$$f^n(x)=3^{n-2}4e^{3x}+9(^{n-2}(x)-3f^{n-3}(x))+3f^{n-1}(x)$$
With initial conditions being the value of $f',f'',f'''$
But I still feel to get some easier solution.
 A: \begin{align}(x^2e^{3x})^{(n)}&=\sum_{k=0}^n\binom nk(x^2)^{(k)}(e^{3x})^{(n-k)}
\\&=\binom n0x^2\,3^ne^{3x}+\binom n12x\,3^{n-1}e^{3x}+\binom n22\,3^{n-2}e^{3x}
\\&=(9x^2+6nx+n(n-1))3^{n-2}e^{3x}.\end{align}
A: For any differentiable function $h$, $\frac{d}{dx}(e^{3x}h(x))=e^{3x}(h'(x)+3h(x))$. We can express this as
$$\frac{d}{dx}(e^{3x}h(x))=e^{3x}\left(\frac{d}{dx}+3\right)h(x)$$
Iterating this $n$ times gives
$$\frac{d^n}{dx^n}(h(x)e^{3x})=e^{3x}\left(\frac{d}{dx}+3\right)^nh(x)$$
Expanding $\left(\frac{d}{dx}+3\right)^n$ in the usual way gives
$$\left(\frac{d}{dx}+3\right)^n=\frac{d^n}{dx^n}+3n\frac{d^{n-1}}{dx^{n-1}}+\cdots+\frac{n(n-1)}{2}3^{n-2}\frac{d^2}{dx^2}+n3^{n-1}\frac{d}{dx}+3^n$$
(this is valid because $\frac{d}{dx}$ commutes with multiplication by the constant $3$).
Now when we put $h(x)=x^2$, all but the last three terms disappear, and we get
$$\frac{d^n}{dx^n}(e^{3x}x^2)=n(n-1)\cdot 3^{n-2}+2n\cdot 3^{n-1}x+3^nx^2$$
A: As $(P(x)e^{3x})'=(P'(x)+3P(x))e^{3x}=Q(x)e^{3x}$, the degree of the polynomial factor doesn't increase, you can be sure that the $n^{th}$ derivative will be of the form
$$(a_nx^2+b_nx+c_n)e^{3x}.$$
Then
$$(a_{n+1}x^2+b_{n+1}x+c_{n+1})e^{3x}=(2a_nx+b_n+3a_nx^2+3b_nx+3c_n)e^{3x}$$ gives us the recurrence formulas
$$\begin{align}a_{n+1}-3a_n&=0,\\b_{n+1}-3b_n&=2a_n,\\c_{n+1}-3c_n&=b_n.\end{align}$$
The first is easy, $a_n=3^n$. The second a little less, as the root of the characteristic equation is also the exponent in the RHS. Hence the solution is of the form
$$b_n=(pn+q)3^n.$$
From $b_0=0,b_1=2$, we draw $$b_n=2n3^n.$$
For the last recurrecence, we will have 
$$c_n=(rn^2+sn+t)3^n$$ and from $c_0=c_1=0,c_2=2$, 
$$c_n=\frac{n^2-n}93^n.$$
