Solution (source code)

= Solution

Let
$$
\Sigma=\{u\in H^1(\mathbb R^2):|x|u\in L^2(\mathbb R^2)\}
$$
be the <harmonic-oscillator energy space>, and denote the minimized quadratic functional by $J(u)$. A minimizing sequence $(u_n)\subset\mathcal A(M)$ is bounded in $\Sigma$, because $J$ is its squared Hilbert norm with positive coefficients. After taking a subsequence, $u_n\rightharpoonup u$ weakly in $\Sigma$.

The embedding $\Sigma\hookrightarrow L^4(\mathbb R^2)$ is compact. On any fixed ball this follows from the <Rellich-Kondrachov compactness theorem>. Outside a large ball, the moment bound makes the $L^2$ tail uniformly small, and interpolation with the uniform $H^1\hookrightarrow L^q$ bounds for some $q>4$ makes the $L^4$ tail uniformly small. Hence $u_n\to u$ strongly in $L^4$.

The constraint passes to the limit, so $\int|u|^4=M$. Weak lower semicontinuity gives $J(u)\leq\liminf J(u_n)=I(M)$. Therefore $u$ attains the infimum. This is <Fixed-L4 minimization in the harmonic-oscillator energy space>.