I got to the following explicit formula for $\int_{}x^ne^xdx$:
$$\int_{}x^ne^xdx = e^x\sum_{k=0}^{n}(-1)^kP(n,k)x^{n-k} + c$$
where n ∈ N, x ∈ R, $P(n,k) = \frac{n!}{(n-k)!}$
Now, the solution looks like the Binomial Theorem with $y = -1$:
$$e^x\sum_{k=0}^{n}(-1)^k\binom{n}{k}x^{n-k} = e^x(x-1)^n$$
However, instead of the combination, we have a permutation, so I am wondering if there's a simplification like there would be if it were a combination instead.
i.e. A simplification of the explicit formula of $\int_{}x^ne^xdx$ without the use of a summation.
On WolframAlpha, after inputting $\int_{}x^ne^xdx$, the following is returned:
$$\int{x^ne^x}dx = (-x)^{-n}x^n\Gamma(n+1,-x) +c$$
I suppose I should provide a derivation of the formula:
$$\int{x^ne^xdx} = e^x\sum_{k=0}^{n}(-1)^kP(n,k)x^{n-k} + c$$
Clearly, this is an integration by parts problem by the following reduction formula:
$$\int{x^ne^x}dx = x^ne^x -n\int{x^{n-1}e^xdx}$$
$n=1$:
$\int{x^1e^xdx} = xe^x - e^x + c= e^x(x-1) + c$
$n=2$:
$\int{x^2e^xdx} = x^2e^x - 2xe^x + 2e^x + c= e^x(x^2-2x+2) + c$
$n=3$:
$\int{x^3e^xdx} = x^3e^x - 3x^2e^x + 6xe^x - 6e^x + c= e^x(x^3-3x^2+6x-6)+c$
$n=4$:
$\int{x^3e^xdx} = ... = e^x(x^4-4x^3+12x^2-24x+24)+c$
$n=5$:
$\int{x^3e^xdx} = ... = e^x(x^5-5x^4+20x^3-60x^2+120x-120)+c$
$$...$$
Looking at the polynomial factors:
Now, collecting all the first terms, namely the $x^n$ coefficients, we get
$1,1,1,1,1,...,1 = \binom{0}{0}$
Collecting all the second terms, namely the $x^{n-1}$ coefficients, we get
$1,2,3,4,5,...,n = $
Collecting all the third terms, namely the $x^{n-2}$ coefficients, we get
$2,6,12,20,...$ dividing this sequence by 2, we get
$1,3,6,10,...$ [TRIANGULAR NUMBERS]
(since we divided by 2, we need to multiply the triangular numbers by 2 = $2!$)
Collecting all the fourth terms, namely the $x^{n-3}$ coefficients, we get
$6,24,60,120,...$
dividing this sequence by 6, we get
$1,4,10,20,...$ [TETRAHEDRAL NUMBERS]
(since we divided by 6, we need to multiply the tetrahedral numbers by 6 = $3!$)
Collecting all the fifth terms, namely the $x^{n-4}$ coefficients, we get
$24,120,360,840,...$
dividing this sequence by 24, we get
$1,5,15,35,...$ [PENTALOPE NUMBERS]
(since we divided by 24, we need to multiply the tetrahedral numbers by 24 = $4!$)
I hope the pattern is evident by now...
Let me illustrate it for $n=5$:
$$\int{x^5e^xdx} = e^x(\binom{0}{0}x^5-\binom{5}{1}x^4+2!\binom{5}{2}-3!\binom{5}{3}+4!\binom{5}{4}-5!\binom{5}{5}) + c$$ $$\int{x^5e^xdx}=e^x(x^5-5x^4+20x^3-60x^2+120x-120)+c$$
Following that, the formula becomes:
$$\int{x^5e^xdx} = e^x\sum_{k=0}^{5}(-1)^{k}k!\binom{5}{k}x^{5-k}$$ $$\int{x^5e^xdx} = e^x\sum_{k=0}^{5}(-1)^{k}k!\frac{5!}{(5-k)!k!}x^{5-k}$$ $k!$ is thus cancelled out of the equation with the $k!$ in the combination denominator $$\int{x^5e^xdx} = e^x\sum_{k=0}^{5}(-1)^{k}\frac{5!}{(5-k)!}x^{5-k}$$ Finally, using $\frac{5!}{(5-k)!} = P(5,k)$, we get the final result:
$$\int{x^5e^xdx} = e^x\sum_{k=0}^{5}(-1)^{k}P(5,k)x^{5-k}$$
Extended to a general $n$:
$$\int_{}x^ne^xdx = e^x\sum_{k=0}^{n}(-1)^kP(n,k)x^{n-k} + c$$
where n ∈ N, x ∈ R, $P(n,k) = \frac{n!}{(n-k)!}$
End of derivation.
TL;DR
I have the following expression: $$e^x\sum_{k=0}^{n}(-1)^kP(n,k)x^{n-k}$$
where n ∈ N, x ∈ R, $P(n,k) = \frac{n!}{(n-k)!}$
and I want to know if there is a way to simplify the expression in a way similar to the binomial theorem (i.e. without the use of a sum):
$$e^x\sum_{k=0}^{n}(-1)^k\binom{n}{k}x^{n-k} = e^x(x-1)^n$$
In (1) we changed the order of summation by $k\to n-k$.