Problem Statement: Suppose that the matrix $M \in \mathbb{R}^{N \times N}$ has the following decomposition:
$M=D^TGD$,
where $D \in \mathbb{R}^{N \times N}$ and $G \in \mathbb{R}^{N \times N}$.
What are the conditions on $G$ such that $M$ is positive semidefinite?
Solution attempt:
It seems that $M$ is positive semidefinite if $G$ is a diagonal matrix with nonnegative entries along the diagonal. Is there a more general statement that can be made regarding the form of $G$?
Is it useful to decompose $G$ as $G=X\Lambda X^{-1}$, where $\Lambda$ is a diagonal matrix containing the eigenvalues of $G$ and $X$ is a matrix whose columns are the eigenvectors of $G$?
Based on this question: Show that $A$ is positive semidefinite given $(B^TAB)$ is positive semidefinite and $B$ is invertible, is it sufficient that $G$ be positive semidefinite? Note here that I am interested in the case where $D$ is not invertible.
It is indeed sufficient that $G$ is positive semidefinite.
First, If $G$ is positive semidefinite, then it is by definition symmetric. Thus $$M^T = (D^TGD)^T = D^TG^T(D^T)^T = D^TG^D = M \tag 1$$ thus $M$ also is symmetric.
Second, for any vector $v$ define $w=Dv$. Then we have $$v^TMv = v^TD^TGDv = (Dv)^TG(Dv) = w^TGw \ge 0 \tag 2$$ since $G$ is positive semidefinite. Note that if $D$ is not invertible, $w$ may be the zero vector; however this is not a problem because $0^TM0 = 0$, which is explicitly allowed (OTOH for this reason $G$ being positive definite would not be sufficient for $M$ being positive definite).
(1) and (2) together mean that $M$ is positive semidefinite.
Note however that this is in general not a necessary condition. For example, consider $$G = \pmatrix{1&0\\0&-1}, D=\pmatrix{1&0\\0&0}$$ Clearly $G$ is not positive semidefinite in this case, but $M = D^TGD = D$ is positive semidefinite. As the answer you linked to shows, it is however necessary in the case that $D$ is invertible.