I am trying to find the general integral of $$ \int x^n e^x$$
Note: n belongs to the set of whole numbers
After reading the answer by Yves Daoust here, I got inspired to try a new method of doing this integral. To motivate the idea, consider the function below:
$$ f(x) = x^n e^x$$
If I derivative this function,
$$ f'(x) = [ x^n + n x^{n-1} ] e^x$$
Even after taking derivative, the function is of form $P(x) e^x$ with the degree of polynomial preserved. I.e: polynomial in the first equation has the same degree as the polynomial attached to $e^x$ in the derivated equation.
So, thinking of this in reverse, if I integrate an expression of form $P(x) e^x$ , I will get $e^x$ multiplied by some polynomial of same degree.
Hence, the integral of $ \int x^n e^x dx$ can be written as $ P(x) e^x + C $ where $P(x)$ is some polynomial of degree $n$.
This means:
$$ ( P(x) e^x)' = x^n e^x$$
Or,
$$ P(x) + P'(x) = x^n$$
Assume $P(x)$ is some polynomial of form:
$$ P(x) = \sum_{i=0}^n a_i x^i$$
Then, our expression becomes:
$$ \sum_{i=0}^n a_i x^i + \sum_{i=0}^n ia_i x^{i-1} = x^n$$
Or,
$$a_n x^n+ \sum_{i=0}^{n-1} a_i x^i + (i+1) a_{i+1} x^i = x^n$$
Rewriting,
$$ a_n x^n + \sum_{i=0}^{n-1} x^i [ a_i + (i+1)a_{i+1} x^i ] = x^n$$
By comparing the coefficient of a polynomial on both sides:
$$ a_n = 1$$
And,
$$ a_i + (i+1) a_{i+1} = 0$$
Now, my question is how I can solve this recursion? and find expression for general term $a_i$ (without induction)?
Rewrite the recurrence as $$a_{i+1} = -\frac{a_i}{i+1}$$ for $0 \leq i \leq n-1$, with $a_n = 1$. Consider the product $$\prod_{i=j}^{n-1}a_{i+1}=(-1)^{n-j}\prod_{i=j}^{n-1}\frac{a_i}{i+1}=\frac{(-1)^{n-j}j!}{n!}\prod_{i=j}^{n-1}a_i$$ for $0\leq j\leq n-1$. Since none of the $a_i$ can be zero (since $a_n=1$), we can cancel out the $a_i$'s that appear on either side of the last equation. It follows that $$a_k = \frac{(-1)^{n-k}n!}{k!}, \:k\in\{0,1,2,\cdots,n\}$$ Does that answer your question?