Canonical map $R/(I\cap J)\rightarrow R/I\times _{R/(I+J)} R/J$ is an isomorphism

From this MSE question I understand the canonical map $R/(I\cap J)\rightarrow R/I\times _{R/(I+J)} R/J$ is an isomorphism for $R$ a commutative ring and $I,J$ ideals.

I tried proving this directly and I got stuck.

My attempt: The canonical map is given by $r+I\cap J\mapsto (r+I,r+J)$. We need to construct an inverse. Given $(r+I,s+J)\in R/I\times _{R/(I+J)} R/J$, we know $r+I+J=s+J+I$, so they represent the same coset in $R/(I+J)$. Hence $s=r+k$ for some $k\in I+J$. So we can rewrite our arbitrary element $(r+I,s+J)$ in the pullback as $(r+I,r+k+J)$. Now map this pair to $r+I\cap J$.

This is a left inverse because $r+I\cap J\mapsto (r+I,r+J)\mapsto r+I\cap J$ is obviously the identity. It is not a right inverse because $(r+I,s+J)=(r+I,r+k+J)\mapsto r+I\cap J\mapsto (r+I,r+J)$ is not the identity.


Your map $(r+I,s+J)\mapsto r+I\cap J$ is not well defined. Instead, you should write $r+i=s+j$ with $i\in I$ and $j\in J$ (which is possible because $r+I+J=s+I+J$), and consider the map $(r+I,s+J)\mapsto (r+i)+I\cap J=(s+j)+I \cap J$.

Now you should check carefully that this map is well defined, in other words, that $(r+i+I\cap J)$ does not depends on the choices of $r$ and $i$.

Then show that this map is inverse to the canonical projection.