I need to show
If $f$ is a measurable complex-valued function on $(X,\mathscr{A})$, then $|f|$ is also measurable.
I tried it myself, but don't know if my work is correct or not? Could someone please help me check? Thank you very much!
My attempt:
Let $f:(X,\mathscr{A})\to(\mathbb{C},\mathscr{B}(\mathbb{C}))$ be measurable. Write $f(x)=u(x)+iv(x)$, where $u,v:X\to\mathbb{R}$. Then $|f(x)|=\sqrt{u^2(x)+v^2(x)}\in\mathbb{R}$. We want to show that $|f|:(X,\mathscr{A})\to(\mathbb{R},\mathscr{B}(\mathbb{R}))$ is measurable.
Let $\mathscr{B}_0$ be the collection of all subintervals of $\mathbb{R}$ of the form $(-\infty,b]$. Then the Borel sigma-algebra $\mathscr{B}(\mathbb{R})$ is equal to $\sigma(\mathscr{B}_0)$. Let $B\in\mathscr{B}_0$, then $B=\{z\in\mathbb{R}:a\leq b\}$ for some $b\in\mathbb{R}$. Then\begin{align}|f|^{-1}(B) = \{x\in X:|f(x)|\in B\} = \{x\in X:|f(x)|\leq b\}.\end{align}If $b<0$, then $|f|^{-1}(b)=\emptyset\in\mathscr{A}$. So suppose $b\geq0$. Since $f$ is measurable with respect to $\mathscr{A}$ and $\mathscr{B}(\mathbb{C})$, its real and imaginary part $u$ and $v$ are $\mathscr{A}$-measurable, so are $u^2$, $v^2$, and $u^2+v^2$. Thus,\begin{align}|f|^{-1}(B) = \{x\in X:|f(x)|\leq b\} = \{x\in X:u^2(x)+v^2(x)\leq b^2\} \in\mathscr{A}.\end{align}Since $B$ is arbitrary, we have proved that $|f|$ is measurable.
If there is any mistake, please point it out! I really appreciate it!