Question: Let $f \colon V \rightarrow W$ are linear maps between finite dimensional vector spaces. $f$ is a onto map. Prove that if $U \subset W$ is a subspace with $\text{codim} = 1$, then the inverse image of $U$, $f^{-1}(U)$ also has $\text{codim}=1$ $$f^{-1}(U) := \{v \in V | f(v) \in U\}$$
My opinion: $$\text{codim}(U) = \dim (W) - \dim(U) \Rightarrow \dim(U) = \dim(W) - 1,$$ so $$\dim f^{-1}(U) = 1$$ then $$\text{codim}(f^{-1}(U)) = \dim(V) - \dim(f^{-1}(U)).$$ How to calculate $\dim(V)$?
Follows egreg's idea, I have complete the proof.
Observe $f^{-1}(U) \ne 0$ since $f^{-1}(0) \le f^{-1}(U)$ with $0 \in U$.
For all $\alpha, \beta \in K$, for all $x_1,x_2 \in f^{-1}(U)$ exists $y_1,y_2 \in U$ such that $f(x_1) = y_1, f(x_2) = y_2$. Hence, $f(\alpha x_1 + \beta x_2) = \alpha f(x_1) + \beta f(x_2) = \alpha y_1 + \beta y_2 \in U \Rightarrow \alpha x_1 + \beta x_2 \in f^{-1}(U)$. So $f^{-1}(U)$ is a subspace of $V$.
Consider $f|_{f^{-1}(U)} \colon f^{-1}(U) \rightarrow U$ is surjective. We have $\ker(f|_{f^{-1}(U)}) = \ker f = f^{-1}(0)$, by the First Isomorphism theorem we have $f/\ker f \cong 0 \Rightarrow \dim(U) = \dim(f^{-1}(U)) - \dim(\ker f)$.
Since $f$ is surjective then $\dim(V) = \dim(W) + \dim(\ker f)$. Therefore $\text{codim}(f^{-1}(U)) = \dim V - \dim (f^{-1}(U)) = \dim(W) - \dim(U)$. Moreover, by the hypothesis: $\text{codim}(U) = \dim(W) - \dim(U) = 1$ implies $\text{codim}(f^{-1}(U)) = 1$. So $f^{-1}(U)$ is a subspace has $\text{codim} = 1$ in V.
Please check my proof. Thank all!
A subspace $U \neq W$ of $W$ has co-dimension $1$ iff $x,y \in U$ implies $x-ay \in U$ for some scalar $a$. In this case the fact that $f$ is onto is required only to say that $f^{-1}(U) \neq V$. [ $f^{-1}(U) = V$ implies $U=f(f^{-1})(U)= f(V)=W$]. So we only have to observe that $x,y \in f^{-1}(U)$ implies $f(x),f(y) \in U$ which implies $f(x)-af(y) \in U$ for some scalar $a$; so $x-ay \in f^{-1}(U)$.