# Small question on uniformly distributed random variables

The question says the following: let $X$ be a random variable with uniform distribution on $[-1,1]$. Does $X^{-1}$ have a finite expectation?

I was just working it using the definition but I'm confused what to do about $\int_{-1}^{1}\frac{1}{x}dx$ that appears. Can anyone please help? Thanks.

-
Your integral is an example of what in your calculus course may have been called an improper integral. The function has a singularity at $1$ (it blows up as $x$ approaches $0$ from the right), so the integral may not exist. In this particular case, it doesn't exist. – André Nicolas Feb 23 '12 at 8:32
So, can you please provide more details? (b/c I don't understand why the expectation is not finite); $f(x) = \frac{1}{2}$ if $-1 \leq x \leq 1$ and $f(x)=0$ otherwise is the density function, so is anything wrong with $\mathbb{E}X^{-1}=\int_{-1}^{1}{\frac{1}{x}}$? Or simply from this expression, we get that the expectation is not defined? Thanks – Anna Feb 23 '12 at 21:59
You asked for detail. I have posted an answer, rather long, but I hope detailed enough. – André Nicolas Feb 23 '12 at 23:07

The density function of $X$ is equal to $\frac{1}{2}$ on the interval $[-1,1]$, and $0$ elsewhere.

The expectation of $X^{-1}$ is, by a standard formula, equal to $$\int_{-1}^1 \left(\frac{1}{x}\right)\left(\frac{1}{2}\right)dx,$$ if this integral exists.

Note that $\frac{1}{2x}$ "blows up" near $0$. For such functions, the usual definition of Riemann integral does not work. Our integral is an example of what's called an improper integral in English-language calculus courses.

For a badly behaved function like this one, we break up the interval of integration into two parts at the bad point, and look at the integral from $-1$ to $0$, and the integral from $0$ to $1$, separately. If both these integrals are fine, we say that the improper integral exists, or converges. If one or both of the integrals fails to exist, we say that the improper integral does not exist.

Now we examine the integral $$\int_0^1\frac{dx}{2x}. \qquad(\ast)$$ To determine whether or not this integral exists, we let $$I_h=\int_h^1 \frac{dx}{2x}.$$ If the limit of $I_h$, as $h$ approaches $0$ through positive values, exists, then we say that the improper integral $(\ast)$ exists (converges). If the limit does not exist, we say that the improper integral $(\ast)$ does not exist (diverges).

Finally, we can calculate! An antiderivative of $\frac{1}{2x}$ is $\frac{1}{2}\ln x$. It follows that $$I_h=\frac{1}{2}(\ln 1-\ln h)=-\frac{1}{2}\ln h.$$ Finally, let $h$ approach $0$ through positive values, so that the interval $[h,1]$ looks more and more like $[0,1]$. As $h$ approaches $0$, $\ln h$ becomes very large negative, and therefore the limit of $I_h$ as $h$ approaches $0$ from the right does not exist.

Much more informally, the area under the curve $y=\frac{1}{2x}$, from $x=0$ to $x=1$, is infinite.

-
Thanks a lot. I think I understood from the first post, but I was thinking maybe it's too simple :D – Anna Mar 4 '12 at 0:17

Can you calculate $\int_{1/n}^1 \frac{dx}{x}$? Now let $n \rightarrow \infty$.

-