I came up with the following intuition about a question. Let $R$ be a commutative ring and let $a,b \in R$. I consider the ideal $I=(a,b)$ and I wonder if the ring $R/(a,b)R$ is isomorphic to the ring $(R/(a)R)/((\bar{b})(R/(a)R))$.
Basically, the questions is if I can compute the quotient in two steps: first I quotient $R$ by the principal ideal generated by $a$ and then I quotient that ring by the principal ideal generated by the class of $b$ in $R/(a)$.
Notation: $\bar{f}$ denotes the class in $R/(a)$ and $\tilde{f}$ denotes the class in $R/(a,b)$.
I tried to prove it myself using the following argument but my teacher argued that this was incorrect with basically no discussion. Can you tell why is it wrong? (if so)
I consider the projection map $\pi:R/(a) \rightarrow R/(a,b)$. It is well defined and is surjective because $(a) \subset (a,b)$. Let $f\in R$ be such that $\bar{f} \in \ker{\pi}$, so $\pi(\bar{f})=\tilde{f} = \tilde{0}$ so there exist $m,n \in R$ such that $ma+nb=f$ so $\bar{f}=\overline{ma+nb}=\overline{nb}$ so this proves that $\bar{f} \in (b)(R/(a))$ (the principal ideal generated by the class of $b$. And we conclude by the 1st isomorphism theorem.
Edit: As noted by @Eric. I missed proving that $(\bar{b)(R/(a))} \subset \ker{\pi}$. So let $ \bar{f} \in (\bar{b})(R/(a))$, then we have $\bar{f}=\bar{b} \bar{m}$ but then $\pi(\bar{f})=\pi(\bar{b}) \cdot \pi(\bar{m})= \tilde{0} \cdot \tilde{m}= \tilde{0}$.
You're right! A small nitpick in your proof: as stated, you've only shown that $\ker\pi\subseteq(b)(R/(a))$, not the reverse inclusion. However, the reverse inclusion is easy to show by a similar argument.
More generally, by a similar argument, you can show that if $I$ and $J$ are ideals, then there is a canonical isomorphism between $R/(I+J)$ and $(R/I)/\bar{J}$, where $\bar{J}$ is the image of $J$ under the quotient map $R\to R/I$.