I have three symmetric square matrices $M$, $G$, and $S$ with the following properties:
$S$: symmetric and positive semi-definite.
$M$: Fully diagonal with positive entries.
$G$: is a subset of $M$, which means all entries are zero except a few diagonal entries, which have the same value as $M$. ($M_{ii}=G_{ii}$ if $G{ii}\neq0$)
I'm wondering is there any way to diagonalize these three matrices simultaneously?
If they can be simultaneously diagonalized, they must commute (because diagonal matrices commute). Now $(MS - SM)_{ij} = S_{ij} (M_{ii} - M_{jj})$, so in order for $M$ and $S$ to commute, $S_{ij}$ must be $0$ whenever $M_{ii} \ne M_{jj}$. Similarly for $S$ and $G$. If you partition the indices $1 \ldots, n$ (the number of rows/columns of the matrices) into equivalence classes, where $i \sim j$ means $M_{ii} = M_{jj}$ and $G_{ii} = G_{jj}$, then the matrix $S$ is only allowed to have nonzero entries in blocks corresponding to the equivalence classes ($S_{ij} \ne 0 \implies i \sim j$).