The density function: $$ g(x) = \begin{cases} x & \text{if } 0 < x \leq 1\\ x^{-3} & \text{if } x>1\\ 0 & \text{otherwise} \\ \end{cases} $$ Has finite mean ($4/3$) and infinite variance - the integral diverges logarithmically: one ends with a tail for $E(X^2)$ which involves $\int_1^\infty \frac 1 x \, dx$. I am trying to solve the problem where I should comment on the figure involving the density function and simulated values from it and the relation to the calculation of $E(X^2)$. It looks like this in R: Histogram and density function
I have no clue how the infinite variance is reflected in the figure...Any help would be appreciated...