Can transcedence degree be defined for arbitrary ring homomorphism? Fix a homomorphism $f:A\rightarrow B$.
Choose $\{b_1,\dots,b_n\}$, $\{b'_1,\dots,b'_m\}$ subsets of elements in $B$. Suppose that $B$ is algebraic over $f(A)[b_1,\dots,b_n]$ and $\{b_1,\dots,b_n\}$ are algebraically independent over $f(A)$. Suppose that $\{b'_1,\dots,b'_m\}$ satisfies the same condition. Does it imply $m=n$?
I checked the proof for an abstract dependence relation in Jacobson's Basic Algebra II (see 3.6). The condition $x<S<T\Rightarrow x<T$ is not satisfied.
But I cannot find a counter-example. Can anyone help me with that?
 A: This is a sidenote to Sasha's answer. The "yes" part can be proven in a completely elementary way without prime ideals and Krull dimension. Here is a sketch, as I have to prepare a talk for Monday and finish a paper for very soon:

Theorem 1. Let $A$ be a subring of a commutative ring $B$. Let $n$ and $m$ be two distinct nonnegative integers. Assume that $C = A\left[b_1, b_2, ..., b_n\right]$ and $C' = A\left[b'_1, b'_2, ..., b'_m\right]$ be two subrings of $B$ (with all $b_i$ and all $b'_j$ lying in $B$, obviously) such that $b_1$, $b_2$, ..., $b_n$ are algebraically independent over $A$ (that is, $C$ is the polynomial ring in $b_1$, $b_2$, ..., $b_n$ up to isomorphism) and such that $b'_1$, $b'_2$, ..., $b'_m$ are algebraically independent over $A$. Assume that both ring extensions $B / C$ and $B / C'$ are integral. Then, $A$ is the trivial ring (that is, $A=0$).

(This is stated in an unusual form for reasons of constructivism.)
Proof sketch for Theorem 1. Assume WLOG that $n > m$.
Let $B'$ be the $A$-subalgebra of $B$ generated by the $b_i$ and the $b_j'$. Then, $A$, $C$ and $C'$ are subrings of $B'$. Moreover, the ring extension $B' / C$ is integral (since a subring of a ring integral over $C$ is still integral over $C$), and similarly the ring extension $B' / C'$ is integral. Hence, we can replace the ring $B$ by $B'$ without anything else changing. So let us WLOG assume that $B = B'$. Thus, $B$ is the $A$-subalgebra of $B$ generated by the $b_i$ and the $b_j'$. Hence, $B$ is a finitely generated $C'$-algebra and integral over $C'$, therefore a finitely generated $C'$-module. Choose any finite generating set of the $C'$-module $B$, and throw in the element $1$. The resulting set is finite and generates $B$ as a $C'$-module. Denote this set by $S$. Let $U$ be the $A$-submodule of $B$ spanned by $S$.
For every polynomial algebra $\mathfrak C$ over $A$ (such as $C$ and $C'$) and any nonnegative integer $i$, let $\mathfrak C_{\leq i}$ denote the $A$-submodule of $\mathfrak C$ consisting of polynomials of degree $\leq i$. Recall that
(1) $\mathfrak C_{\leq i}$ is a free $A$-module of rank $\dbinom{i+r}{r}$, where $r$ is the number of indeterminates of the polynomial algebra $\mathfrak C$.
Also, $\mathfrak C_{\leq a+b} = \mathfrak C_{\leq a} \mathfrak C_{\leq b}$ for all nonnegative integers $a$ and $b$.
We have $C' = \bigcup\limits_{p\geq 0} C'_{\leq p}$ and thus $C' U = \bigcup\limits_{p\geq 0} C'_{\leq p} U$ (since $C'_{\leq 0} \subseteq C'_{\leq 1} \subseteq C'_{\leq 2} \subseteq \cdots$).
Since $B$ is generated by $S$ as a $C'$-module, while $U$ is the $A$-linear span of $S$, we have $B = C' U = \bigcup\limits_{p\geq 0} C'_{\leq p} U$.
Let $\ell = \left|S\right|$ (we know that $S$ is finite) and $S = \left\lbrace s_1, s_2, ..., s_{\ell} \right\rbrace$. Then, the $A$-module $U$ is spanned by the $s_j$ with $j$ ranging over $\left\lbrace 1, 2, ..., \ell \right\rbrace$ (since the $A$-module $U$ is spanned by $S$).
There are only finitely many products $b_i s_j$ with $i \in \left\lbrace 1, 2, ..., n\right\rbrace$ and $j \in \left\lbrace 1, 2, ..., \ell \right\rbrace$, and thus there exists some nonnegative integer $p$ such that these products all lie in $C'_{\leq p} U$ (since $B = \bigcup\limits_{p\geq 0} C'_{\leq p} U$). Fix such a $p$. Then,
(2) $b_i U \subseteq C'_{\leq p} U$ for all $i \in \left\lbrace 1, 2, ..., n\right\rbrace$
(because the $A$-module $U$ is spanned by the $s_j$ with $j$ ranging over $\left\lbrace 1, 2, ..., \ell \right\rbrace$, so that the $A$-module $b_i U$ is spanned by the $b_i s_j$ with $j$ ranging over $\left\lbrace 1, 2, ..., \ell \right\rbrace$).
Now, every nonnegative integer $N$ satisfies
(3) $C_{\leq N} U \subseteq C'_{\leq pN} U$.
Why is this so? Indeed, in order to prove (3), we need to show that $b_{i_1} b_{i_2} ... b_{i_k} U \subseteq C'_{\leq pN} U$ for every $k\leq N$ and any $k$-tuple $\left(i_1,i_2,...,i_k\right) \in \left\lbrace 1,2,...,n\right\rbrace^k$ (because such products $b_{i_1} b_{i_2} ... b_{i_k}$ span $C_{\leq N}$ as an $A$-module). In order to prove this, it is clearly enough to show that $b_{i_1} b_{i_2} ... b_{i_k} U \subseteq C'_{\leq pk} U$ for every $k\leq N$ and any $k$-tuple $\left(i_1,i_2,...,i_k\right) \in \left\lbrace 1,2,...,n\right\rbrace^k$ (because if $k\leq N$, then $pk \leq pN$ an thus $C'_{\leq pk} U \subseteq C'_{\leq pN} U$). This is shown by induction over $k$, using the induction step
$b_{i_1} b_{i_2} ... b_{i_k} U = b_{i_1} b_{i_2} ... b_{i_{k-1}} \underbrace{b_{i_k} U}_{\subseteq C'_{\leq p} U\ \text{(by (2))}} \subseteq b_{i_1} b_{i_2} ... b_{i_{k-1}} C'_{\leq p} U$
$= C'_{\leq p} \underbrace{b_{i_1} b_{i_2} ... b_{i_{k-1}} U}_{\subseteq C'_{\leq p(k-1)} U\ \text{(by induction hypothesis)}} \subseteq \underbrace{C'_{\leq p} C'_{\leq p(k-1)}}_{= C'_{\leq p + p(k-1)} = C'_{\leq pk}} U = C'_{\leq pk} U$.
Armed with (3), we can close in for the kill. Recall that $1 \in S \subseteq U$. Hence, every nonnegative integer $N$ satisfies
(4) $C_{\leq N} \subseteq C_{\leq N} U \subseteq C'_{\leq pN} U$       (by (3)).
Since $C_{\leq N}$ is a free $A$-module of rank $\dbinom{N + n}{n}$ (by (1)), there exists an $A$-module isomorphism from $A^{\dbinom{N + n}{n}}$ to $C_{\leq N}$. Due to (4), this yields that there exists an $A$-module injection from $A^{\dbinom{N + n}{n}}$ to $C'_{\leq pN} U$. Denote this injection by $\phi$.
But $U$ is generated by $S = \left\lbrace s_1, s_2, ..., s_{\ell} \right\rbrace$ as $A$-module. In other words, $U = \sum\limits_{q=1}^{\ell} s_q A$. Hence, $C'_{\leq pN} U = \sum\limits_{q=1}^{\ell} C'_{\leq pN} s_q$ is a quotient of the $A$-module $\bigoplus\limits_{q=1}^{\ell} C'_{\leq pN}$. Since $C'_{\leq pN}$ is a free $A$-module of rank $\dbinom{pN + m}{m}$ (by (1)), the direct sum $\bigoplus\limits_{q=1}^{\ell} C'_{\leq pN}$ is a free $A$-module of rank $\ell \dbinom{pN + m}{m}$. In other words, there exists an $A$-module isomorphism from $A^{\ell \dbinom{pN + m}{m}}$ to the direct sum $\bigoplus\limits_{q=1}^{\ell} C'_{\leq pN}$. Hence, there exists an $A$-module surjection from $A^{\ell \dbinom{pN + m}{m}}$ to the $A$-module $C'_{\leq pN} U$ (because the $A$-module $C'_{\leq pN} U$ is a quotient of this direct sum). Denote this surjection by $\psi$.
The $A$-module $A^{\dbinom{N + n}{n}}$ is free and thus projective. Hence, the $A$-module injection $\phi : A^{\dbinom{N + n}{n}} \to C'_{\leq pN} U$ lifts (through the $A$-module surjection $\psi : A^{\ell \dbinom{pN + m}{m}} \to C'_{\leq pN} U$) to an $A$-module map $\chi : A^{\dbinom{N + n}{n}} \to A^{\ell \dbinom{pN + m}{m}}$ satisfying $\phi = \psi \circ \chi$. This $A$-module map $\chi$ is clearly injective again.
Since $n > m$, the polynomial $\dbinom{x + n}{n} \in \mathbb Q\left[x\right]$ has a higher degree than the polynomial $\ell \dbinom{px + m}{m} \in \mathbb Q\left[x\right]$. Hence, the former polynomial (having a positive leading coefficient) grows faster than the latter. Thus, there exists a nonnegative integer $N$ such that $\dbinom{N + n}{n} > \ell \dbinom{pN + m}{m}$. Fix this $N$.
But there is a well-known fact saying that if $a$ and $b$ are two nonnegative integers satisfying $a > b$, and if there is an injective $A$-module map $\gamma : A^a \to A^b$, then $A$ is the trivial ring. (This is equivalent to theorem (2) in Fred Richman's Nontrivial uses of trivial rings, Proceedings of the American Mathematical Society, vol. 103, no. 4, 1988, pp. 1012-1014, and part of Corollary 5.11 in Keith Conrad's Exterior powers.) Applying this fact to $a = \dbinom{N + n}{n}$, $b = \ell \dbinom{pN + m}{m}$ and $\gamma = \chi$, we conclude that $A$ is the trivial ring, qed. $\blacksquare$
Remark. We can use the above argument to prove a slightly stronger result:

