# Expectation defined as Riemann integral

I have a question related to the expectation of a continuous random variable and its Riemann integral definition. Consider a continuous real-valued random variable $X$ defined on the probability space $(\Omega, \mathcal{F}, \mathbb{P})$, $X:\Omega \rightarrow \mathbb{R}^k$. Let $\mathcal{X}\subseteq \mathbb{R}^k$ be the image of $X$, $P$ the $X$'s probability distribution, $f$ the $X$'s probability density function. My question is articulated into 2 subpoints.

(1) The expectation of $X$ is defined as

$$\mathbb{E}_{\mathbb{P}}(X):=\int_{\Omega} X(\omega) d\mathbb{P}$$ Provided that $\int_{\Omega} f(X(\omega)) d\mathbb{P}$ exists, this definition admits the possibility of having $\mathbb{E}_{\mathbb{P}}(X)$ equal to $\infty$ or $-\infty$, following from the definition of Lebesgue integral.

Alternatively, the expectation of $X$ is defined as $$\mathbb{E}_P(X):=\int_{-\infty}^{\infty} t f(t) dt=\int_{\mathcal{X}} t f(t) dt$$ where the second equality follows from $f(x)=0$ for $x \notin \mathcal{X}$. This second definition of expectation uses the Riemann integral.

By definition, the Riemann integral over a compact set, if it exists, is finite. Question: provided that $\int_{\mathcal{X}} t f(t) dt$ exists, the Riemann integral $\int_{\mathcal{X}} t f(t) dt$ can be $\infty$ or $-\infty$ only when $\mathcal{X}$ is not compact? In other words, provided that $\int_{\mathcal{X}} t f(t) dt$ exists, if $\mathcal{X}$ is a compact set then $\int_{\mathcal{X}} t f(t) dt$ is always finite? I'm confused on this point and any hint would be really appreciated.

(2) Now suppose we want to find the expectation of a function of $X$, $g(X)$. This expectation is defined as

$$\mathbb{E}_{\mathbb{P}}(g(X)):=\int_{\Omega} g(X(\omega)) d\mathbb{P}$$

or

$$\mathbb{E}_P(g(X)):=\int_{\mathcal{X}} g(t) f(t) dt$$

In the definition which uses the Riemann integral, the integral is computed over $(-\infty, \infty)$ or, necessarily, over the image of $X$ since that is the domain of $g$?

• If $\mathbb R^k$ is the codomain of $X$ then its expectation is a vector. In your second definition you use a Riemann integral. Why? I would say: as soon as you are familiar with Lebesgue integration then drop Riemann integration. Nothing is lost, much is gained. Your pdf's do not even have to be Riemann integrable. If the image of a random variable is bounded then its expectation is finite. This because $\int xdF(x)\leq\int c dF(x)\leq c$ if the image is contained in $[-c,c]$. – drhab Dec 22 '15 at 8:46

Preliminary remark. If you consider a vector-valued random variable $\Omega\to\mathbb R^k$ then any density function should live on $\mathbb R^k$ as well, so $t$ is a vector and all of your $dt$ integrals need to be interpreted as $d^kt$.
Question 1. If we take literally you first statement about the definition of the Riemann integral then the question is already answered. As one comment suggests, it is better to work with Lebesgue integrals but this does not change the fact that expectations make very little sense unless the absolute value (or norm, in the vector case) of the function has a finite integral. There is no need to make an exception according to whether the range of $X$ has compact closure: the important criterion remains the finiteness of integral of the absolute value. From the way in which you discuss variables I suspect that you know examples of continuous random variables that do not have a well-defined expectation. So I think you might have wanted to ask a different question: if the range of $X$ has compact closure (i.e., is bounded), does the expectation integral necessarily exist? - to which the answer is affirmative by the twin observations that (1) the density $f$ itself is absolutely integrable by definition, and (2) the vector-valued function $t$ is absolutely bounded on compact subsets of $\mathbb R^k.$ A more direct way, avoiding density functions, is to observe that absolutely essentially bounded random variables are Lebesgue integrable with the absolute value of the integral less than the absolute essential upper bound of the variable.
Question 2. A priori the integral is over the whole of $\mathbb R^k$, which comes down to $(-\infty,+\infty)$ in the one-dimensional case. But if $X$ is a continuous random variable with probability density function $f$ then that function is almost certainly supported by the (closure of the) range of $X;$ thus the integral defining expectation of $g(X)$ remains the same whether we integrate over the support of $f$, or the range of $X$ (which could be larger), or the entire Euclidean space.