Composition of finite flat morphisms cancellation Outline/some thoughts: Suppose we have morphisms of schemes
$$
X \overset{f}{\rightarrow} Y \overset{g}{\rightarrow} S
$$
where $f$ is finite, the composition $g \circ f$ is finite, and $S$ is locally Noetherian. Does it follow that $g$ is finite? Is it true that $g$ is at least affine? It's true that the composition of finite morphisms is finite, and if instead we assume $g$ and the composition are both finite then $f$ is finite. Assuming $g$ is affine we can reduce the problem to showing that if
$$
A \overset{\alpha}{\rightarrow} B \overset{\beta}{\rightarrow} C
$$
are morphisms of rings with $A$ Noetherian making $C$ into a f.g. (equiv coherent) $A$-module as well as a f.g. $B$-module, then $B$ is a f.g. $A$-module. Since $A$ is Noetherian $C$ is a Noetherian $A$-module, so $\beta(B)$ is a finite $A$-module, but I can't figure out why $\ker(\beta)$ is a f.g. $A$-module. Actually, it is not necessarily a finite $A$-module, consider for example the maps $k \to k[x] \to k$ fixing $k$ and taking $x \mapsto 0$.
In the above situation, suppose that also $f$ is faithfully flat and $g \circ f$ is flat. Then we can conclude that $g$ is flat. With these added assumptions, can we show that $g$ is finite? Note that the above example is ruled out as $k$ is not flat over $k[x]$.
 A: Here's an example showing that the request for $g$ to be finite or affine is not true. Let $X=S=\Bbb A^1$, and $Y=\Bbb A^1\coprod\Bbb P^1$. Let $f:X\to Y$ be given by the identity morphism on $\Bbb A^1$ and let $g:Y\to S$ be given by the identity morphism on $\Bbb A^1$ and sending $\Bbb P^1$ to $0$. Then $f$ is finite, $g\circ f$ is finite, but $g$ is not finite (indeed, $g$ is not even affine). This shows that some strange stuff can be going on with $g$ which isn't captured by knowing everything about $f$ and $g\circ f$.
Once you require that $f$ is faithfully flat, things get better, mostly due to surjectivity. We use the equivalent definition of a finite morphism as a morphism which is proper and quasi-finite (EGA IV, Part 4, Corollaire 18.12.4).
Proof that $g$ is quasi-finite when $f$ is surjective and $g\circ f$ is finite: let $s\in S$ be a point. We wish to show that $Y_s$ has finitely many points for every $s\in S$. Suppose that there is at least one $s$ where this fails. Then as $f$ is surjective, we have the fiber $X_s$ of $g\circ f$ over $s$ must have at least $|Y_s|$ elements, but this is impossible since $g\circ f$ is finite and thus quasi-finite.
Next, by StacksProject 03GN, if $g$ is separated and of finite type while $f$ is surjective and $g\circ f$ is proper, then $g$ is also proper.
So if one has $f,g\circ f$ finite, one can guarantee $g$ finite if $f$ is surjective and $g$ is separated of finite type.
