If $f$ is a real function, continuous at $a$ and $f(a) < M$, then there is an open interval $I$ containing a such that $f(x) < M$ for all $x \in I$. I have problem regarding the If f is a real function, continuous at a and f(a) < M, then there is an open interval I contianing a such that f(x) < M for all x in I. answer. If I used $\epsilon =M-f(a)$ which is also $\epsilon >0$ and $ \exists$ $  \delta>0$ so there is  an open interval $I$ containing such that $f(x)<M$ for all $x \in I$. I think this is also correct but not sure.
Can anyone verify my answer?
$\underline{Edit}$
Now let $\epsilon = {M-f(a)}$, clearly $\epsilon >0$, and hence there exists an open interval $I=(a-\delta, a+\delta)$, such that for any $x\in I$, $|f(x)-f(a)|<\epsilon= {M-f(a)}$ holds.
It follows that $f(x)<M$ for all $x \in I$
 A: The condition that $f$ is continuous at $a$ indicates that
\begin{equation}
\lim_{x \to a} f\left(x\right) = f\left(a\right).
\end{equation}
In other words, we have the following proposition:
\begin{equation}
\forall \epsilon > 0, \exists \delta > 0, \forall x, 0 < \lvert x-a\rvert < \delta \longrightarrow \lvert f\left(x\right)-f\left(a\right)\rvert < \epsilon.
\end{equation}
And we have the proposition that
\begin{equation}
f\left(a\right) < M.
\end{equation}
Using the fact that $M - f\left(a\right) > 0$, we have
\begin{equation}
\exists \delta > 0, \forall x, 0 < \lvert x-a\rvert < \delta \longrightarrow \lvert f\left(x\right)-f\left(a\right)\rvert < M - f\left(a\right),
\end{equation}
which further indicates that
\begin{equation}
\exists \delta > 0, \forall x, 0 < \lvert x-a\rvert < \delta \longrightarrow f\left(x\right) < M.
\label{main}
\end{equation}
If there is no such open interval $I$ that $f\left(x\right) < M$ for all $x \in I$, then we have the following proposition:
\begin{equation}
\forall \delta > 0, \exists x, 0 < \lvert x-a \rvert < \delta \wedge f\left(x\right) \geq M,
\label{sub}
\end{equation}
which obviously contradicts our conclusion.
