Prove that if $f$ is continuous in $\mathbb{R}$ and $f(x)=0$ for all $x<0$ then $f(0)=0$.
My attempt: $f(x)=0$ for all $x<0$ can be written as for all $\varepsilon>0$ it is $f(x-\varepsilon)=0$.
Letting $x\to0^-$ both sides of the equality leads to $$\lim_{x\to0^-} f(x-\varepsilon)=0$$ Since by hypothesis $f$ is continuous the limit on the left hand side can be evaluated by simply substituting $x=0^-$ in $f$, so we have $$f(-\varepsilon)=0$$ Since it is true for all $\varepsilon>0$ it is true if we let $\varepsilon \to 0^+$: letting $\varepsilon \to 0^+$ we obtain, using again the continuity of $f$, the result $f(0)=0$.
Is this correct? Thanks.
Sure, it's correct, but you used continuity of $f$ twice, when you only had to use it once. We have: \begin{align} f(0) = \lim_{x \to 0}f(x) = \lim_{x \to 0^-}f(x) = \lim_{x \to 0^-}(0) = 0 \end{align} First is by continuity, second is because the limit exists, third is by hypothesis, and the last is obvious.