I know that in an UFD, each minimal prime will be principal. So, let $k[x_1,...,x_n]$ be a polynomial ring over a field. Further, set $S =k[x_1,..,x_n]/P$, and suppose that this is an UFD. A subvariety $V(Q)$ of $V(P)$ of codimension one will give that $Q$ is a minimal prime in $S$, and thus principal there. What does this imply for the generators of the subvariety? Must it be defined by one equation, and so why? My thinking so far is that: Say that $Q$ is minimal in $S$. This corresponds to a prime ideal $R$ of $k[x_1,..,x_n]$ properly containing $P$ and so that there are no principal ideals "in between" them. So, if the zero-set was generated by more, I suppose we should find a contradiction but I'm not sure how to find one. Any ideas, and in general, what's the connection between codimension of something, and how many equations that generate it?
Edit: Here's my current thinking. If we have $V(Q) < V(P)$, where $V(Q)$ has codimension 1, we have that $I(V(Q))$ will be prime, and we have that for every element $f$ in $I(V(Q))$ that $V(Q) < V(f)$, where $V(Q)$ is a component of $V(f)$. But then I'm kinda stuck.