## finite surjective l.c.i morphism is flat

X,Y are locally Noetherian schemes. f:X-->Y is finite, surjective, and locally complete intersection, i.e., locally it can decompose into regular immersion and smooth morphism. Recall an immersion X-->Y is called a regular immersion at point x if O_{X,x} is O_{Y,y} modulo an ideal generated by a regular sequence. Prove that f is flat. In particular, f will be a simultaneously open and closed morphism.

-
Sorry, very late answer to your comment below: l.c.i implies finite flat dimension essentially because a quotient by a regular sequence has finite flat resolution (the Koszul complex) – Hailong Dao Apr 30 2010 at 0:47
This is worded like a homework problem. – Angelo Jan 15 2012 at 6:25

Work locally, assume that $f: R\to S$ is a local homomorphism. Let $\operatorname{cmd}(R) =\operatorname{dim} R-\operatorname{depth} R$ (this is the so-called Cohen-Macaulay defect of $R$). Claim: $\operatorname{cmd}$ is preserved by l.c.i maps (easy, essentially because both depth and dimension drop by one when you kill a regular element).
Now since the map $\phi: \operatorname{Spec}(S) \to \operatorname{Spec} (R)$ is finite and surjective, $\operatorname{dim} R= \operatorname{dim} S$, which combines with the last claim to show that $\operatorname{depth} R = \operatorname{depth} S$. But since l.c.i also implies finite flat dimension, we have $\operatorname{depth} R -\operatorname{depth} S = pd_RS$, so $S$ is flat over $R$.