Let $A,A_1,A_2,\dotsc,A_k$ be rings such that $A \simeq A_1 \times A_2 \times \cdots \times A_k$. Show that $$M_n(A) \simeq M_n(A_1) \times M_n(A_2) \times \cdots \times M_n(A_k)$$ for $n \geq 1$.
I tried to prove this from the definition of ring isomorphism. Since $A$ is isomorphic to $A_1 \times A_2 \times \cdots \times A_k$ There is a isomorphism $$g:A \to \times_{i=1}^kA_i$$ defined by $g(a) = (a_1,a_2,\dotsc,a_k)$ for all $a \in A$ and $a_i \in A_i$ for all $i = 1, \dotsc,k$ (i am not entirely sure that the definition of the function is the right one). I tried to define a function $f$ from $M_n(A)$ to $\times_{i=1}^k M_n(A_i)$ considering the function $g$ but I don't know how to define it to prove that it is an isomorphism. I think the idea is to use the function $g$ to transform the entries of a matrix M of order $n \geq 1$ that are elements of the ring $A$ to the rest of the rings in my collection. However it is difficult to do it because I will have a k-upla where I think that in each entry I will have a resulting matrix by transforming the initial matrix M.
The proof can be written down for any $k \geq 0$, but it suffices to consider the case $k=2$ (at least in the finite case that has been asked here), and in any case once this case has been understood, the general case works exactly in the same way.
Let me start with a general remark: many authors define a ring isomorphism to be a bijective ring homomorphism. This is not the "correct" definition, both from the perspective of universal algebra and category theory, but also from a practical perspective. A ring isomorphism is (should be), by definition, a homomorphism of rings which has an inverse ring homomorphism. It is a lemma that the homomorphism property of the inverse map is automatic, i.e., it suffices to check that the map (a) is a homomorphism, (b) its underlying map of sets has an inverse. I will use this below. Now, even though a map of sets has an inverse iff it is bijective, this is not always the best way to check invertibility, especially when it comes to such formal isomorphisms as in the present question.
Assume $A \cong A_1 \times A_2$. Then $M_n(A) \cong M_n(A_1 \times A_2)$. In fact, any isomorphism $\varphi : A \to B$ induces an isomorphism $M_n(\varphi) : M_n(A) \to M_n(B)$ defined by $M_n(\varphi)(X)_{ij} := \varphi(X_{ij})$ for all $X \in M_n(A)$. This is the only definition that makes sense and it works (this is a general principle here). $M_n(\varphi)$ is an isomorphism since you can write down an inverse, namely $M_n(\varphi^{-1})$.
So we only need to verify $M_n(A_1 \times A_2) \cong M_n(A_1) \times M_n(A_2)$.
There is a quite evident map
$\alpha : M_n(A_1 \times A_2) \to M_n(A_1) \times M_n(A_2).$
Namely, any $n \times n$-matrix $X$ over $A_1 \times A_2$ consists of entries $X_{ij} \in A_1 \times A_2$ for all $ 1 \leq i,j \leq n$, each of which consist of entries $X_{ij} = (Y_{ij},Z_{ij})$ with $Y_{ij} \in A_1$ and $Z_{ij} \in A_2$. But then we get matrices $Y \in M_n(A_1)$, $Z \in M_n(A_2)$, hence an element $(Y,Z) \in M_n(A_1) \times M_n(A_2)$.
A bit more formally, we define:
$\alpha(X) := \bigl((p_1(X_{ij}))_{i,j},(p_2(X_{ij}))_{i,j}\bigr)$
where $p_i : A_1 \times A_2 \to A_i$ are the projections. This describes a map $\alpha$. You can verify directly that $\alpha$ is a homomorphism, just use the definition of $\alpha$, the definition of the matrix operations and that $p_1,p_2$ are homomorphisms of rings.
To show that $\alpha$ is an isomorphism, we need to find an inverse map. Again, there is only one reasonable definition. To construct
$\beta : M_n(A_1) \times M_n(A_2) \to M_n(A_1 \times A_2),$
we start with a pair of matrices, which consist of entries etc. The result is:
$\beta((Y,Z)) := ((Y_{ij},Z_{ij}))_{i,j}$
for all $Y \in M_n(A_1)$, $Z \in M_n(A_2)$.
It is then straight forward to calculate (just by using the definitions) that $\alpha \circ \beta = \mathrm{id}$ and $\beta \circ \alpha = \mathrm{id}$.