Theorem 2. Let $A$ be a subring of a commutative ring $B$. Let $n$ and $m$ be two nonnegative integers such that $n > m$. Assume that $C = A\left[b_1, b_2, ..., b_n\right]$ and $C' = A\left[b'_1, b'_2, ..., b'_m\right]$ be two subrings of $B$ (with all $b_i$ and all $b'_j$ lying in $B$, obviously) such that $b_1$, $b_2$, ..., $b_n$ are algebraically independent over $A$ (that is, $C$ is the polynomial ring in $b_1$, $b_2$, ..., $b_n$ up to isomorphism). Assume that the ring extension $B / C'$ is integral. Then, $A$ is the trivial ring (that is, $A=0$).

Proof of Theorem 2. This proof is similar to the proof of Theorem 1 above, but the following changes need to be made:


*

*We no longer need to WLOG assume that $n > m$, because $n > m$ is already given by the assumptions.

*Our definition of $\mathfrak{C}_{\leq i}$ no longer gives us $A$-modules $C'_{\leq i}$, because $C'$ is not necessarily a polynomial algebra. We thus need to define $C'_{\leq i}$ differently. For any nonnegative integer $i$, we define $C'_{\leq i}$ to be the $A$-submodule of $C'$ consisting of all elements that can be written as polynomials of degree $\leq i$ in the generators $b'_1, b'_2, \ldots, b'_m$. This $A$-module $C'_{\leq i}$ might not be free, but
(5) it is finitely generated with $\dbinom{i+m}{m}$ generators
(namely, the $\dbinom{i+m}{m}$ monomials of degree $\leq i$ in the generators $b'_1, b'_2, \ldots, b'_m$). We can easily see that $C'_{\leq a+b} = C'_{\leq a} C'_{\leq b}$ for all nonnegative integers $a$ and $b$. Again, $C' = \bigcup\limits_{p\geq 0} C'_{\leq p}$ holds.


*

*Our definition of $\psi$ needs to be modified from the place on where I claim that $C'_{\leq pN}$ is a free $A$-module of rank $\dbinom{pN + m}{m}$. In fact, the $A$-module $C'_{\leq pN}$ is not necessarily free of rank $\dbinom{pN + m}{m}$ anymore. But it is finitely generated with $\dbinom{i+m}{m}$ generators (according to (5)), and thus is a quotient of a free $A$-module of rank $\dbinom{pN + m}{m}$. Hence, the direct sum $\bigoplus\limits_{q=1}^{\ell} C'_{\leq pN}$ is a quotient of a free $A$-module of rank $\ell \dbinom{pN + m}{m}$. In other words, there exists an $A$-module surjection from $A^{\ell \dbinom{pN + m}{m}}$ to the direct sum $\bigoplus\limits_{q=1}^{\ell} C'_{\leq pN}$. Hence, there exists an $A$-module surjection from $A^{\ell \dbinom{pN + m}{m}}$ to the $A$-module $C'_{\leq pN} U$ (because the $A$-module $C'_{\leq pN} U$ is a quotient of this direct sum). Denote this surjection by $\psi$. $\blacksquare$
Theorem 2 has a well-known corollary:

Corollary 3. Let $A$ be a subring of a commutative ring $B$. Let $n$ and $m$ be two nonnegative integers such that $n > m$. Let $b_1, b_2, \ldots, b_n$ be $n$ algebraically independent elements of $B$. Furthermore, let $b'_1, b'_2, \ldots, b'_m$ be $m$ elements of $B$ such that $B = A\left[b'_1, b'_2, ..., b'_m\right]$. Then, $A$ is the trivial ring (that is, $A=0$).

