Find $n$ such that $\int_0^1 e^x(x-1)^n \,dx = 16-6e$. 
Find the value of $n$ (where $n$ is a positive integer less than or equal to $5$) such that $$\int_0^1 e^x(x-1)^n \,dx = 16-6e.$$

I have tried this question by two methods.  


*

*Integration by parts 

*Using king property
Neither of these lead me anywhere conclusive.  The integral calculator has used a gamma function which is not in my high school syllabus.
 A: Let $I(n) = \int_{0}^{1} e^{x}(x-1)^n dx$. Integration by parts results in
$$I(n)=\int_{0}^{1} e^{x}(x-1)^n dx = (-1)^{n+1} -n \int_{0}^{1} e^x(x-1)^{n-1}  dx=(-1)^{n+1}-nI(n-1).$$
Now use the fact that $I(0)=e-1$ to get
$I(1)  = 1-I(0)=2-e$, $I(2)=-1-2I(1)=-5+2e$, and $I(3)=1-3I(2) = 16-6e$.
A: $$I_n = \int_0^1 e^x(x-1)^n \,\text{d}x $$
For $n\geq 1$
$$ I_n = \int_0^1 e^x(x-1)^n \,\text{d}x = (-1)^{n+1} -n\int_0^1 e^x(x-1)^{n-1}\,\text{d}x = (-1)^{n+1}-nI_{n-1} $$
and $I_0 = e-1$. $I_n$ is of the form $a_ne+b_n$ where $a_n$ and $b_n$ are integers. We can easily see that $a_n=(-1)^nn!$ so that $n$ must equal $3$.
A: Characteristic function approach:
\begin{eqnarray}
\int_0^1 e^x e^{t(x-1)} dx &=& {1 \over 1+t} (e-e^{-t})
\end{eqnarray}
Differentiate with respect to $t$ $k$ times and set $t=0$.
Or eyeball the first few terms:
$(1-t+t^2-t^3+\cdots)(e - 1 +t -{1 \over 2!} t^2 +{1 \over 3!} t^3 -\cdots)$.
Since the multiplier of $e$ is $6 = 3!$, we can guess that $n=3$ and quickly verify correctness.
A: Here's a hint.  I think what may be bothering you is that you think you have to compute many integrals to do the problem, but there's an easier way.  Integrating by parts, $$\int{x^ne^x\mathrm{dx}}=x^ne^x-n\int{x^{n-1}e^x\mathrm{dx}},$$ and since we know $\int{e^x\mathrm{dx}}=e^x+C,$ we can deduce $\int{xe^x\mathrm{dx}}=xe^x-e^x+C,$ and so on.
A: $\begin{array}\\
I_n
&=\int_0^1 e^x(x-1)^ndx\\
&=\int_{-1}^0 e^{x+1}x^ndx\\
&=e\int_{-1}^0 e^{x}x^ndx\\
&=e\int_0^1 e^{-x}(-x)^ndx\\
&=e(-1)^n\int_0^1 e^{-x}x^ndx\\
&=e(-1)^n\left(-e^{-x}\sum_{k=0}^n x^k\dfrac{n!}{k!}\right)\big|_0^1
\qquad\text{(Incomplete Gamma function for integer parameter)}\\
&=e(-1)^{n+1}\left(e^{-x}\sum_{k=0}^n x^k\dfrac{n!}{k!}\right)\big|_0^1\\
&=e(-1)^{n+1}\left(e^{-1}\sum_{k=0}^n \dfrac{n!}{k!}-n!\right)\\
&=(-1)^{n+1}\left(\sum_{k=0}^n \dfrac{n!}{k!}-n!e\right)\\
&=(-1)^{n+1}\sum_{k=0}^n \dfrac{n!}{k!}+(-1)^nn!e\\
\end{array}
$
For your case,
$(-1)^nn!
=-6$
so $n=3$.
Note that
$\begin{array}\\
I_n
&=(-1)^{n+1}n!\sum_{k=0}^n \dfrac{1}{k!}+(-1)^nn!e\\
&=(-1)^{n+1}n!(e-\dfrac1{(n+1)!}+O(\dfrac1{(n+2)!}))+(-1)^nn!e\\
&=(-1)^{n+1}n!e-(-1)^{n+1}\dfrac1{n+1}+O((-1)^{n+1}\dfrac1{(n+1)(n+2)}))+(-1)^nn!e\\
&=(-1)^{n}\dfrac1{n+1}+O((-1)^{n+1}\dfrac1{(n+1)(n+2)})\\
\end{array}
$
