Let $\mathcal J$ be an ideal sheaf on a (Noetherian) $Y$-scheme $X$, and let $\mathcal I$ be the unique primary ideal in a primary decomposition $\mathcal J$ corresponding to a minimal associated prime $x \in X$ with the closure $Z$. In this case $\mathcal O\_X/\mathcal I$ puts a canonical scheme structure on $Z$. If $Z\_{red}$ is flat over $Y$, is it true that $Z$ itself is flat over $Y$? Would it help to assume that $X, Y$ are smooth?


(this is a reposting of [this question here](https://math.stackexchange.com/questions/3851603/is-r-i-flat-over-s-if-r-sqrti-is-flat-over-s-and-i-is-primary) which didn't get answers)



flatness and reduction
Your current question as stated is a little weaker than the linked original question. So I will answer both negatively by giving an example of $I$ a prime ideal and $J$ is $I$-primary inside a polynomial ring $R$ over the complex number $k$.


The point is the so-called [miracle flatness](https://en.wikipedia.org/wiki/Local_criterion_for_flatness), (in the graded form for this example to ease notations). Let $S=k[l\_1,...,l\_d]$ where the $l$s form a system of parameters for $R/I$ (and also $R/J$). Then $R/I$ is flat over $S$ iff it is Cohen-Macaulay. So a counter-example exist whenever one can find an example such as $R/I$ is Cohen-Macaulay but $R/J$ is not.


Such examples are easy to find when you simply require $I$ to be the radical of $J$. But if you also want $J$ to be a primary ideal, the most pleasing-looking one is probably:


Let $R=k[a,b,c,x,y,z]$, let $I$ be the $2\times 2$ minors of the matrix $\begin{bmatrix} a & b & c \\ x & y & z\end{bmatrix}$. Let $J=I^2$. Then one can check that $I$ is a prime ideal, $J$ is primary (indeed it agrees with the second symbolic power of $I$), and $R/I$ is Cohen-Macaulay while $R/J$ is not. Note also that $X,Y$, being Spec of polynomial rings $R,S$, are smooth.


