If A commutes with both of these matrices, then A must be a scalar multiple of the identity matrix

I am working on the following problem:

Let $$A$$ be a $$4 \times 4$$ matrix with entries in a field of characteristic zero. Suppose that $$A$$ commutes with both $$\begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 2 & 0 & 0\\ 0 & 0 & 3 & 0\\ 0 & 0 & 0 & 4 \end{pmatrix}$$ and $$\begin{pmatrix} 0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0 \end{pmatrix}$$. Prove that $$A$$ is a scalar multiple of the identity matrix.

I know that $$A$$ is a scalar multiple of the identity matrix if and only if $$AB = BA$$ for all other possible $$4 \times 4$$ matrices $$B$$ with entries in a field of characteristic $$0$$. However, I'm struggling with deducing here that $$A$$ commuting with these specific matrices forces $$A$$ to be a scalar multiple of the identity matrix. Does commuting with these specific matrices force $$A$$ to commute with all $$4 \times 4$$ matrices with entries in a field of characteristic $$0$$? If so, how can I deduce this?

Thanks!

$$A$$ commutes with the first matrix implies that $$A$$ preserves its eigenspaces. This implies that $$A(e_i)=c_ie_i,i=1,2,3,4$$.

$$A$$ commutes with the second matrix $$C$$ implies that $$AC(e_1)=A(e_2)=c_2e_2=C(A(e_1)=C(c_1e_1)=c_1e_2$$ implies $$c_1=c_2$$,...

since $$AC(e_2)=CA(e_2), AC(e_3)=CA(e_3)$$ deduce that $$c_1=c_2=c_3=c_4$$.

Hint:

Left multiplication of a square matrix by $$D=$$ first (diagonal) matrix amounts to multiply its rows by the diagonal elements (for this matrix, the first row is multiplied by $$1$$, the second row by $$2$$, &c.). Right multiplication amounts to multiplying its columns by the diagonal elements. If both results are equal, by identification, you can deduce that $$A$$ is a diagonal matrix.

Commutativity of multiplication by the second matrix will then let you show, by identification, that all elements on the diagonal are equal.

Let $$U,V$$ be the $$2$$ given matrices and $$(e_i)_i$$ be the canonical basis of $$K^4$$.

The invariant proper subspaces of $$U$$ are the $$span(\mathcal{B})$$ where $$\mathcal{B}$$ is any proper subset of $$(e_i)_i$$. For every such $$\mathcal{B}$$, $$span(\mathcal{B})$$ is not $$V$$-stable. then $$U,V$$ have no common proper invariant subspaces. According to the Burnside's theorem (*), the algebra generated by $$U,V$$ is whole $$M_4(K)$$; the required result follows. $$\square$$

My answer can be treated as the supplement to the Loup Blanc's answer, I would like to express similar result in a more elementary way.

Denote both mentioned matrices as $$D$$ and $$P$$.

It is easy to check that if $$A$$ commutes with matrices $$D$$ and $$P$$ then it commutes also with any power of matrices $$D$$ and $$P$$, any polynomial of $$D$$ and $$P$$ and generally with any product or linear combination of these matrices.

For powers of $$D$$ we have results

$$D=\text{diag} ( 1 \ \ 2 \ \ 3 \ \ 4) , \\ D^2= \text{diag} ( 1 \ \ 2^2 \ \ 3^2 \ \ 4 ^2) , \\ D^3=\text{diag} ( 1 \ \ 2^3 \ \ 3^3 \ \ 4^3 ) , \\D^4=\text{diag} ( 1 \ \ 2^4 \ \ 3^4 \ \ 4^4)$$

Four vectors formed from diagonal entries are linearly independent (if they are columns of $$4 \times 4$$ matrix then they form Vandermonde matrix) so linear combination of them can generate any diagonal matrix, denote it generally as $${D_i}$$.

On the other hand $$P= \begin{pmatrix} 0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0 \end{pmatrix}$$ is a permutation matrix with its powers

$$P^2= \begin{pmatrix} 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0 \end{pmatrix}, P^3= \begin{pmatrix} 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0 \end{pmatrix}, P^4=I$$.

It is visible that with the expression $$D_0+P D_1 + P^2D_2+P^3D_3$$ we can generate any $$4 \times 4$$ matrix (assuming first we generate appropriate diagonal matrices $$D_i$$) and hence the matrix $$A$$ has to commute with all possible $$4 \times 4$$ matrices.