showing that a Limit exists This question is stuffing me over.
Let $f$ be defined by
$$f(x) = \begin{cases}
x & \text{if } x \in \mathbb Q \\
-x & \text{if } x \notin \mathbb Q 
\end{cases}$$
Use the definition of a limit to show that $\lim_{x\to 0} f(x)$ exists.
I get how for a limit to exist we need to show that for every $\epsilon$ that is greater than $0$ there exists a $\delta$ that greater than $0$, such that if $0<|x-a|<\delta$ then $|f(x)-L|<\epsilon$, but I don't know how to actually do it.
 A: First of all, what would the limit be? If we just look at the rational part $f(x) = x$, whose limit as $x \to 0$ is just $0$, as I hope you already know. If $f$ is going to converge at all, it has to converge to $0$. So in the definition you gave, $L = 0$. So $|f(x) - L| = |f(x)|$. Now, we are also taking the limit at $0$, so $a = 0$ as well. Thus $|x - a| = |x|$. With these two values, the definition becomes:

For every $\epsilon > 0$, there is a $\delta > 0$ such that if $|x| < \delta$, then $|f(x)| < \epsilon$.

That means: if we are given some value $\epsilon > 0$, then we can find some value $\delta > 0$ (which can depend on $\epsilon$) so that we can show $|x| < \delta$ implies that $|f(x)| < \epsilon$.
For this problem, it is easy to do. Let's look at $|f(x)|$. If $x \in \Bbb Q$, then $f(x) = x$, so $|f(x)| = |x|$. If $x \notin \Bbb Q$, then $f(x) = -x$, and therefore $|f(x)| = |-x| = |x|$. Thus for every value of $x$, $|f(x)| = |x|$.
So now, the statement that we have to prove becomes:

For every $\epsilon > 0$, there is a $\delta > 0$ such that if $|x| < \delta$, then $|x| < \epsilon$.

Obviously, we should just choose $\delta = \epsilon$.
That is the planning for the proof. Not the actual proof, which must start with what we are given, and deduce the conclusion from it. It goes like this:
Proof: Let $\epsilon > 0$ be given, and set $\delta = \epsilon$. If $|x| < \delta = \epsilon$, then $|f(x)| = |\pm x| = |x| < \epsilon$. Hence $$\lim_{x\to 0} f(x) = 0$$
