When is the diagonal a closed immersion with open image? Let $A$ be a commutative unital $R$-algebra and consider the  multiplication map $m:A\otimes_R A\rightarrow A$ given by $m(a\otimes b) = ab$ with kernel $I$. The map $m$ is surjective, hence the image of $f: \operatorname{Spec}A\rightarrow \operatorname{Spec}A\times\operatorname{Spec}A$ is $V(I)$.

If we assume that $V(I)$ is also open, then is $f$ an open immersion?

As far as I know, an immersion with closed image is a closed immersion, but an immersion with open image maybe not an open immersion?
Thanks.
 A: It's helpful to remember the sheaf-theoretic conditions on immersions: an open immersion $f:Y\to X$ must have that the induced maps $\mathcal{O}_{X,f(y)}\to\mathcal{O}_{Y,y}$ are isomorphisms for all $y\in Y$, while a closed immersion only implies that those maps are surjections. Assuming $f$ is a closed immersion and adding the condition $f(Y)$ open only implies that the kernel of  $\mathcal{O}_{X,f(y)}\to\mathcal{O}_{Y,y}$ is in the nilradical of $\mathcal{O}_{X,f(y)}$, which is not enough to guarantee that we have an open immersion unless $\mathcal{O}_{X,f(y)}$ is reduced for all $y\in Y$.
Here is an explicit example in your specific case. Let $R=k$ be a field and let $A=k[\epsilon]/(\epsilon^2)$. Then $A\otimes_R A\cong k[\epsilon_1,\epsilon_2]/(\epsilon_1^2,\epsilon_2^2)$, so both $\operatorname{Spec} A$ and $\operatorname{Spec} A\otimes_R A$ are single points, and if $\operatorname{Spec} m$ is an open immersion it must be an isomorphism. Hence $m$ should be an isomorphism, but one can immediately see that this is not the case as $1\otimes\epsilon-\epsilon\otimes1$ is in the kernel.
A: I believe the following holds (by an exercise in Atiyah-Macdonald (AM)): Let $B:=A \otimes A$ and let $I:=ker(m)$ be the kernel of the multiplication map.
It follows $V(I) \cup V(I)^c=S:=Spec(B)$. If $V(I)^c=V(J)$ is closed it follows by AM Exercise I.15 that
$$V(I) \cup V(J)= V(I\cap J)=S$$
hence $I \cap J \subseteq \mathfrak{p}$ for all prime ideals $\mathfrak{p}\subseteq B$,
hence $I\cap J \subseteq nil(B)$. Since $V(I) \cap V(J)=V(I+J)=\emptyset$ it follows
$I+J=(1)$ is the unit ideal. Hence if $B$ is a domain it follows $I\cap J =(0)$ and $I+J =(1)$ hence there is by the Chinese remainder theorem an isomorphism
$$ B:=A\otimes A \cong A\otimes A/I \oplus A\otimes A/J \cong A \oplus A\otimes A/J.$$
Hence
$$S:=Spec(A\otimes A) \cong Spec(A) \cup Spec(A\otimes A/J):=S_1 \cup S_2$$
is a disjoint union. It seems the diagonal map $\Delta$ is an open immersion in this case, since $Spec(A)\cong S_1 \subseteq Spec(B)$ is an open subscheme. The two schemes $S_1:=Spec(A),S_2:=Spec(B/J)$ are open and closed in $S$.
Question: "If we assume that $V(I)$ is an open subscheme, then is $f$ an open immersion?"
Answer: If the product $S$ is a reduced scheme it seems the following holds:
Lemma. If $V(I)$ is an open subscheme  it follows the diagonal map $\Delta$ is an open immersion.
Proof.  This holds since $nil(B)=0$ and hence by the above argument it follows the diagonal map $\Delta$  induces an isomorphism between $Spec(A)$ and the image $\Delta(Spec(A))\cong S_1 \subseteq S$.
Example. In general if $S:=Spec(A)$ is a reduced affine scheme and $Z:=V(I)$ is open and closed it follows $V(I)^c=V(J)$ and $I \cap J =(0), I+J=(1)$ hence by the Chinese remainder theorem we get a direct sum decomposition
$$A \cong A/I \oplus A/J$$
and a disjoint union of schemes
$$Spec(A) \cong Spec(A/I) \cup Spec(A/J):=V(I) \cup V(I)^c.$$
Conversely if $A \cong A_1 \oplus A_2$ there are  ideals $I_i\subseteq A$
with $A/I_i \cong A_i$ and $I_1 \cap I_2=(0), I_1+I_2=(1).$ The subschemes $Spec(A_i)\subseteq Spec(A)$ are open and closed.
