If $f: \mathbb{R} \to \mathbb{R}$ is continuous then $\{ x \in \mathbb{R} \mid f(x) > 0\}$ is an open subset of $\mathbb{R}$ Question:

Let $f: \mathbb{R} \to \mathbb{R}$ be a continuous function. Prove that $\{ x \in \mathbb{R} \mid f(x) > 0\}$ is an open subset of $\mathbb{R}$.

At first I thought this was quite obvious, but then I came up with a counterexample. What if $f(x)=1$ for all $x$? Then the set becomes $\{ x \in \mathbb{R} \mid f(x) = 1\}$, a proper subset of the set in question, which is a closed subset.
 A: The set $\{x\in\mathbb R\mid f(x) = 1\}$ for the function defined by $f(x) = 1$ for every $x$, is $\mathbb R$ the whole set of real numbers. This is an open set, so no, you did not find a contradiction.

In case you don't believe me:
By definition, a set $X\subseteq \mathbb R$ is open if, for every $x\in X$, there exists an interval $(a,b)$ for which $(a,b)\subseteq X$. In the case of $X=\mathbb R$, you can, for any $x\in\mathbb R$, find such an interval (i.e. $(x-1,x+1)$), meaning $\mathbb R$ is an open subset of $\mathbb R$.

You may say "but $\mathbb R$ is a closed subset of $\mathbb R$!". Well, yes it is. But there is nothing in the definition of closed and open sets which demands that a set cannot be both closed and open. In fact, in topology, sets which are both closed and open are nothing strange. Proper clopen (meaning closed and open) subsets of a topological space which do not contain any nontrivial clopen sets are called "connected components" of the space.
A: You are asked to show that the preimage of $(0, \infty)$ is open. But since $f$ is continuous, the preimage of an open set is open; $(0, \infty)$ is open, therefore its preimage is also open.
A:  
Suppose $S$ be the set which you want to prove open.
$x\in S$ then $f(x)>0$ by Sign Preserving property of continuous function there is a $\delta>0$ such that $f(x)>0\forall x\in (x-\delta,x+\delta)$
so $x\in S\Rightarrow \exists \delta>0\ni (x-\delta,x+\delta)\subsetneq S$ 
so $x$ is an interior point of $S$. $x$ was chosen arbitrary from $S$
So every point of $S$ is an interior point of $S$. So $S$ is open set.
