# If $B\subseteq A$ are free & finite rank $R$-algebras, is $R\to A \otimes_B R$ injective?

(In this question, all rings and algebras are commutative with identity.)

I have a situation that boils down to the following data: a ring $R$, an $R$-algebra $A$ with a subalgebra $B$ such that $A$ and $B$ are free of finite rank as $R$-modules, and an $R$-algebra homomorphism $B\to R$. (Update: If it helps, you can assume that the quotient $R$-module $A/B$ is also free.) In this way, $A$ and $R$ are both $B$-algebras, and we can form their tensor product: $$\begin{array}{ccc}A\otimes_B R & \leftarrow & R\\ \uparrow & & \uparrow \\ A & \leftarrow &B \end{array}$$

The question is:

Must the resulting homomorphism $R\to A\otimes_B R$ be injective?

In other words, if $I$ is the kernel of $B\to R$, must $IA\cap R=0$?

I know that the kernel of $R\to A\otimes_B R = A/IA$ must consist of nilpotents by the following argument: since $A$ is finite as an $R$-module it is integral as an $R$-algebra, and hence also as a $B$-alebra. Since integral extensions have the Lying Over property, the map of schemes $\mathrm{Spec}(A)\to \mathrm{Spec}(B)$ is surjective. Surjectivity is preserved by base extension, so the map of schemes $\mathrm{Spec}(A\otimes_B R) \to \mathrm{Spec}(R)$ is surjective. And a morphism of affine schemes has dense image if and only if the kernel of the corresponding ring homomorphism consists of nilpotents.

So under the weaker assumption that $A$ merely be integral over $R$, I already find that the map $R\to A\otimes_B R$ is injective modulo nilpotents in $R$. Does the extra assumption that $A$ and $B$ be free of finite rank as $R$-modules imply that the kernel is $0$?

Update: Here are a couple of similarly plausible statements with counterexamples, in case it helps find a counterexample to the original question:

(False) Suppose $R$ is a ring, $A$ is an $R$-algebra, and $B\subseteq A$ is a subalgebra of $A$, such that $A$ and $B$ are both free as $R$-modules. Let $B\to R$ be an $R$-algebra homomorphism. Then $R\to A\otimes_B R$ is injective.

A counterexample is given by setting $B=R[x]$ and $A=R[x,x^{-1}]$. If we choose the homomorphism $B\to R$ sending $x\mapsto 0$, then the tensor product $A\otimes_B R$ is the zero ring.

The original question asks whether an example of such $A$ and $B$ exists with $A$ and $B$ free of finite rank as $R$-modules.

(False) Suppose $A$ is a ring and $B$ is a subring of $A$ such that $A$ is finitely generated as a $B$-module. For any $B$-algebra $R$, the homomorphism $R\to A\otimes_B R$ is injective.

Here's a counterexample (due to Hendrik Lenstra): let $A=\mathbb{Z}[x]/(x^2-x)$ and $B=\mathbb{Z}[y]/(y^2-2y)$; the homomorphism $B\to A: y\mapsto 2x$ is injective. However, tensoring with the $B$-algebra $B/(2)$, we obtain a non-injective map $B/(2)\to A/(2): y\mapsto 0$. The original question asks for an example in which the map $B\to R$ is a section of an $R$-algebra structure on $B$ making $B$ and $A$ free of finite rank as $R$-modules.

Update: For a positive result (also from conversations with Hendrik Lenstra), the statement holds if $B$ is generate by a single element as an $R$-module, which (since $B$ is also free of finite rank as an $R$-module) implies that $B$ is of the form $R[x]/(f(x))$ with $f$ monic.

The argument goes like this: Say $f$ has degree $n$ and the homomorphism $B\cong R[x]/(f(x))\to R$ sends $x$ to $r$; then by choosing the generator $x-r$ of $B$ instead of $x$, we may assume $x\mapsto 0$. In that case, the kernel $I$ of $B\to R$ is $(x)$, so we find that $f(x)\in R[x]$ is divisible by $x$; write it as $f(x) = x\cdot g(x)$ for some monic polynomial $g$ of degree $n-1$. Now suppose we have something in $IA\cap R$: it will be an equation $xa = s$ for some $a\in A$ and $s\in R$. Multiplying both sides by $g(x)$, we obtain $s\cdot g(x) = xg(x) a = f(x) a = 0$ in $A$, since $f(x)=0$ in $B$. But $s\cdot g(x)=0$ is an $R$-linear relation among $\{1,x,\dots,x^{n-1}\}$, which form an $R$-basis of $B$, so all the coefficients must be zero. But $g$ is monic, so the coefficient of $x^{n-1}$ in $s\cdot g(x)$ is $s$, so $s=0$. Thus $IA\cap R=0$, so $R\to A/IA \cong A\otimes_B R$ is injective.

However, finite algebras are generally not monogenic, so there may still be counterexamples.

Let $k$ be a field and $R=k[t]/(t^2)$. Define $B = R[x,y]/(x^2,xy,y^2)$ and $A =R[x]/(x^2) \times R[y]/(y^2)$; the injection $B\hookrightarrow A$ sends $x\mapsto(x,0)$ and $y\mapsto(0,y)$. Then $B$ and $A$ are free $R$-modules of rank $3$ and $4$, but if we define a homomorphism $B\to R$ sending $x\mapsto t$ and $y\mapsto t$, the map $R\to A\otimes_B R$ is not injective.
Indeed, let $I=(x-t,y-t)\subset B$ be the kernel of $B\to R$, so that $R = B/I$ and $A\otimes_B R = A/IA$. Then to check whether $R\to A/IA$ is injective, we need only check whether $R\cap IA = 0$ inside $A$. But $IA$ contains $(x-t)(0,1) = (0,-t)$ and $(y-t)(1,0)=(-t,0)$, so also contains their sum $(-t,-t)=-t$ which is a nonzero element of $R$.