What is wrong with my proof that $f^{-1}(S)$ is open? 
Let $X$ and $Y$ be metric spaces, $f: X \to Y$ is continuous, $S \subset Y$, and $S$ open. Prove that $f^{-1}(S)$ is open, where $f^{-1}(S) = \{x \in X : f(x) \in S\}$.

If $x \in f^{-1}(S)$, then $f(x) \in S$ and since $S$ is open, there exists a $\epsilon > 0$ such that for all $y \in X$, $d(f(x), f(y)) < \epsilon$, $f(y) \in S$. Since $f$ is continuous, we can find a $\delta > 0$ such that $d(x, y) < \delta$ implies $d(f(x), f(y)) < \epsilon$. Thus $d(x, y) < \delta$ implies that $f(y) \in S$, so $y \in f^{-1}(S)$. Therefore $f^{-1}(S)$ is open.
This was marked incorrect on my exam, and now that I read over it, I'm not sure it makes any sense. I think I am having trouble integrating the concept of openness with the definition of continuity, because an open ball is a set of elements and continuity is just comparing different elements using metrics.
 A: This sentence:

since $S$ is open, there exists a $\epsilon > 0$ such that for all $y \in X$, $d(f(x),f(y))<\epsilon$, $f(y) \in S$

doesn't make sense (what is "$f(y) \in S$" stand for, a conclusion or a condition on $y$?) and makes statements about $f$ while claiming the justification is the openness of $S$, so it's certainly not true without a condition on $f$ and you would need to prove this fact from that condition.
Edit: On second thought, I think there is a way to interpret that sentence such that it's correct and your proof is correct.  What I will say though is that as a teacher I probably still wouldn't give you points back.  Remember that the point of writing proofs is to communicate mathematics to others.  If you write in a way that can be easily misinterpreted as wrong then you aren't communicating correctly.  In the future you should make sure you write out your "such that's" instead of using commas and make sure you use definitions (like the openness of $S$) directly, instead of skipping straight to a consequence of that definition (which is what, upon reflection, I think you're doing).
A: Marked incorrect? Doesn't make any sense?  I think you got the spirit of the proof down.  Did you not receive any points?  If so, I would defend my answer to the professor.  My proof is as follows:
Let $x \in f^{-1}(S)$.  We want to find some $\delta > 0$ such that $B(x, \delta) \subseteq f^{-1}(S)$, and this will show $f^{-1}(S)$ is open.
But $x \in f^{-1}(S)$ implies $f(x) \in S$.  Since $f(x)$ is in $S$ and $S$ is open, there is some $\epsilon > 0$ such that $B(f(x), \epsilon) \subseteq S$.  But since $f$ is continuous, we know there exists a $\delta > 0$ such that $f(B(x, \delta)) \subseteq B(f(x), \epsilon)$.  But since $B(f(x), \epsilon) \subseteq S$, this implies $B(x, \delta) \subseteq f^{-1}(S)$.  Thus, we found a $\delta > 0$ such that $B(x, \delta) \subseteq f^{-1}(S)$, and since $x$ was arbitrary, this shows $f^{-1}(S)$ is open.
As you can see, it's very similar in idea to yours.
A: Since $S$ is open, there is $\epsilon>0$ such that $B(f(x),\epsilon)\subset S$ or if $y$ such that $d_Y(f(x),y)<\epsilon$, then $y\in S$. Then by $\epsilon-\delta$ continuity, there is a $\delta$ such that $d_X(x,z)<\delta$, then $d_Y(f(x),f(z))<\epsilon\Rightarrow f(z)\in S\Rightarrow z\in f^{-1}(S)$. Thus, if $d_X(x,z)<\delta$, $z\in f^{-1}(S)$, so $B(x,\delta)\subset f^{-1}(S)$. So $S$ is open.
I don't think you're flat out wrong, but there are a few mistakes in there. Actually, as an edit: I don't think it's entirely fair to mark this incorrect, especially for what is presumably an undergraduate course in analysis using Rudin (based on your tags). Maybe points off, but not incorrect.But what can you do.
