Optimizing over probability distributions For simplicity, let's consider the simple problem of maximizing the mean of a random variable $X$ with a density $u$ supported on $[0,1],$
$$
\max \int_0^1 xu(x)dx \\
\text{subject to } \int_0^1 u = 1, u\geq 0.
$$
Lagrange multiplier method does not work, because the problem with multiplier $\lambda$
$$
\int_0^1 (x-\lambda)u(x) dx + \lambda
$$
has a trivial Euler-Lagrange equation $x-\lambda =0,$ which makes sense, because  the optimal solution does not have a density function. It is the constant RV $X =1.$
How do I systematically treat this type of problem? It would be very helpful if anyone can provide a reference for the techniques used for optimization problems of this type.
 A: The maximum value is not attained. The supremum is $1$:
$\int_0^{1}xu(x)dx\leq \int_0^{1}u(x)dx=1$ so $1$ is an upper bound. Now let $\epsilon >0$ and $u(x)=\frac 1 {\epsilon}$ if $1-\epsilon <x<1$ and $0$ otherwise. Then $\int_0^{1}xu(x)dx\geq \frac 1 {\epsilon} \int_{1-\epsilon}^{1}xdx=\frac {2\epsilon-\epsilon ^{2}} {2\epsilon} \to 1$  as $\epsilon \to 0$.
Note that we cannot have $\int_0^{1}xu(x)dx =1$. This is because we would then have $\int_0^{1}(1-x)u(x)dx =0$ and you can use the non-negativity of the integrand to show that this cannot happen. [I am leaving the details to you].
A: You just need to center the weight of the distribution at 1.
Actuall this should be written as
\begin{equation}\textrm{sup} \int_{0}^{1}xu(x)dx=1 \end{equation}
because \begin{equation}\int_{0}^{1}xu(x)dx=1 \leq \int_{0}^{1}u(x)dx=1\end{equation}
use the following functions
\begin{equation}
u_n(x)=
\begin{cases}
2n^2(x-(1-\frac{1}{n})) && , 1-\frac{1}{n}\leq x \leq 1 \\
0 &&, otherwise
\end{cases}
\end{equation}
where $n \rightarrow \infty$.
