Examples of measurable and non measurable functions

I'm a new in measure theory and I want to understand measurable functions. As I expect measurable function is the function that maps one set to another where preimage of measurable subset is measurable. Am I right?

I want to understand it on some simple examples. So I need an easy examples of measurable and not measurable functions.


Solution 1:

Indicator functions

Let $(M,\mathcal A)$ be a measurable space. Let $S\subseteq M$ be a subset. Consider the function $1_S\colon M\to\mathbb R$ taking elements in $S$ to $1$ and elements outside $S$ to $0$. Equip $\mathbb R$ with, say, the Borel $\sigma$-algebra. Then $1_S$ is measurable if and only if $S\in\mathcal A$.

Solution 2:

Just in case someone will find this now. The answer if a function is measurable or not depends mostly on the chosen sigma-algebra. For example let $f(x)$ take 2 values, say $a$ and $b$ for some $x$. This function won't be measurable for sigma-algebra $\{\emptyset, X\}$, but will be if we choose for example $\mathcal{B}(\mathbb{R})$.