I am currently working on a proof of the following statement
Let $R$ be a ring and suppose $U \subset R$ is multiplicatively closed. Let $S:=U^{-1}R$. If $P\subset S$ is a prime ideal, then the codimension of $P$ in $S$ is equal to the codimension of $P\cap R$ in $R$.
I am relatively new to dimension theory and I'm currently stuck on proving this claim. So any help/hint will be appreciated.
Also, as a follow up question, if we consider the "converse" case, that is if $Q\subset R$ is prime, then can we say something similar about the codimension of $Q$ and codimension of $QS$ in $S$?
Thanks in advance.
Hints. $P=U^{-1}(P\cap R)$ and the prime ideals contained in $P$ correspond to the prime ideals contained in $P\cap R$ and vice versa.