as an ideal of .
Now we claim the following facts.
So the subset is a -subalgebra of containing the generators of . Thus we have .
is a decomposition of the scheme into two Zariski open set. Thus we have
We then note in particular that has a distinguished global section (``the identity'') defined by
Then we see that
So we have
as required.
Let us now prove the ``only if'' part. The question is local on and on . So we may assume that is of the form
where is a finitely generated algebra over . Let be the ideal of definition of the diagonal. The previous Lemma tells us that is finitely generated over . By the assumption we have
Now we use the Nakayama's lemma (theorem below) to find an element such that
Then it is easy to see that is an idempotent and that is its range.