Algebraic vs. Integral Closure of a Ring

Let $R\subseteq S$ be a ring extension. It is true that the set of elements of $S$ that are are integral over $R$ (i.e. satisfy a monic polynomial equation over $R$) is a subring of $S$.

Can anyone provide an example showing that the set of elements of $S$ that are merely algebraic over $R$ (i.e. satisfy any polynomial equation over $R$) is not necessarily a subring of $S$?

Thanks.

EDIT: (April 2016) Thanks to Pavel Čoupek for the solution. I have incorporated this result and much more into a homework assignment. See here for the full assignment with solutions: http://www.math.miami.edu/~armstrong/762sp16/762hw3sol.pdf


Solution 1:

At least in the integral domain case, the "algebraic closure" forms a subring as well:

Assume $R \subseteq S$ is an extension of integral domains. Denote by $K, F$ the fraction fields of $R, S$ respectively. Then we have inclusions $R \subseteq S \subseteq F$, $R \subseteq K \subseteq F$. Denote by $B$ the algebraic closure of $K$ in $F$, and by $A$ the "algebraic closure of $R$ in $S$" (i.e. all roots in $S$ of all nonzero polynomials in $R$). The claim is that $B \cap S=A$.

The inclusion $A \subseteq B \cap S$ is obvious because of the inclusion $R[x]\subseteq K[x]$. Take $a \in B \cap S$. Then $f(a)=0$ for some nonzero $f \in K[x]$. Then there is $g \in R[x]$ such that $g(a)=0$ - just multiply all the coefficients of $f$ by their common denominator. Hence $a \in A$, so the inclusion $B \cap S \subseteq A$ holds as well.

Hence, we expressd $A$ as an intersection of two subrings of $F$ - thus, $A$ is a ring as well (subring of $S$).