TITLE: Optimal Poincare constant (with constraints)
QUESTION [5 upvotes]: Given any integrable function $f\, \colon \mathbb{R}_+ \to \mathbb R$, it is relative easy to show that the best constant for which the following Poincar'e-type inequality $$ \int_{\mathbb{R}_+} f^2\,\mathrm{e}^x\,\mathrm{d}x \leq C\,\int_{\mathbb{R}_+} |f'|^2\,\mathrm{e}^x\,\mathrm{d}x \tag{1}$$ holds is $C = 4$. Indeed, we can prove $(1)$ by writing $f(x) = -\int_{x}^\infty f'(y)\,\mathrm{d} y$ and apply Cauchy-Schwarz several times. The optimality of the constant $4$ can be seen by taking $f(x) = \mathrm{e}^{-\lambda\,x}$ for $\lambda > 1/2$ and then sending $\lambda \to 1/2$. However, suppose we have further constraints on $f$ prescribed by $$ \int_{\mathbb{R}_+} f(x)\,\mathrm{d}x = 0,\quad\text{and}\quad \int_{\mathbb{R}_+} x\,f(x)\,\mathrm{d}x = 0. \tag{2} $$ How can we "sharpen" (or refine) the Poincare constant with the help of these additional restrictions? Clearly, the argument without $(2)$ relies purely on the fundamental theorem of calculus and the basic Cauchy-Schwarz inequality, I am stuck at the possibility of incorporating $(2)$ into the argument in order to refine the constant $C$ appearing in $(1)$. Thank you very much for your help!

REPLY [3 votes]: Hint.
We can handle this with Calculus of Variations. Defining
$$
L(f,f',x) = \left(f^2-C(f')^2\right)e^x
$$
and solving
$$
\max J(f,C)= \max\int_{\mathbb{R}^+}\left(L(f,f',x) + \lambda_1f + \lambda_2xf\right) dx
$$
with $\lambda_1,\lambda_2$ Lagrange multipliers.
NOTE
Let us consider the simpler problem
$$
\max J(f,C)= \max\int_{\mathbb{R}^+}\left(f^2-C(f')^2\right)e^x dx
$$
The Euler-Lagrange equation gives the stationary condition
$$
Cf''+Cf'+f=0
$$
with solution
$$
f = c_1 e^{-\frac{1}{2} \left(1+\frac{\sqrt{C-4}}{\sqrt{C}}\right) x}+c_2 e^{\frac{1}{2} \left(\frac{\sqrt{C-4}}{\sqrt{C}}-1\right) x}
$$
As $f$ should be integrable on $\mathbb{R}^+$ , $c_2=0$ so we follow with
$$
f =  c_1 e^{-\frac{1}{2} \left(1+\frac{\sqrt{C-4}}{\sqrt{C}}\right) x}
$$
and now substituting this function on $J(f,C)$ we get
$$
J(f,C)=\frac{\left(4-C-\sqrt{C-4} \sqrt{C}\right) c_1{}^2}{2 \sqrt{\frac{C-4}{C}}}=-\frac{1}{2} \left(\sqrt{C}\sqrt{C-4}+C \right)c_1^2
$$
and $\max J(f,C)=\lim_{C\to 4}J(f,C) = -2c_1^2\le 0$.
NOTE
Regarding the full problem, as the stationary condition gives the function
$$
f = c_1 e^{-\frac{1}{2} \left(\sqrt{\frac{C-4}{C}}+1\right) x}-\frac{1}{2} e^{-x} (\lambda_2 (C+x)+\lambda_1)
$$
the restrictions gives us
$$
\int_{\mathbb{R}^+} f dx = \frac{1}{2} \left(c_1C -\sqrt{C-4} \sqrt{C} c_1-(C+1) \lambda_2-\lambda_1\right)=0
$$
and
$$
\int_{\mathbb{R}^+} x f dx = \frac{4 c_1}{\left(\sqrt{\frac{C-4}{C}}+1\right)^2}-\frac{1}{2} (C+2) \lambda_2-\frac{\lambda_1}{2}=0
$$
Solving for $\lambda_1,\lambda_2$ we get
$$
\cases{
\lambda_1 = \frac{4 \sqrt{C} \left(-C^{3/2}+\sqrt{C-4} C+2 \sqrt{C-4}\right) c_1}{\left(\sqrt{C-4}+\sqrt{C}\right)^2}\\
\lambda_2 = -\frac{4 \left(\sqrt{\frac{C-4}{C}}-1\right)
   c_1}{\left(\sqrt{\frac{C-4}{C}}+1\right)^2}
}
$$
and after substitution into $J(f,C,\lambda_1,\lambda_2)$ it gives
$$
J(f,C,\lambda_1,\lambda_2) = -\frac{128 \left(\sqrt{C-4}+5 \sqrt{C}\right) \sqrt{C} c_1{}^2}{\left(\sqrt{C-4}+\sqrt{C}\right)^8}
$$
Here $J(f,C,\lambda_1,\lambda_2) \le 0 $ and its maximum occours as $C\rightarrow \infty$. Also as $C\rightarrow \infty$ we have $\lambda_1\rightarrow 0$ and $\lambda_2\rightarrow 0$ so the conclusion is that the problem has not solution as formulated. Does not exists such $C$.