Show that $\lim_{x\to 0}f(x) = 0$ Define the function $f(x) = x\cdot\chi_{\mathbb{Q}}(x)$ (where $\chi(x) = 1$ if $x \in \mathbb{Q}$ and $\chi(x) = 0$ if $x \in \mathbb{R}\setminus\mathbb{Q})$. Show that $\lim_{x\to 0}f(x) = 0$.
I tried solving this problem but I have no idea if I did it correctly. My professor mentioned something about functions like this oscillating too much to be continuous, so I figured it was okay to break this up into cases. Please let me know if this is wrong or if there are any errors, thanks!
Note that if $x\in\mathbb{Q}$, then $\chi(x) = 1$ and $2 > |\chi(x)|$. This implies,
\begin{equation*}
\frac{1}{2} < \frac{1}{|\chi(x)|}
\end{equation*}
\begin{equation*}
\frac{\epsilon}{2} < \frac{\epsilon}{|\chi(x)|}
\end{equation*}
So let $\delta \leq \frac{\epsilon}{2}$. Then $0 < |x-0| < \delta$, implies
\begin{equation*}
|x - 0| < \delta \leq \frac{\epsilon}{2} < \frac{\epsilon}{|\chi(x)|}
\end{equation*}
\begin{equation*}
|x||\chi(x)|  < \epsilon
\end{equation*}
\begin{equation*}
|x\chi(x)|  < \epsilon
\end{equation*}
\begin{equation*}
|x\chi(x) - 0|  < \epsilon
\end{equation*}
Note that if $x\in\mathbb{R}\backslash\mathbb{Q}$, then $\chi(x) = 0$ and $|x||\chi(x)| < |x|$, because $x$ is converging to (and never equals) $0$.
Suppose $\epsilon \in \mathbb{R}^+$, and choose $\delta \leq \epsilon$. Then $0 < |x - 0| < \delta$ implies,
\begin{equation*}
0 = |x||\chi(x)| < |x| < \delta \leq \epsilon 
\end{equation*}
\begin{equation*}
|x\chi(x) - 0| < \epsilon
\end{equation*}
Therefore $\lim_{x\rightarrow0} f(x) = 0$.
 A: Aware of the definition of the limit, ie you have to check that for any sequence $(x_n)_n$ converging to 0, the sequence $(f(x_n))_n$ converges to 0. so to be formally correct use this.
You’re idea is okay, but you have to put both together in the proof, so for $\epsilon >0$ let $\delta= \epsilon/2$ will do the job.
Another hint for a fast solution: remark that for any x we have $0 \leq |f(x)|\leq |x|$.
A: You are correct but you don't say what is your final choice of $\delta$ explicity. For $x\in\Bbb Q$, you chose $\delta\le\epsilon/2$ and for $x\in\Bbb R-\Bbb Q$, you chose $\delta\le\epsilon.$ So $\delta\le\epsilon/2$ works for both rational and irrational points in the $\delta$ neighbourhood of $0$.
Also note that for irrational points, we can infact choose any $\delta>0$ since $|f(x)|=0<\epsilon$ for all irrational points.

The last $3$ lines of your solution are sufficient proof if you make a small correction. For both rational and irrational $x, |f(x)|=|x\chi_{\Bbb Q}(x)|\le|x|$, so if we choose $\delta\le\epsilon$, then $0<|x|<\delta\implies |f(x)|\color{red}\le|x|<\delta\le\epsilon$.
