I'm following the proof on Shafarevich's book Basic Algebraic Geometry I of this theorem
Theorem 2.10 An irreducible subvariety $Y ⊂ X$ of codimension 1 has a local equation in a neighbourhood of any nonsingular point $x ∈ X$.
Another way of stating this is that the image of the ideal $I(Y)$ in the local ring $\mathcal{O}_{X,x}$ is principal.
The proof is reduced to the case in which $X$ is affine and the first part proceed as follows:
Let $f \in \mathcal{O}_{X,x}$ be any function that vanishes on $Y$. Factorise $f$ into prime factors in $\mathcal{O}_{X,x}$. By the irreducibility of $Y$ , one factor must also vanish on $Y$ . We denote this by $g$, and prove that it is a local equation of $Y$ . Replacing $X$ by a smaller affine neighbourhood of $x$, we can assume that $g$ is regular on $X$. Since $V (g) ⊃ Y$ , and both are codimension 1 subvarieties, we have $V (g) = Y \cup Y'$. If $x \in Y'$ there exist functions $h$ and $h'$ such that $hh' = 0$ on $V (g)$, but neither $h$ nor $h'$ are $0$ on $V (g)$. [...]
I'm failing to see where $h$ and $h'$ are coming from and how they depend on the assumption that $x \in Y'$. How would I define them?