Definition of continuity in topological spaces does not seem quite right. Here's how continuity is defined in most standard topology texts

A function from $X$ to $Y$ is continuous iff the inverse image of each open set of $Y$ is open in $X$.

This definition does not quite seem right to me because it assumes that each element of $Y$ has an inverse image in $X$ and the image is unique. Clearly the definition does not quite hold if the function is not bijective. So how does one define continuity for topological functions which are not bijective?
 A: The inverse image of a set $V \subset Y$ under function $f$ is defined as:
$$\{x \in X \mid f(x) \in V\}.$$
This set is defined for any function $f$ from $X$ to $Y$ and any subset $V$ of $Y$.
Furthermore, I will try to give some intuition as to why the definition of continuity is as it is. Consider metric spaces $X$ and $Y$. An open set in a metric space is a set $U$ such that for every $u \in U$, $U$ contains an open ball centered at $u$. That is, no point in $U$ is on the boundary of $U$.
If a function $f$ is continuous and maps $x \in X$ to $y \in Y$, then if $y$ is in an open set $V \subset Y$, and if $B$ is a ball centered at $y$ contained in $U$, changing $x$ slightly enough - say by some amount $\varepsilon$ - should change $f(x)$ slightly enough that $f(x)$ remains in $B$, thereby remaining in $V$. Thus $x$ lies in a ball with radius $\varepsilon$ that gets mapped entirely within $V$. So simply by virtue of $x$ being mapped into $V$, a ball around $x$ is also mapped into $V$. Therefore the inverse image of $V$ under $f$ is open.
Now onto the topological definition of continuous. A topological space differs from a metric space only because a metric space defines open balls, from which one can construct open sets, whereas a topological space just defines the open sets directly. Therefore the above logic applies to topological spaces.
