Be $D$ a division ring. Consider the map
\begin{eqnarray*} f : D &\rightarrow &\text{Mat}_n(D) \\ \lambda &\mapsto &\lambda I \end{eqnarray*}
As $f$ is injective, this induces the isomorphism
\begin{eqnarray*} \bar{f} : D = D/\ker f &\tilde\longrightarrow &f[\text{Mat}_n(D)] = Z(\text{Mat}_n(D)). \end{eqnarray*}
However, according to the exercise, we should have $Z(D) \cong Z(\text{Mat}_n(D))$!
This seems to only be the case then if $D$ is a field. What am I missing?
For $\lambda \in D$, if $\lambda I \in Z(M_n(D))$, then $\lambda \in Z(D)$. Indeed if $\mu\in D$, then $\mu I$ commutes with $\lambda I$, so $\mu$ commutes with $\lambda$