Proving a function $f$ is continuous at a point $a$ This is a homework problem, so I'll tag it as such, but I'm having a bit of trouble in my Real Analysis class. The problem I have is this:
Prove that the function $f$ is continuous at the point $a$ if and only if, for every $\epsilon>0$, there is a $\delta>0$ such that $|f(x)-f(y)|<\epsilon$ whenever $x$ and $y$ are both in the interval $(a-\delta, a+\delta)$.
 I feel like this should be rather simple, but I just need a starting place - some of the logic is still new to me and I don't really know where to begin. If anyone would be so kind as to give me a hand I'd really appreciate it!
Thanks!!
EDIT: I know as much to say that if $f$ is continuous at $a$ then there exists an $\epsilon$-neighborhood about $a$ in the domain, but why does $x$ and $y$ being in the $\delta$-neighborhood of $a$ imply that they are in the $\epsilon$-neighborhood? If $x$ and $y$ were both in the $\epsilon$-neighborhood of $a$, $|f(x)-f(y)|$ would always be less than $\epsilon$, correct? And thus the conclusion, but how does the $\delta$-neighborhood come into play?
 A: I’ll give you a hand with one direction to get you started. Suppose that $f$ is continuous at $a$, and let $\epsilon>0$ be arbitrary; we must find a $\delta>0$ such that $$|f(x)-f(y)|<\epsilon\quad\text{whenever}\quad x,y\in(a-\delta,a+\delta)\;.$$ Since $f$ is continuous, we know that there is a $\delta_\epsilon>0$ such that $$|f(x)-f(a)|<\epsilon\quad\text{whenever}\quad x\in(a-\delta_\epsilon,a+\delta_\epsilon)\;,$$ but that’s not quite good enough: it tells us that $|f(x)-f(a)|<\epsilon$ and $|f(y)-f(a)|<\epsilon$ whenever $x,y\in(a-\delta_\epsilon,a+\delta_\epsilon)$, but a little experimentation should convince you that $|f(x)-f(y)|$ can still be larger than $\epsilon$.
However, we have a tool that directly relates $|f(x)-f(y)|$ to $|f(x)-f(a)|$ and $|f(y)-f(a)|$: the triangle inequality, which tells us that
$$|f(x)-f(y)|\le|f(x)-f(a)|+|f(y)-f(a)|\;.$$
Thus, we can conclude that $$|f(x)-f(y)|<2\epsilon\quad\text{whenever}\quad x,y\in(a-\delta_\epsilon,a+\delta_\epsilon)\;.$$
If we’d chosen a $\delta_{\epsilon/2}$ so that $|f(x)-f(a)|<\frac{\epsilon}2$ whenever $x\in(a-\delta_{\epsilon/2},a+\delta_{\epsilon/2})$, instead of the $\delta_\epsilon$ that we actually did use, then ... ?
