My textbook says that if $f: R \rightarrow S$ is a ring homomorphism, where $R$ and S are commutative; then if $P$ is a maximal ideal of $S$, it might not necessarily be a maximal ideal of $R$. A counterexample is if we choose $R = \Bbb{Z}$, $S = \Bbb{Q}$, and let $f$ be the inclusion map.
However, when I try to "prove" that the preimage must also be maximal, my proof makes sense to me. I know that I must be doing something wrong in the proof, but I couldn't really see it.
"Proof"
Define $g: S \rightarrow S/P$ with kernel $P$. Let $h = g \circ f: R \rightarrow S/P$. Since $h$ is a ring homomorphism, the kernel is an ideal of $R$. Also, from the first isomorphism theorem, we know that $R/\ker(h) \cong S/P$. Since $P$ is a maximal ideal of $S$, we know that $S/P$ is a field. Since $R/\ker(h)$ is isomorphic to $S/P$, it must also be a field, which implies that the kernel of $R$ (which is the preimage of $P$) is a maximal ideal of $R$.
Can anybody tell me where I went wrong in this proof?
Thank you in advance
To remove this from the unanswered queue, I am copying the comment of Tobias Kildetoft above.