# $f,g:\,(X,\mu)\to\mathbb{R}$, $f=g$ a.e then if $g$ is Lebesgue measurable then so if $f$?

I have an observation in my real analysis lecture notes that states that if $f,g:\,(X,\mu)\to\mathbb{R}$ (with Borel's -$\sigma$ algebra ) and $f=g$ almost everywhere then if $g$ is Lebesgue measurable then so if $f$.

I don't understand why this is true, can someone please explain ?

I tried looking at some Borel set and on it source, but I can't figure why if we change $g$ in some measure $0$ of points then the source is still in Lebesgue -$\sigma$ algebra

-

Let $A$ be a measurable subset of $\mathbb R$. We must show that $Y=f^{-1}(A)$ is measurable in $X$.
$$N=\lbrace x \in X | f(x) \neq g(x) \rbrace$$ is measurable and has measure $0$. We deduce that $Y \cap N$ is also measurable with measure $0$. So it suffices to show that $Y\setminus N$ is measurable.
Now $Y\setminus N =g^{-1}(A) \setminus N$ is a difference of two measurable sets, qed.