# Does $\int_{\mathbb R}x^2f_X(x)dx=\int_{\mathbb R}x^2f_X(x)^2dx$ or are they comparable?

Let $$f_X$$ a density function, i.e. $$\mu(dx)=f_X(x)dx$$ is an absolute continuous measure w.r.t. Lebesgue measure. We have that $$\int_{\mathbb R}x\mu(dx)=\int_\mathbb R xf_X(x)dx.$$

Using Jensen inequality, $$\left(\int_{\mathbb R}xf_X(x)dx\right)^2\leq \int_{\mathbb R}x^2f_X(x)^2dx$$ and $$\left(\int_{\mathbb R}x\mu(dx)\right)^2\leq \int_{\mathbb R}x^2\mu(dx)=\int_{\mathbb R}x^2f_X(x)dx.$$

In somehow, we have the same integral, but not the same upperbound. Does $$\int_{\mathbb R}x^2f_X(x)dx=\int_{\mathbb R}x^2f_X(x)^2dx\ \ ?$$ Or at least, are they comparable ? ( like, does $$\int_{\mathbb R}x^2f_X(x)dx\leq\int_{\mathbb R}x^2f_X(x)^2dx\quad \text{or}\quad \int_{\mathbb R}x^2f_X(x)dx\geq\int_{\mathbb R}x^2f_X(x)^2dx$$ hold ? May be my question has no sense, but I'm quite surprise that we have 2 differents "optimal" upperbound for the same integral. (by optimal, I mean that in some case, we can have equality).

Let $$f_X(x)$$ be the density of $$Uni[0,2]$$, you get $$\quad \int_{\mathbb R}x^2f_X(x)dx\geq\int_{\mathbb R}x^2f_X(x)^2dx.$$ Let $$f_X(x)$$ be the density of $$Uni[0,1/2]$$, you get $$\quad \int_{\mathbb R}x^2f_X(x)dx\leq\int_{\mathbb R}x^2f_X(x)^2dx.$$ My understanding of the phenomenon stated in your problem: The definition of $$\mu$$ is related to the density $$f_X$$. In your first application of Jensen's inequality, the measure is Lebesgue measure, which is fixed when you change the density $$f_X$$; but in your second appliaction of Jensen's inequality, the measure $$\mu$$ is changable. And when we state the condition for equality, we alaways assume the measure of integration is fixed, and the integrand is changable. So, in your second application of Jensen's inequality, your statement about "optimal" may need more carefulness.