I'm looking for the general formula of the integral of (x^n*e^x)dx
I know how the general formula begins and it looks something like this:
x^n - nx^(n-1) + n(n-1)x^(n-2) - n(n-1)(n-2)x^(n-3)...
I'm having trouble figuring out what comes at the end. The last number in the answer will always be n! and the second to last will always be n!x.
The signs are changing so, for example, when it is the integral of x^4*e^x the answer is (x^4-4x^3+12x^2-24x+24)e^x and if is the integral of x^3*e^x the answer is (x^3-3x^2+6x-6)e^x. As you can see for x^4*e^x then the second to last term is -24x and the last is +24 but for x^3*e^x the second to last term is +6x and the last term is -6
My point is, the signs, depending upon if n is even or odd, will always change and I'm not sure how to reflect that in the general formula.