How to solve the $\min_x \int_c^d (u-x)^4 e^{-u^2/2} du$ How to solve the following equation 
 \begin{align}
\min_x  \int_c^d (u-x)^4 e^{-u^2/2} du
\end{align}
Observer, that by taking the derivative we get
\begin{align}
 \int_c^d -4(u-x)^3 e^{-u^2/2} du
\end{align} 
So,  if $c=-d$ then the solution is given by 
\begin{align}
x=0
\end{align}
However, what if $d$ and $c$ are any numbers? 
 A: Hint: Denote $p(x)=\int\limits_{c}^{d}{(u-x)^4e^{-u^2/2}du}$
Now expand $(u-x)^4$ and split the integral in several integrals, where $x$ goes out of the integrals as it does not depend on the integration variable $u$. Now you should see that $p(x)$ is a polynomial of degree $4$ in $x$ with coefficients that you will find by computing all integrals. Finally, when you have the polynomial $p(x)$ you compute its global minimum in a standard way, for example by setting $p'(x)=0$ and using the necessary conditions for a local minimum.
A: Just as Svetoslav answered, you first need to expand $$(u-x)^4=u^4-4 u^3 x+6 u^2 x^2-4 u x^3+x^4$$ and your are first left with the antiderivatives $$I_k=\int u^k  e^{-\frac{u^2}{2}} \,du \qquad (k=0,1,2,3,4)$$ The calculations do not present major difficulties (integrations by parts) $$I_0=\sqrt{\frac{\pi }{2}} \text{erf}\left(\frac{u}{\sqrt{2}}\right)$$ $$I_1=-e^{-\frac{u^2}{2}}$$ $$I_2=\sqrt{\frac{\pi }{2}} \text{erf}\left(\frac{u}{\sqrt{2}}\right)-e^{-\frac{u^2}{2}} u$$ $$I_3=-e^{-\frac{u^2}{2}} \left(u^2+2\right)$$ $$I_4=3 \sqrt{\frac{\pi }{2}} \text{erf}\left(\frac{u}{\sqrt{2}}\right)-e^{-\frac{u^2}{2}}
   \left(u^3+3 u\right)$$ Combining all of that $$J=\int (u-x)^4\,e^{-\frac{u^2}{2}} \,du$$ $$J= \sqrt{\frac{\pi }{2}} \left(x^4+6 x^2+3\right)
   \text{erf}\left(\frac{u}{\sqrt{2}}\right)+e^{-\frac{u^2}{2}} \left(4
   \left(u^2+2\right) x-u \left(u^2+3\right)-6 u x^2+4 x^3\right)$$. Now, use the given  bounds, group terms to end with to a fourth degree polynomial in $x$ (say $Ax^4+B x^3 +Cx^2+Dx+E$) that you have to work.
For testing purposes (repeat it), using $c=1$, $d=2$, you should arrive to a minimum for $x\approx 1.42692$ to which corresponds a minimum value of the integral $\approx 0.00363214$.
The other solution  to find the value of $x$ corresponding to the minimum is to write (just as you wrote it) $$\frac {dJ}{dx}=-4\int (u-x)^3\,e^{-\frac{u^2}{2}} \,du$$ which uses the same integrals as before.
