Inverse image of continuous function

All the sets below are metric spaces.

If for every open set $U\subset Y$ there exists an open set $V\subset X$ such that $f^{-1}(U)=D\cap V$ then the function $f: D\rightarrow Y$ is continuous.

Another fact that I often use and don't know how to prove. Perhaps I should always start from proofs...

-
Are you starting with a function $f:X\to Y$ and then under the given assumptions concluding that its restriction $f|_D$ to $D\subset X$ is continuous? And shouldn't the statement be that for every open subset $U$ of $Y$, its preimage under $f$ is an open subset of $D$ (and that $D$ is also open)? –  bgins Jun 3 '12 at 19:43
What is D and X? Is $X$ is a topological space and $D \subset X$ with the subset topology? –  William Jun 3 '12 at 19:47
How do you define continuity in the first place? –  copper.hat Jun 3 '12 at 19:50

You mean for the set $U$ to be open.

A function between topological spaces is continuous iff the inverse image of every open set is open. If $D$ is a subset of a topological space $X$ then the open sets of $D$ in the subspace topology are exactly the sets of the form $D \cap V$ where $V$ is open in $X$. So a function $f:D\rightarrow Y$ is continuous iff for all $U$ open in $Y$, there exists $V$ open in $X$ such that $f^{-1}(U)=D\cap V$.

If you are only familiar with metric spaces and would like to understand why a function is continuous iff the inverse image of every open set is open, think about the standard definition of continuous functions on metric spaces.
A function $f:X\rightarrow Y$ between two metric spaces is continuous if and only if for all $x\in X$ and $\epsilon >0$ there exists $\delta >0$ s.t. if $x'\in X$ and $\text{d}(x,x') <\delta$ then $\text{d}(f(x),f(x')) <\epsilon$.

This basically means that for each $x$, the inverse image of every epsilon ball around $f(x)$ contains some delta ball around $x$.

If we know that the inverse image of every open set is open, then the inverse images of epsilon balls must be open. Choose a point $x\in X$. Let $\epsilon >0$ and let $B_\epsilon$ be a ball of radius $\epsilon$ and center $f(x)$. Then $f^{-1}(B_\epsilon)$ contains $x$, and is open. Thus $x$ will be an interior point of $f^{-1}(B_\epsilon)$. This means that there is some small delta ball around $x$ that is entirely contained in $f^{-1}(B_\epsilon)$. From here you can see that the definition of continuity is satisfied.

You can also check that if $D$ is a subset of $X$, and we view $D$ as a metric space with metric inherited from $X$, then $D$ has the subspace topology.

-

Assuming that $f : X \rightarrow Y$ where $X$ and $Y$ are topological spaces and $D \subset X$ is given the subset topology. If $U$ is open, then $f^{-1}(U) = D \cap V$ just implies that $f^{-1}(U)$ is open in the subset topology of $D$. Recall that all open subset of $D$ (in the subset topology) takes the form $D \cap V$ for some open set $V$ of $X$. This is the just the definition of continuity for $f : D \rightarrow Y$, i.e. the inverse image of every open subset of $Y$ is an open subset of $D$.

-
To translate this into the language of metric spaces, the "subset topology" refers to the result that the intersection of a metric space $D\ss X$ and any set open in $X$ is open in $D$, and that any open set of $D$ is the intersection of $D$ and an open set in $X$. From there, as the others have said, you use the result that the inverse images of open sets are open sets. None of this demands that you need to restrict the domain of a function that starts in $X$, although you can if you'd like. –  Eric Stucky Jun 3 '12 at 20:05