This function is Lebesgue-integrable:$$\chi(x)= \left\{ \begin{array}{ll} 1 & \text{if}~x~\text{is rational}\\ 0 & \text{if}~x~\text{is irrational}. \end{array} \right.$$
¿But is this function:$$\chi_2(x)= \left\{ \begin{array}{ll} x & \text{if}~x~\text{is rational}\\ -x & \text{if}~x~\text{is irrational} \end{array} \right.$$?
The Q of whether a function is Lebesgue-measurable or Lebesgue-integrable is unaffected by what values the function takes on any one set that has Lebesgue measure zero.Every countable (meaning finite or countably infinite) set of reals is Lebesgue-null (meaning that its Lebesgue measure is zero.) The set of rationals is countable, hence it's Lebesgue-null.Let g(x)=-x for all x. Then $\chi_2$ and g are equal except on a Lebesgue-null set, and g is measurable so $\chi_2$ is.