Why do we require absolute convergence in the definition of expectation? I am studying some basic probability and the lecture have defined
the expectation of a $R.V$ ,$X$, in the cases that $X$ is discrete
or continues.
In both definitions we first required some absolute convergence, for
example, in the continues case we required that $\int|x|f(x)dx<\infty$
and defined the expectation to be $\int xf(x)dx$.
What is the reason for this requirement ? if $\int xf(x)dx$ then
it seems that it should be called the expectation regardless of if
$\int|x|f(x)dx<\infty$ is convergent.
 A: Consider for instance, the Cauchy distribution i.e. $$f(x) = \dfrac1{\pi} \dfrac1{1+x^2}$$ Clearly, $f(x)$ is a valid probability density function since $$\int_{-\infty}^{\infty} f(x) dx = 1$$
However, $$\int_{-\infty}^{\infty} \dfrac1{\pi} \dfrac{x}{1+x^2} dx$$ doesn't exist. This is so since if you "interpret" the integral $ \displaystyle \int_{-\infty}^{\infty} \frac{x}{x^2 + 1} dx$ as $\displaystyle \lim_{R \rightarrow \infty} \int_{-R}^{R} \frac{x}{x^2 + 1} dx$, then it is zero. (This is called the Cauchy principal value).
However, note that the integral $ \displaystyle \int_{-\infty}^{\infty} \frac{x}{x^2 + 1} dx$ can also be interpreted as, for instance, $$\displaystyle \lim_{R \rightarrow \infty} \int_{-R}^{kR} \frac{x}{x^2 + 1} dx = \lim_{R \rightarrow \infty}  \frac12 \log \left( \frac{1 + k^2R^2}{1 + R^2} \right) = \log(k) \text{ where }k > 0.$$ You could also take other functions of $R$ such that the lower limit tends to negative infinity and upper limit tends to infinity as $R \rightarrow \infty$ to get different answers.
Hence, $ \displaystyle \int_{-\infty}^{\infty} \frac{x}{x^2 + 1} dx$ is not zero and in fact cannot be assigned any value unless you know how the lower limit and upper limit approach $\infty$.
This arises due to the fact the integral doesn't converge conditionally on $(-\infty, \infty)$ i.e. $$\int_{-\infty}^{\infty} \vert x \vert f(x) dx = \int_{-\infty}^{\infty} \dfrac1{\pi} \dfrac{\vert x \vert}{1+x^2} dx = \infty$$
Hence, $\displaystyle \int x f(x) dx$ is well-defined and exists only when $\displaystyle \int \vert x \vert f(x) dx < \infty$.
A: It is not just so that EX is finite. The problem is that we can have $E|X| = \infty$ but $EX$ is not well defined! If you open any good book on real analysis, say Rudin's mathematical analysis, you will find that if a series is not absolutely convergent but is "conditionally convergent",, then the series can be rearranged to have different limits!. But the expectation is one number and it shouldn't matter how the series is rearranged. $E|X| < \infty$ assures us of it's existence and well definedness.
Also EX can be $\infty$. Let $X= n \quad \mbox{w.p} \frac{6}{\pi^2n^2} \quad \forall n \geq 1$. The Expected value is $\infty$