Proof of Corollary 3. Define a subring $C$ of $B$ by $C = A\left[b_1, b_2, ..., b_n\right]$. The ring extension $B / B$ is clearly integral. Hence, Theorem 2 (applied to $C' = B$) yields that $A$ is the trivial ring. This proves Corollary 3. $\blacksquare$
A: The problem is actually the following. Let $A\subset B$ be a subring and suppose that the subrings $C:=A[b_1,\dots,b_n]$ and $C':=A[b'_1,\dots,b'_m]$ of $B$ are the rings of polynomials in the indicated variables such that $B$ is algebraic over both. Does it follow $m=n$ ?
If "$B$ is algebraic over $C$" means
$\forall b\in B\ \ \exists 0\ne g(x)\in C[x]\quad g(b)=0$, the answer is no. Just take $B:=A[b_1,b_2,b']/\text{Ideal}(b_1b',b_2b')$, where $A[b_1,b_2,b']$ is the ring of polynomials in $b_1,b_2,b'$. It is easy to see that the images $C:=A[\overline b_1,\overline b_2]$ and $C':=A[\overline{b'}]$ are rings of polynomials respectively in $\overline b_1,\overline b_2$ and $\overline{b'}$ and that $\overline b_1\overline b_2B\subset C$ and $\overline{b'}B\subset C'$, implying that $B$ is algebraic over both $C$ and $C'$.
If "$B$ is algebraic over $C$" means $B$ is integer over $C$ (i.e., the above polynomial $g$ is always monic), the answer is yes. Here, you will need a bit of knowledge in commutative algebra. (Consult please some book, if necessary, say, "Commutative algebra" by M.F.Atiyah and I.G.Macdonald, the chapter about integer dependence.) You can relpace $B$ by the subring generated by $A$ and $\{b_1,\dots,b_n,b'_1,\dots,b'_m\}$. Let $M\triangleleft_mA$ be a maximal ideal. Then $MC\triangleleft_pC$ is a prime ideal in $C$ and $MC'\triangleleft_pC'$ is a prime ideal in $C'$. By the "going up" theorem, there are prime ideals $P,P'\triangleleft_pB$ such that $C\cap P=MC$ and
$C'\cap P'=MC'$. Taking the quotient $B/(P\cap P')$ in place of $B$, you can assume that $A$ is a field. As $B,C,C'$ are noetherian now, it remains to observe that the Krull dimensions of $B$, $C$, and $C'$ coincide, whereas that of $C$ and $C'$ equals respectively $n$ and $m$.
