Why formulate continuity in terms of pre-images instead of image? I wanted to discuss my intuition of why we formulate the concept of continuity in terms of pre-image of open set is open instead of images for example if we consider $f(x) = c$ where $c$ is some constant, then that should be continuous, but if we formulated continuity in terms of images it won't be continuous. Is the reason we do it that way, because pre-images will always guarantee that function in the domain can only have $1$ value?
 A: You can formulate continuity in terms of images. A function $f:X\to Y$ is continuous at a point $x$ if and only if for every neighborhood $U$ of $f(x)$ there exists a neighborhood $V$ of $x$ such that $f(V)\subseteq U$.
A: We do it because it works; we have an idea that some things should be continuous and other things not, and with this definition, they are or are not as desired!
Ultimately, that's what really matters: that the consequences of the definition match whatever notion we're trying to capture.
The definition doesn't have to be intuitive, be natural, or even bear a superficial resemblance to the notion we're trying to capture with the definition; it's good for pedagogy if it does have those qualities, but sometimes we have to settle for what we can get, and sometimes it's better to make the intuition match the definition rather than the other way around.
Although, a lot of times, the definition matches intuition much better than it first appears, and all you need to do is to better understand what the definition is saying. And IMO, most of the time when it doesn't, your intuition is actually about some other notion than the one the definition is meant to capture.
A: It's not nice to formulate it in terms of images. The behavior of images varies wildly between various continuous functions. Take the interval $(-10,10)$ and the functions $f_1(x) = x$ and $f_2(x) = \sin x$. Then the image of $(-10,10)$ under $f_1$ is of course $(-10,10)$, but the image of $(-10,10)$ under $f_2$ is $[-1,1]$. With one function you get an open set, with another you get a closed set. You can of course explore the other cases of half-open/half-closed or other phenomena. You can't make any meaningful statement about images of open sets. You can't even say anything for certain about local behavior (the images of "small" open sets) because there are plentiful locally constant functions.
You might want to flip this on its head then since images of open sets doesn't work: what about images of closed sets? This also doesn't work. Consider $\mathbb{R}$ and the function $f_3(x) = \arctan x$, then the image of $\mathbb{R}$ under $f_3$ is $\left(-\frac{\pi}{2},\frac{\pi}{2}\right)$ which is an open set.
The beauty of pre-images is that the functions we intuitively look at as being continuous have open sets as pre-images of open sets. Perhaps the closest you can get to a statement about images is that continuous functions map compact sets to compact sets, however there are discontinuous functions which also do this: consider $[-1,1]$ and $f_4(x) = 1$ if $x>0$, $f_4(0) = 0$ and $f_4(x) = -1$ if $x<0$. Then $f_4$ maps a compact set to a compact set but it is definitely not continuous in the usual topology.
A: The metric space version makes some sense. In the metric space case, given any ball $B_1$ (perhaps very small) around $f (x)$, there is a ball $B_2$ around $y $ where $f (y) \in B_1$. Informally, you have some perhaps small amount of wiggle room in the domain, given any positive maximum amount of wiggle in the codomain. In this sense "small changes in the domain lead to small changes in the codomain".
It is not so easy to see that this is the right way to generalize, however.
A: Consider $f\colon A\to B$. Changes in the domain "control" what happens to the image, the value of $x\in A$ is "causal" for the value $f(x)\in B$. Therefore you may think that going from domain to image is the natural way to define  continuity.
However, continuity is about how well we can predict the image $f(x)$ if we slightly modify $x$; that is, if only we can keep $x$ "under control" well enough (i.e., keep changes, influences, error, or whatever sufficiently small) then we also keep $f(x)$ under control (i.e., keep its change or error as mall as necessary/desired). In this formulation it still sounds like something going from $A$ to $B$. But if we formulate that "desire" (for a metric space) as $|f(x)-f(x_0)|<\varepsilon$ and the control we impose on the domain side as $|x_0-x|<\delta$, then we arrive exactly at the epsilon-delta-definition: For any $\epsilon>0$ (as desired) there exists (i.e., we can control) $\delta>0$ such that $|x-x_0|<\delta$ implies $|f(x)-f(x_0)|<\varepsilon$.
This is where the change of sides occurs: $\varepsilon$ is picked first and then depending on it we pick $\delta$.
So can we formulate this with images of open sets? No, because while the definition implies something about the image of an open ball, namely  $f(B_\delta(x_0))\subseteq B_\varepsilon(f(x_0))$ (with $B$ denoting open ball), the problem is that $\epsilon$ is given before we pick our $\delta$. That is, we can not cast this into "For every open ball $B_\delta(x_0)$, the image $f(B_\delta(x_0))$ has some property". Rewriting the inclusion as $B_\delta(x_0)\subseteq f^{-1}(B_\varepsilon(x_0))$ we obtain the right formulation, i.e., the pre-image of an open ball (around a point $f(x_0)$ in the image) contains an open ball (around that point $x_0$); and in the generalization: The pre-image of an open set is open.
A: Consider the $\epsilon-\delta$ definition of continuity: 
Let $X$ and $Y$ be metric spaces. A function $f: X \to Y$ is called continuous if for every $x_0 \in X$ and $\epsilon > 0$, there exists $\delta > 0$ such that for all $x$ such that $d(x, x_0) < \delta$ we have $d(f(x), f(x_0)) < \epsilon$. Equivalently, $\forall x \in B(x_0, \delta) \quad f(x) \in B(f(x_0), \epsilon)$.
Notice we picked $\epsilon$ in the range $Y$ first, then found $\delta$ in the domain $X$. This should suggest why we use the pre-image: we have some property in $Y$ and we need it to carry over into $X$.
So why did we pick $\epsilon$ in the range first? It matches our intuition of what "continuous functions" should look like. Here I elaborate on Hagen von Eitzen's answer: $f(x)$ could be wild and change rapidly with small changes in $x$, so it turns out to be easier and mathematically convenient to impose a restriction on $f(x)$ (it has to be within $\epsilon$ of some $f(x_0)$) and carry over the restriction to $x$ than the other way around. (See the accepted answer by Cameron Williams for examples)
A: I realize this is a bit of thread necromancy, but I don't see the harm, and I'm not sure I see this perspective noted in the answers yet.  It's true that defining it in terms of pre-images works, and defining it in terms of images (without changing anything else) doesn't work.  But why doesn't it work?
This puzzled me too, when I first encountered it mumblety-mumble years ago.  The way that I ended up internalizing it is that it's related to the fact that a function has a unique output for each input, but it doesn't have to have a unique input for each output.  Two different inputs can map to the same output.  In some sense, therefore, the output of an input set—its image, in other words—"loses information" about the input set, and therefore (in a non-rigorous sense), the image can't be expected to preserve the topology of its input.
That isn't the case with the pre-image.  It may have multiple "copies," so to speak, of the information in the image—as for example with periodic functions—but each "copy" preserves the topology and corresponds, open set to open set, even for non-periodic functions.
Consider what happens when a continuous function $f:\mathbb{R} \to \mathbb{R}$ does take on the same output for multiple inputs.  So long as $f$ is (strictly) monotonic and continuous, then it will map an open set to an open set; the topology is preserved.  But if it isn't monotonic—if there's a local maximum, say, at $(x_0, f(x_0))$—then the image of some open neighborhood of $x_0$ cannot itself be open, because $f$ has to attain a maximum value of $f(x_0)$ in that neighborhood; it can't attain a maximum of "the largest real value smaller than $f(x_0)$."
Contrast this with the situation of the pre-image.  Because you can't have a single input value map to multiple output values, there's no way for an open set in the co-domain to correspond to a non-open set in the domain; you'd have to have the input "turn back on itself," which it can't do (so long as $f$ is a function).
