# Trying to prove a limit of a simple multi case function

Full disclosure: This is my attempt at solving a homework assignment

Another full disclosure: This is my first time using LaTeX, so pardon any errors

We were asked to prove / disprove the existance of the limit as $x$ approaches some $x_0$ for the following function:

$$f(x) = \begin{cases} 0 &\mbox{if } x \in \mathbb{R}\backslash\mathbb{Q}\\ sin|x| & \mbox{if } n \in \mathbb{Q} \end{cases}$$

1. $x_0 \in \{ \pi * n, n \in \mathbb{Z}\}$
2. $x_0 \in \mathbb{R} \backslash \{ \pi * n, n \in \mathbb{Z} \}$

This is what I was thinking, would love to hear if it's missing something or if it's enough as a proof. Also other ideas would be greatly appreciated

For 1, I know that $\pi$ is irrational and an irrational number times a rational number (n) is still irrational, for any irrational $x_0$ the function returns the first case which is 0, giving us the constant function 0 for every $x_0$ in that range, whose limit is 0.

For 2, Let $x_0$ be a rational number (for every irrational one I get the constant function 0 as before), since it's rational I get $sin(x_0)$ the limit of which is just the value of $sin(x_0)$

I was wondering if I'm missing something here as this seems to simple to be true judging by the other questions we got for our assignment. Any help is appreciated!

Let's generalize. Suppose $g:\mathbb R\to \mathbb R$ is a continuous function (like $\sin |x|$ in your example) and we define $$f(x) = \begin{cases}0,\quad & \text{if } x\in\mathbb R\setminus \mathbb Q \\ g(x) \quad & \text{if } x\in \mathbb Q \end{cases}$$ For a given point $x_0$, there are two possibilities:
1. $g(x_0)=0$. Then $f(x_0)=0$ as well. Also, since $-|g(x)|\le f(x)\le |g(x)|$ for all $x\in\mathbb R$, the squeeze theorem implies $$\lim_{x\to x_0}|f(x)| = 0$$ So, $f$ is continuous at $x_0$.
2. $g(x_0)\ne 0$. Since rational numbers are dense, there is a sequence of rational numbers $x_n$ converging to $x_0$. We have $$\lim_{n\to\infty} f(x_n) = \lim_{n\to\infty} g(x_n) = g(x_0)\tag{1}$$ Since irrational numbers are also dense, there is a sequence of irrational numbers $y_n$ converging to $x_0$. We have $$\lim_{n\to\infty} f(y_n) = 0\tag{2}$$
From (1) and (2) it follows that $f$ is not continuous at $x_0$.