Determine a positive integer $n\leq5$,such that $\int_{0}^{1}e^x(x-1)^ndx=16-6e$ Determine  a positive integer $n\leq5$,such that $\int_{0}^{1}e^x(x-1)^ndx=16-6e$.
I tried to solve it.But since $n$ is given to be $\leq$ 5,my calculations went lengthy.
Applying integration by parts repeatedly,we get
\begin{align}
\int e^x(x-1)^n \, dx &= \left[(x-1)^ne^x-n(x-1)^{n-1}e^x+n(n-1)(x-1)^{n-2}e^x \right. \\
& \hspace{5mm} \left.-n(n-1)(n-2)(x-1)^{n-3}e^x+n(n-1)(n-2)(n-3)(x-1)^{n-4}e^x \right. \\
& \hspace{5mm} \left.-n(n-1)(n-2)(n-3)(n-4)e^x\right]
\end{align}
\begin{align}
\int_{0}^{1}e^x(x-1)^n \, dx &= -n(n-1)(n-2)(n-3)(n-4)e-(-1)^n+n(-1)^{n-1}-n(n-1)(-1)^{n-2} \\ 
& \hspace{5mm} +n(n-1)(n-2)(-1)^{n-3}-n(n-1)(n-2)(n-3)(-1)^{n-4} \\
& \hspace{5mm} +n(n-1)(n-2)(n-3)(n-4) \\
&=16-6e
\end{align}
Now solving this is very difficult,is there another simple and elegant method to find $n=3.$
 A: HINT:
Let $x-1=y$
$$\int_0^1e^x(x-1)^n\ dx=\int_{-1}^0e^{y+1}y^n\ dy=e\int_{-1}^0e^yy^n\ dy$$
Now integrating by parts, $$I_n=\int_{-1}^0e^yy^n\ dy=[y^n\int e^y\ dy]_{-1}^0-\int_{-1}^0\left(\dfrac{d(y^n)}{dy}\int e^y\ dy\right)dy$$
$\implies I_n=-(-1)^n\dfrac1e-nI_{n-1}$
Now $I_0=\int_{-1}^0e^y\ dy=1-\dfrac1e$
$\implies I_1=\dfrac1e-I_0$  and so on
A: HINT:
Notice, the following property of definite integral 
$$\int_{a}^{b}f(x)dx=\int_{a}^{b}f(a+b-x)dx$$
Now, we have
$$\int_{0}^{1}e^x(x-1)^ndx=16-6e$$
$$\int_{0}^{1}e^{1-x}(1-x-1)^ndx=16-6e$$
$$\int_{0}^{1}e^{1-x}(-x)^ndx=16-6e$$
$$\int_{0}^{1}e \cdot e^{-x}(-1)^nx^n dx=16-6e$$
$$(-1)^n e\int_{0}^{1} e^{-x}x^n dx=16-6e$$
I hope you can proceed further.
A: If we set
$$ I_n = \int_{0}^{1}e^x(1-x)^n\,dx = \int_{0}^{1}x^n e^{1-x}\,dx\tag{1}$$
integration by parts gives:
$$ I_{n+1} = -1 + (n+1)\, I_n\tag{2}$$
Since $I_0 = -1+e$, by using the previous formula and induction we have:
$$ \forall n\in\mathbb{N},\qquad I_n = A_n + B_n e,\quad A_n,B_n\in\mathbb{Z}\tag{3}$$
as well as
$$ B_n = n! \tag{4} $$
so the solution to the original problem is clearly $n=\color{red}{3}$.
A: I would define
$$a_n:=\int_0^1 e^x (x-1)^n dx.$$
Then we simply get $a_0=e-1$ and for $n>0$ using integrations by parts we get
$$a_n = [e^x(x-1)^n]_0^1 - n\int_0^1 e^x (x-1)^{n-1}dx = (-1)^{n+1}-n a_{n-1}.$$
With that recursive formula you compute $a_1$, $a_2$ and $a_3$ very quickly and get your result $a_3=16-6e$.
A: If you have reason to believe the equation is satisfied by a positive integer $n\le5$, we can rule out the even integers $n=2$ and $4$ since $16-6e\approx-0.30969$ is negative.  For odd integers, a change of variable leaves the equation
$$I_n=\int_0^1 x^ne^{-x}dx=6-{16\over e}\approx0.1139$$
Now
$$1-x\le e^{-x}\le1-x+{1\over2}x^2\quad\text{for }0\le x\le1$$
which means
$$I_1\ge\int_0^1(x-x^2)dx={1\over2}-{1\over3}={1\over6}=0.1666\ldots$$
is too big, and
$$I_5\le\int_0^1(x^5-x^6+{1\over2}x^7)dx={1\over6}-{1\over7}+{1\over16}\approx0.0863$$
is too small.  So by the Goldilocks Principle, $n=3$ must be just right.
