Let $f:X \rightarrow Y $ be a morphism of locally Noetherian schemes. Let $Z$ be a closed subscheme of $X$ and suppose that there exists a point $y \in Y$ such that $Z_y=X_y$ as schemes. Show that if $Z$ is flat over $Y$ at $z \in X_y$ , then $Z$ is equal to $X$ in a open neighborhood of $z$.
The problem is from Liu's book and he tells me to use the following, but I can't seem to put it together
1. Use : Let $A \rightarrow B$ be a ring homomorphism and $J$ an ideal such that $B/J$ is flat over $A$. Then for any ideal $I$ of $A$, we have $IB \cap J = IJ$.
2. Use Nakayama's lemma.