If $x\le c\le y$ and $|x-y|<\delta$, then $|\frac{g(x)-g(y)}{x-y}-g'(c)|<\epsilon$ Alright, so here goes the question:

Consider a function $g$ that is differentiable at some point $c$ on an interval $[a,b]$.
Prove that: $\forall$$\epsilon$ $>0$ $\exists$$\delta$ $> 0$ such that when $a\leq x \leq c \leq y \leq b$, and $|x-y|<\delta$, then $\left|\dfrac{g(x)-g(y)}{x-y} - g'(c)\right| < \epsilon$.

What I have so far is that, because $g$ is differentiable at $c$, and $c$ is between $x$ and $y$, $g$ is differentiable at $c$ on $[x,y]$. By the mean value theorem, $f'(c)=(f(y)-f(x))/(y-x)$, which equals $(f(x)-f(y))/(x-y)$. Thus  $(f(x)-f(y))/(x-y) - f'(c) = 0$, which is less than any $\epsilon$.
Is what I'm doing legal? Thank you for your help!

By the definition of the derivative, for every $\varepsilon > 0$, there is a $\delta > 0$ such that for all $z \in [a,b]$ with $0 < \lvert z-c\rvert < \delta$, we have
$$\left\lvert\frac{g(z)-g(c)}{z-c} -g'(c)\right\rvert < \varepsilon.\tag{1}$$
Now if $c < y < c+\delta$ and $c-\delta < x < c$, we have by $(1)$
$$\begin{align}
\left\lvert\frac{g(y)-g(c)}{y-c} - g'(c)\right\rvert &< \varepsilon,\tag{2}\\
\left\lvert\frac{g(c)-g(x)}{c-x} - g'(c)\right\rvert &< \varepsilon,\tag{3}
\end{align}$$
and we want to combine $(2)$ and $(3)$ so that we obtain
$$\frac{g(y)-g(x)}{y-x} - g'(c).$$
To get the denominator $y-x$, we can multiply $(2)$ with $\dfrac{y-c}{y-x}$, and $(3)$ with $\dfrac{c-x}{y-x}$. That leads to
$$\begin{align}
\frac{y-c}{y-x}&\left(\frac{g(y)-g(c)}{y-c}-g'(c)\right)
+ \frac{c-x}{y-x}\left(\frac{g(c)-g(x)}{c-x}-g'(c)\right)\\
&= \frac{g(y)-g(c)}{y-x} + \frac{g(c)-g(x)}{y-x} - \left(\frac{y-c}{y-x}+\frac{c-x}{y-x}\right)g'(c)\\
&= \frac{g(y)-g(x)}{y-x} - g'(c),
\end{align}$$
and therefore we find
$$\begin{align}
\left\lvert \frac{g(y)-g(x)}{y-x} - g'(c)\right\rvert &= \left\lvert \frac{y-c}{y-x}\left(\frac{g(y)-g(c)}{y-c}-g'(c)\right)
+ \frac{c-x}{y-x}\left(\frac{g(c)-g(x)}{c-x}-g'(c)\right)\right\rvert\\
&\leqslant \frac{y-c}{y-x}\left\lvert\frac{g(y)-g(c)}{y-c} - g'(c)\right\rvert
+ \frac{c-x}{y-x}\left\lvert\frac{g(c)-g(x)}{c-x} - g'(c)\right\rvert\\
&< \frac{y-c}{y-x}\varepsilon + \frac{c-x}{y-x}\varepsilon\\
&= \varepsilon.
\end{align}$$
So we have the desired inequality if $c-\delta < x < c < y < c+\delta$. If $x = c < y < c+\delta$ or $c-\delta < x < c = y$, the inequality holds by $(1)$, and if $\lvert y-x\rvert < \delta$ with $x\leqslant c \leqslant y$, then we have $c-\delta < x \leqslant c \leqslant y < \delta$, so we have established
$$\left\lvert \frac{g(y)-g(x)}{y-x} - g'(c)\right\rvert < \varepsilon$$
for all $x,y$ with $\lvert y-x\rvert < \delta$, $x\leqslant c \leqslant y$ and $x \neq y$.
