Why do we use the Borel sigma algebra for the codomain of a measurable function? In several measure theory books, I see that a measurable function $f:\mathbb{R} \rightarrow \mathbb{R}$ often equips the domain with the Lebesgue $\sigma$-algebra and the codomain with the Borel  $\sigma$-algebra. However, if $g$ is another such function, then the composition of $f$ and $g$ may fail to be measurable. 
Why do we not use the Lebesgue $\sigma$-algebra for both the domain and the codomain?
 A: Good question; I didn't know the answer until just now, never having thought about it.A: Because if we did there would be fewer measurable functions, and in particular a continuous function $f:\Bbb R\to\Bbb R$ would not necessarily be measurable:
Say $K$ is a "fat Cantor set", that is a subset of $\Bbb R$ homeomorphic to the middle-thirds Cantor set $C$ but such that $m(K)>0$. There is a continuous bijection $f:\Bbb R\to\Bbb R$ such that $f(K)=C$. Now $K$ contains a non-measurable set $E$. Say $F=f(E)$. Then $F$ is Lebesgue measurable, being a subset of a null set, but its inverse image $E$ is not Lebesgue measurable. So $f$ is continuous but not Lebesgue-to-Lebesgue measurable.
Not what we want; if continuous functions are not measurable none of the things we want to use this stuff for work anymore.
(Also it's fun to ask students to resolve the "paradox" that according to the definition of a measurable function between measurable spaces, no topology, the composition of two measurable functions is obviously measurable, yet in this context the composition of two measurable functions need not be measurable.)
A: I asked Terry Tao a similar question about a year ago:

The (real) Lebesgue measurable functions are $({\mathcal L},{\mathcal B}_{\bf R})$ measurable by definition. What if one considers the $({\mathcal L},{\mathcal L})$ measurable functions only?
For doing integration of functions $f:(X,{\mathcal M})\to(Y,{\mathcal N})$, why is it enough to use Borel measure in the target space?

Here is his answer:

For the purposes of integration theory, the range $(Y,{\mathcal N})$ and domain $(X,{\mathcal M})$ are treated quite differently (in contrast to the more category-theoretic areas of mathematics, in which the domain and range of a morphism are consciously treated on a very equal footing). In particular, the range needs the structure of a complete vector space in order to have any sensible (linear) integration theory. (There are some nonlinear generalisations of the integration concept, but they usually fit better with the more classical Riemann theory of integration than the Lebesgue theory.)
One way to think of a $({\mathcal L}, {\mathcal B}_{\bf R})$-measurable function is as the pointwise limit of simple functions (finite linear combinations of indicator functions of measurable sets). This ties in with the underlying intuition of Lebesgue integration as coming from “horizontally” slicing up the graph of a function (as opposed to Riemann integration, which is focused instead on “vertically” slicing up the graph).
Strengthening the measurability requirement by placing the Lebesgue sigma algebra, rather than the Borel sigma algebra, on the range leads to some pathologies, for instance the very natural function $x \mapsto (x,0)$ from $({\bf R}, {\mathcal L})$ to $({\bf R}^2, {\mathcal L}^2)$ is now a non-measurable function! (if $E$ is a non-measurable subset of ${\bf R}$, then $E \times \{0\}$ is a null set and is thus Lebesgue measurable, but not Borel measurable in ${\bf R}^2$.) One can achieve similar pathologies in one-dimension by using an essentially bijective map between, say, the unit interval and the Cantor set.

