Is there a difference between compact and closed?

Off course there is a difference between 'compact' and 'closed', but here I am asking for something deeper. Whether a set in a topological space deserves label 'closed' is somehow depending not only on the set itself but also on its surroundings. Set $F$ can be closed when you look at it as a subset of $A$ while it can loose this label again when it is looked at as a subset of $B$. This can be disturbing. With label 'compact' that problem does not exists. "I am compact" declares the set firmly,.."and nobody can take that from me!" I like that attitude. When I deal with 'closed' then I tend to use 'set' and when I deal with 'compact' then 'space'. The concepts 'compact' and 'closed' are only used here to make myself clear. It is not more than an example. For the rest I rely on your intuition. Is there some mathematical/topological theory in which this distinction is caught?

-
Well, sure. Closedness is a property of sets (and depends on the topology you use) whereas compactness is a property of topological spaces. I don't think there's more to it than this. –  Marek Sep 25 at 5:59
Just to highlight: Consider $\mathbb{R}$ endowed with the standard Euclidean topology. Then, it's a closed set but it's not compact. More generally, compactness intuitively depends on the surroundings of a set, too, but in a more subtle –  triple_sec Sep 25 at 6:13
When I want a lot of views, then from now on I know the key to that: ask something that everybody knows. –  drhab Sep 25 at 6:33

I don't know, if the following is what you are after, but: Compactness is an intrinsic property, that is what you call "nobody can take it from me". We can state it as follows:

Let $X$, $Y$ be topological spaces, $A \subseteq X$, $B \subseteq Y$. Let $f \colon A \to B$ be a homeomorphism, than $A$ is compact iff $B$ is.

Closedness is extrinsic, it depends on the surrounding space (that's why we say $A$ is closed in $X$, not $A$ is closed), that is the above reads for closedness:

Let $X$, $Y$ be topological spaces, $A \subseteq X$, $B \subseteq Y$. Let $f \colon X \to Y$ be a homeomorphism with $f[A] = B$, than $A$ is closed in $X$ iff $B$ is closed in $Y$.

So compactness is preserved by homeomorphisms of the subsets, closedness only by homeomorphisms of the surrounding spaces.

-

As alluded to in the question, if interpreted literally the answer is trivially "yes, there is a difference." However, if we consider locally compact Hausdorff spaces then the answer is "no" in the following sense. Namely, every compact subspace of a Hausdorff space is closed, and on the other hand, every non-compact locally compact Hausdorff space is a non-closed subspace of its one-point compactification (which is a compact Hausdorff space.)

-

Being "closed" is a property of a subset of a topological space, while being "compact" is a property of a topological space itself. While you can talk about a subset of a topological space being compact, this just means that the subspace topology of that set is compact. This, as you said, depends only on the set itself (together with its topology - you can't use topological language without topologies on your sets), while the property of being closed (the complement is open) depends on the topology of the whole space.

For some intuition about why compact subspaces of topological spaces are quite often closed, think about the conditions imposed on the set of open sets in a topological space. Fundamentally, compactness is a finiteness property: it means, in a very precise way, "not too big." However, in a topological space, arbitrary unions of open sets must be open. When we take a union of lots of things that are "not too big," there's no reason to expect the union to share that property. This doesn't mean, however, that no compact sets are also open - for example, in a compact space, the whole space is open, and also compact. This interplay can be interesting to study, and, for "nice" spaces, works out quite well.

Remember - "open" and "closed" are properties of subsets of spaces, while "compact" is a property of entire spaces.

-

A possible way to look at this particular example (the difference between compact spaces and closed sets) is trying to codify the "extrinsicness" by saying that it is preserved under continuous maps. This applies in this case because continuous maps preserve compactness, but obviously continuous maps don't need to preserve closedness since it depends in the ambient space.

This is related to topological invariants, meaning properties which are preserved under homeomorphisms. We can take this approach further by working in a category and asking for properties which are preserved under isomorphisms.

EDIT: I didn't see that my answer is redundant given the answer by martini. I apologize.

-
It is neat to mention the redundancy, but your answer is useful as well. Especially the mentioned link with categories. –  drhab Sep 25 at 6:53
A Tychonoff space $X$ is compact iff for every Hausdorff space $Y$ and every continuous map $f : X \to Y$ then $f(X)$ is closed in $Y$.
The implication is clear since a continuous map sends compact sets on compact sets. Conversely, taking $Y=\beta X$ we deduce that $X$ is closed in its Stone-Čech compactification so $X= \beta X$ is compact.