I have worked out a solution to exercise 2.15 of Atiyah-Macdonald, which is needed in the solution of 2.3 (see Atiyah-Macdonald 2.3). However, the solution seems overly complicated, and I am not entirely sure about the argument in part 2. Any corrections and/or improvements would be appreciated.
Question:
Let $A, B$ be rings (commutative, with $1$). Let $M$ be a module over $A$ and $P$ be a module over $B.$ Let $N$ be a bimodule over $A$ and $B$; that is, $N$ is simultaneously a module over $A$ and over $B$ and the operations are compatible in the sense that $(ax)b=a(xb)$ for $x\in N, a \in A, b \in B.$
Then $(M \otimes_A N) \otimes_B P \sim M \otimes_A ( N \otimes_B P).$ Here “$\sim$” denotes isomorphism, where both sides are viewed bimodules over $A$ and $B$.
Attempt at solution:
Step 1: For fixed $p \in P,$ define the map $f_p: M \times N \to M \otimes_A (N \otimes_B P)$ which takes $(m, n) \mapsto m \otimes_A (n \otimes_B p).$ It’s easy to see that $f_p$ is $A-$multilinear. Hence it induces a map $f’_p: M \otimes_A N \to M \otimes_A (N \otimes_B P)$ which is a homomorphism of $A-$modules such that $f’_p(m \otimes n) = m \otimes_A (n \otimes_B p)$.
Step 2: Define now $g: (M\otimes_A N) \times P \to M \otimes_A ( N \otimes_B P)$ by $ g(x,y)= f_y’(x).$ We want to show that $g$ is $B-$multilinear.
We show first that $g$ is $B-$multilinear in the first component. Note that an element $x\in M\otimes_A B$ is of the form $x = \sum_1^{n} m_i \otimes_A n_i,$ with the $m_i \in M$ and $n_i \in N.$
Hence, for $\lambda \in B,$ we have $\lambda x_0+ x_1= \lambda \sum_1^{n_0} m^0_i \otimes_A n^0_i + \sum_1^{n_1} m^1_i \otimes_A n^1_i = \sum_1^{n_0} m^0_i \otimes_A \lambda n^0_i + \sum_1^{n_1} m^1_i \otimes_A n^1_i.$
Hence, we have
\begin{align} g(\lambda x_0+x_1, p)&= g( \sum_1^{n_0}(m^0_i \otimes_A \lambda n^0_i) + \sum_1^{n_1}(m^1_i \otimes_A n^1_i) , p) \\ &=\sum_1^{n_0} m^0_i \otimes_A (\lambda n^0_i \otimes_B p) + \sum_1^{n_1} m^1_i \otimes_A (n^1_i \otimes_B p) \\ &=\lambda \sum_1^{n_0} m^0_i \otimes_A (n^0_i \otimes_B p) + \sum_1^{n_1} m^1_i \otimes_A (n^1_i \otimes_B p) \\ &= \lambda g(x_0,p)+ g(x_1,p), \end{align}
where we have used the fact that $g(\cdot,y)=f’_y(\cdot)$ is $A-$linear.
We can show that $g$ is $B-$linear in the second component by a similar argument.
Step 3: To show this is an isomorphism, we construct an inverse mapping by the same procedure.
Here is the fastest proof I can think of. It doesn't use any elements. It is purely functorial (and therefore also works in more general situations).
Let $A$ be a ring (not assumed to be commutative), $M$ a right $A$-module and $N$ a left $A$-module. Then $M \otimes_A N$ is an abelian group which satisfies the universal property $$\hom(M \otimes_A N,T) \cong \hom_A(M,\hom(N,T)).$$ Here, we use the obvious right $A$-module structure on $\hom(N,T)$.
More generally, if $N$ is even a $(A,B)$-bimodule, then $M \otimes_A N$ is a right $B$-module satisfying the universal property $$\hom_B(M \otimes_A N,T) \cong \hom_A(M,\hom_B(N,T)).$$
Now if $P$ is a left $B$-module, it follows
$$\hom((M \otimes_A N) \otimes_B P,-) \cong \hom_B(M \otimes_A N,\hom(P,-)) \cong \hom_A(M,\hom_B(N,\hom(P,-)))$$ $$\cong \hom_A(M,\hom(N \otimes_B P,-)) \cong \hom(M \otimes_A (N \otimes_B P),-).$$
By Yoneda, this means $(M \otimes_A N) \otimes_B P \cong M \otimes_A (N \otimes_B P)$.