I need some examples for understanding the concept of measurable functions Here is the definition of measurable function from Stein and Shakarchi's Real Analysis: Measure Theory, Integration, and Hilbert Spaces (p.28):



*

*Talking about [-∞,a] for all a seems like [-∞,∞]. So one would think why not simply say $f^{-1}([-∞,∞])$ (which is actually E) is measurable (and this would make a useless definition). Could you please provide examples showing how these two definitions differ?

*Does the range of f need to be measurable? If not, please give me an example.

*What is a neat example of a non-measurable function (whose domain is measurable)?
Edit: I think this would make a better definition. However it's apparently limited to finite valued functions.

 A: "Measurable" is the minimal requirement of a function to even think about its Lebesgue integral. You might have seen Wikipedia's page, and in particular the following picture; 

The lowest picture describes Lebesgue's integration. There, the base of every rectangle is a set of the form 
$$\tag{1}
\{x\ :\ \lambda_1\le f(x)\le \lambda_2\},$$
and the integral is defined as the "sum" of all such rectangles, with a suitable limiting process involved.
In particular, to even think about integrals it is necessary that the area of the sets (1) is well-defined, and so, it is necessary that these sets are all measurable. It turns out that, to ensure such measurability, it is necessary and sufficient that the sets 
$$
\tag{2}
\{x\ :\ f(x)< a\}
$$
are all measurable. Therefore, we say that $f$ is measurable if all the sets (2) are.
A: 1.
Saying that some expression $p(a)$ that depends on $a$ is true "for all $a$" mean, in mathematics, the following:

Whatever value of $a$ you choose to put into the expression, the statement will always be true.

Therefore, the statement

For all $a\in\mathbb R: f^{-1}([-\infty, a))$ is measurable

is the statement:

Whatever value you choose $a$ to be, the set $f^{-1}([-\infty,a))$ is measurable.

This is not the same as saying that $f^{-1}([\infty, \infty])$ is measurable. The statement says that $f$ is measurable if $f^{-1}([-\infty, 0))$ is measurable and $f^{-1}([-\infty, 2))$ is measurable and $f^{-1}([-\infty, 3242))$ is measurable and $f^{-1}([-\infty, \sqrt2)$ is measurable and $f^{-1}([-\infty, \pi))$ is measurable and $f^{-1}([-\infty, e))$ is measurable and $f^{-1}([-\infty, 2348+\frac{\sqrt[e]{\pi})}{\ln(398453)})$ is measurable and so on and so on.
2.
The definition does not demand that the range of $f$ is measurable.
3.
An example of a non-measurable function would be any indicator function of a non-measurable set.
