Let $f: \mathrm{Spec}(R) \to \mathrm{Spec}(A)$ be a closed embedding of affine Noetherian schemes, given by the ideal $I = \mathrm{ker}(A \twoheadrightarrow R)$. If $I = I^2$, then it's not too hard to show that $I = (e)$ for some idempotent element $e \in A$. This gives a partition of $\mathrm{Spec}(A)$ into disjoint closed subsets $V(e)$ and $V(1-e)$, so $V(I) = V(e)$ is clopen. Conversely, if $im(f) =V(I)$ is open, then we can find an idempotent element $e \in A$ such that $V(e) = V(I)$. To show that $I=I^2$, I want to conclude that $I = (e)$, but a priori we only know their radicals are equal. Is this even true? More generally, is it true that $I = I^2$?
What I'm actually trying to prove is that a finite flat group scheme is etale iff the unit section is open.
Suppose $\text{Spec}(A/I)\rightarrow \text{Spec}(A)$ is an open immersion. Then in particular it is flat, hence $A\rightarrow A/I$ is a flat morphism.
Hence we have an exact sequence $$0\rightarrow I \otimes_A A/I\rightarrow A\otimes_A A/I\rightarrow A/I\otimes_A A/I \rightarrow 0$$ That reduces to $$0\rightarrow I/I^2\rightarrow A/I\overset{\text{id}}{\rightarrow} A/I \rightarrow 0$$ So $I=I^2$ and as $I$ is finitely generated (because $A$ is noetherian) we get $I=(e)$ with $e^2=e$ (as discussed in here).
For the converse it is not enough to show that $\text{Im}(f)$ is open to conclude that $f$ is an open immersion. There are some immersions with open image that are not open immersions (for example $X_\text{red} \rightarrow X$). But the result is still true because you can prove that $A/(e)\cong A_{(1-e)}$ when $e$ is idempotent and a localization correspond to an open immersion.