# Why does a function in $L^p$ space needs to be measurable?

Why do we constrain these $L^p$ spaces to have only functions that are measurable? Measurable on the sense of Lebesgue, I assume. But I don't understand why it is necessary.

-
Integrals don't make sense unless the integrand is measurable. You cannot define the norm that characterizes $L^p$ without that assumption. – Chris Janjigian Oct 26 '12 at 16:20
But lebesgue integral is only worried about the domain of integration to be measurable, I thought. – qwerty89 Oct 26 '12 at 16:59
@qwerty89 You think wrong. You integrate measurable functions on measurable sets. – Siminore Oct 26 '12 at 17:04
Moreover, $L^p$ doesn't consist of functions, but rather of equivalence classes of functions where two functions are identified if they agree almost everywhere (otherwise the expression $\|f\|_p = \int |f|^p$ would only give a seminorm). – commenter Oct 26 '12 at 18:43

To see why it's necessary, you have to look back at the original definition of what it means for a function $f$ to have a Lebesgue integral. If we have a step function given by $$g = \sum_{i=1}^r a_i \chi_{A_i}$$ where $\chi_{A_i}$ is the indicator function on a measurable set $A_i$ with finite measure, and $a_i$'s are some constants, then we define its integral to be $$\int_X g \, dx = \sum_{i=1}^r a_i \mu(A_i)$$ where $\mu$ is the Lebesgue measure (or, in general, any measure). Now, for a general non-negative function $f: \mathbb{R} \rightarrow \mathbb{R}^{+}$ (the domain can be changed to any measure space), we define its integral by approximating it by a sequence of step functions $f_n$ increasing to $f$, and defining the integral of $f$ to be equal to the limit of the integrals of $f_n$. However, if we want to approximate $f$ by some step map $g$, then essentially we're choosing $$f \approx g = \sum_{i=1}^r a_i \chi_{A_i}$$ and $A_i = \{x: a_{i-1} < f(x) \le a_i\}$. But $A_i$ only has a well-defined measure $\mu(A_i)$ if $f$ is a measurable function.
To treat the general $L^p$ case, note that $f \in L^p$ is equivalent to $f^p \in L^1$, and $f$ is measurable if and only if $f^p$ is.