# The Dirichlet Function.

The Dirichlet function is defined by $f(x)=\begin{cases} 1 &\text{ if } x\in \mathbb{Q}\\0 &\text{ if } x\notin \mathbb{Q}.\end{cases}$ Let $g(x)=\begin{cases}0 &\text{ if } x\in \mathbb{Q}\\ 1 &\text{ if } x\notin \mathbb{Q} \end{cases}$ be its evil twin.

(1) Prove that $f$ is discontinuous at every $x\in \mathbb{R}$.

(2) Prove that $g$ is continuous at exactly one point $x_1\in \mathbb{R}$.

(3) Prove that $f+ g$ is continuous at every $x\in \mathbb{R}$.

Definition (Continuous at a point): A function $f: D \longrightarrow \mathbb{R}$ is continuous at $X_0\in D$ if for every $\epsilon > 0$ there exists some $\delta > 0$ such that $|f(x) - f(x_0)| < \epsilon$ whenever $|x-x_0|< \delta$.

Response: I don't have any work yet, hints and answers would be extremely helpful.

-

$f+g$ is a constant function, so (3) is easy. (2) is false, so don't waste your time trying to prove it. For (1), set $\epsilon=1$, take any $x_0\in\Bbb R$ and any $\delta>0$, and use the fact that both $\Bbb Q$ and $\Bbb R\smallsetminus\Bbb Q$ are dense in $\Bbb R$ to show that there is some $x\in \Bbb R$ such that $|x-x_0|<\delta$ and $|f(x)-f(x_0)|=\epsilon$.
As a side note, if we'd defined $g(x):=xf(x)$, then $g$ would be continuous at exactly one point--namely $0$.