Rudin's definition of continuity in terms of pre-images (inverse images). Is this simple function continuous or not?

1.6k Views Asked by At

I am reading W. Rudins book ``Principles of Mathematical Analysis''. I find it hard to exactly understand the definition of continuity in terms of pre-images. Rudins definition of a continuous function is:

A mapping $f$ of a metric space $X$ into a metric space $Y$ is continuous on $X$ if and only $f^{-1}\left(V\right)$ is open in $X$ for every open set $V$ in $Y$.

So lets say I define the simple linear function $f(x)=x$ as a function $f:\left[0,1\right]\rightarrow\mathbb{R}$. Personally I believe this function to be continuous, but I cannot make it fit with the definition.

If I choose the open set as, say, $V=\left(-1,2\right)$, I find the pre-image to be $f^{-1}\left(V\right)=\left\{ \left.x\in X\right|f\left(x\right)\in V\right\} =\left[0,1\right]$, hence a closed set. The definition then tells me the function is not continuous.

What is wrong?