# General Formula of the $n$th Derivative for $f(x) = xe^{2x}$

Find the general formula for the nth derivative of $f(x)=xe^2x$ in the form: $$f^{(n)}=A(n)e^{2x}+B(n)xe^{2x}$$

I've evaluated the first five derivatives in that for and for $A(n)$ have found coefficients $1,4,12, 32, 80,$ for $B(n)$ I have found $2,4,8,16,32$. I just can't seem to find a connection between these numbers. In previous examples I've done it's usually been a variety of the factorial function, but I just can't seem to find a formula to fit either sequence. Again, I know $B(n)$ is doubling each time, but I still can't think of a way to express this as a formula.

How about $$A(n) = n2^{n-1}$$ and $$B(n) = 2^n.$$ These reproduce your sequences. To prove that they work for general $n$ though, you would have to use mathematical induction.
Suppose we have $$f^{(n)}(x) = A(n)e^{2x} + B(n)xe^{2x}$$ Taking the derivative again, we get $$f^{(n+1)}(x) = 2A(n)e^{2x} + B(n)\bigl(e^{2x} + 2xe^{2x}\bigr) = \bigl(2A(n) + B(n)\bigr)e^{2x} + 2B(n)xe^{2x}$$ That is $$A(n+1) = 2A(n) + B(n), \quad B(n+1) = 2B(n)$$ moreover we have $A(0) = 0$, $B(0) = 1$. From this we can already conclude that $B(n) = 2^n$, leaving us with $$A(n+1) = 2A(n) + 2^n, \quad A(0) = 1$$ or \begin{align*} A(n) &= 2A(n-1) + 2^{n-1}\\ &= 4A(n-2) + 2\cdot 2^{n-2} + 2^{n-1}\\ &= 4A(n-2) + 2 \cdot 2^{n-1}\\ &= \cdots \\ &= 2^nA(0) + n \cdot 2^{n-1}\\ &= n2^{n-1}. \end{align*}
$f(x) = xe^{2x}$. So, $f'(x) = e^{2x} + 2xe^{2x} = e^{2x} + 2 f(x)$. So, $$f''(x) = (e^{2x})' + 2 f'(x) = 2 e^{2x} + 2( e^{2x} + 2xe^{2x} )$$ In general, we see that $$f^{(n)}(x) = \frac{d^{n-1}}{dx^{n-1}} (e^{2x}) + 2 f^{(n-1)} (x) = 2^{n-1} e^{2x} + 2 f^{(n-1)} (x).$$ But, we have then that $$f^{(n)}(x) = 2^{n-1} e^{2x} + 2 ( 2^{n-2} e^{2x} + 2 f^{(n-2)} (x) ) = 2^{n-1} e^{2x} + 2^{n-1} e^{2x} + 2^2 f^{(n-2)} (x) ,$$ or, iterating, $$f^{(n)}(x) = \underset{k \text{ of these}}{\underbrace{2^{n-1} e^{2x} + 2^{n-1} e^{2x} + \cdots + 2^{n-1} e^{2x} }} + 2^k f^{(n-k)} (x) = n 2^{n-1} e^{2x} + 2^n \underset{f(x)}{\underbrace{xe^{2x}}} .$$ Hopefully this indicates how you can obtain these formulas in general, through a kind of recursive/inductive approach.