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?

-
Do you mean $|f(x)-f(y)|<\epsilon$? – Brian M. Scott Oct 22 '12 at 1:22
I do. It's been fixed. – roboguy12 Oct 22 '12 at 1:23
The epsilon-delta criterion for continuity can be expressed as such: A function $f(x)$ is continuous at $x_o$ if $\forall$ e>0, $\exists$ d>0 such that 0 < |$x$ - $x_o$| < d $\rightarrow$ |$f(x)$-f($x_o$)| < e – Arthur Collé Oct 22 '12 at 1:26

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 ... ?

-
Then we'd have $|f(x)-f(y)|<\epsilon$! Brilliant, I'd never think to use the Triangle Inequality here, but what value of $\delta_\epsilon$ can we pick to make this work? I'm a little shaky on how the values of $\delta$ can affect the value of $\epsilon$. – roboguy12 Oct 22 '12 at 1:42
@roboguy12: Since you’re proving a general result rather than working with a specific function at a specific point $a$, you don’t have to worry about such computational details. Exactly how $\delta$ and $\epsilon$ interact isn’t important; all that matters is that the hypothesis that $f$ is continuous ensures that a $\delta_\epsilon$ with the stated properties actually exists. – Brian M. Scott Oct 22 '12 at 1:45
Okay, so because $f$ is continuous, there exists a specific $\delta_{\frac{\epsilon}{2}}$ such that, if $x\in(a-\delta_{\frac{\epsilon}{2}},a+\delta_{\frac{\epsilon}{2}})$ then $|f(x)-f(a)|<\frac{\epsilon}{2}$, just because of the definition of continuity? – roboguy12 Oct 22 '12 at 1:49
@roboguy12: Yes, that’s right. The definition of continuity of $f$ at $a$ is that for each $\epsilon>0$ there is a $\delta_\epsilon>0$ such that $|f(x)-f(a)|<\epsilon$ whenever $x\in(a-\delta_\epsilon,a+\delta_\epsilon)$. – Brian M. Scott Oct 22 '12 at 2:08
Okay, got it. Thank you very much!! – roboguy12 Oct 22 '12 at 2:09