Let $f: (-\infty,\infty)\to [0,\infty)$ be a smooth map. Then, how to solve the following optimizatin problem w.r.t. $f$?
\begin{align} \mathrm{minimize}_f&~~\int_{-\infty}^{\infty} |f(x) - \exp(-x^2)| dx\\ s.t.&~~\int_{-\infty}^{\infty} x^2 f(x) = 1 \end{align}
Thanks!
There is no solution. To see this, use the Lagrange multiplier's theorem infinite dimensional in the space of integrable functions to find critical points of $$ \int_{-\infty}^{\infty}\left\vert f(x)-e^{-x^{2}}\right\vert \,dx+\lambda \left( \int_{-\infty}^{\infty}x^{2}f(x)\,dx-1\right) . $$ Now the function $e^{-x^{2}}$ satisfies $\int_{-\infty}^{\infty}x^{2} e^{-x^{2}}dx=\frac{1}{2}\sqrt{\pi}$ so it is not a solution. Hence, the solution $f$ cannot always be equal to $f$. Consider the set $\left\{ x:\,f(x)>e^{-x^{2}}\right\} $. Since this set is open, we can write it as a union of intervals. Let $(a,b)$ be one of these intervals and let $g\in C_{c}((a,b))$. Then for $t>0$ small enough we have that $f(x)+tg(x)>e^{-x^{2} }$ in $(a,b)$. Consider the function$$ F(t)=\int_{a}^{b}(f(x)+tg(x)-e^{-x^{2}})\,dx+\lambda\left( \int_{a}^{b} x^{2}(f(x)+tg(x))\,dx-1\right) . $$ We must have $F^{\prime}(0)=0$, that is,$$ 0=\int_{a}^{b}g(x)\,dx+\lambda\int_{a}^{b}x^{2}g(x)\,dx=\int_{a}^{b}(1+\lambda x^{2})g(x)\,dx. $$ Since this is true for every $g$ it follows that $1+\lambda x^{2}=0$ for all $x\in(a,b)$, which is impossible.
I think that there should be a simpler way to prove this.
Edit To see why we can apply the Lagrange multiplier theorem in $(a,b)$, assume that $f$ is a solution of the original problem, with $\int_{-\infty}^{\infty}x^{2}f(x)\,dx=1$ and let $[a,b]$ be such that $f(x)-e^{-x^2}>$ in $[a,b]$ (so I am taking $(a,b)$ a bit smaller than above). Then $f(x)-e^{-x^2}\ge\delta/(b-a)>0$ in $[a,b]$ for some $\delta$. Let $m=\int_{a}^{b}x^2 f(x)\,dx$. Consider $g\in C_c((a,b))$ with $\Vert g\Vert_{C([a,b])}\le\delta$ and $\int_a^b x^2g(x)\,dx=0$. Extend $g$ to be zero outside $(a,b)$. Then the function $f+g$ satisfies the constraint $\int_{-\infty}^{\infty}x^{2}(f(x)+g(x))\,dx=1$ and so $$\int_{-\infty}^{\infty}\left\vert (f(x)+g(x))-e^{-x^{2}}\right\vert \,dx\ge \int_{-\infty}^{\infty}\left\vert f(x)-e^{-x^{2}}\right\vert \,dx,$$ which implies that $$\int_{a}^{b}\left((f(x)+g(x))-e^{-x^{2}}\right) \,dx\ge \int_{a}^{b}\left( f(x)-e^{-x^{2}}\right) \,dx.$$ This implies that $f$ is a constrained minimizer of the functional $$H(h):=\int_{a}^{b}\left(h(x)-e^{-x^{2}}\right) \,dx$$ over all $h$ in the open ball of $C_0((a,b))$ centered at $f$ and radius $\delta$, subject to the constraint $\int_{a}^{b}x^2 h(x)\,dx=m$. We can now apply the Lagrange multiplier theorem as above to get a contradiction.