Prove this function is continuous using epsilon-delta definition. A function is continuous at $a$, if
For all $\epsilon > 0$, there exists $\delta$ > 0 such that: 
for all x: 
$0<|x - a| < \delta \Rightarrow |f(x) - f(a)| < \epsilon$
$f(x) = \left\{ 
  \begin{array}{l l}
    x-2n & \quad \text{if } {2n \leq{x} \leq{2n+1}}, {n \in \mathbb{Z}}\\
    2n-x & \quad \text{if } {2n-1 \leq{x} \leq{2n}}, {n \in \mathbb{Z}}
  \end{array} \right.$
The graph looks like repeating triangles above x axis.
Check this link:   faculty.swosu.edu/michael.dougherty/book/chapter03.pdf
I have tried using its procedures but I am stuck because this function is piecewise 
 A: Let me do this for you for the special case of $n =1$. You should be able to generalize yourself.
So we have
$$f(x) = \left\{ 
  \begin{array}{l l}
    x-2 & \quad \text{if } {2 \leq{x} \leq{3}}, \\
    2-x & \quad \text{if } {1 \leq{x} \leq{2}}.
  \end{array} \right.$$
Let us just assume that $a< 2$ (if $a \geq 2$ you do something similar) and let $\epsilon > 0$ be given. Then let $\delta < \min\{\epsilon, \lvert 2- a\rvert\}$. Note that when $\lvert x - a \rvert < \delta$, then 
$$
\lvert f(x) - f(a)\rvert = \lvert 2-x - 2 + a\rvert = \lvert a - x\rvert < \delta < \epsilon.
$$
So $f$ is continuous at $a$.
Note that we need $\delta < \lvert 2 - a\rvert$ because we need $f(x) = 2 - x$.
Q: What if $a = 2$? Then pick $\delta = \epsilon$. So you have for $\lvert x - 2\rvert < \delta$ and $x > 2$:
$$
\lvert f(x) - f(a)\rvert = \lvert x-2 - 0\rvert = < \delta < \epsilon.
$$
And for $\lvert x - 2\rvert < \delta$ and $x < 2$:
$$
\lvert f(x) - f(a)\rvert = \lvert 2-x - 0\rvert = < \delta < \epsilon.
$$
A: Hint: Show that the choice $\delta=\epsilon$ works. Take special care why this also works if there exists $m\in\mathbb Z$ with $a-\delta<m<a+\delta$!
