Step 1: Statement (A).
If \( P^{-1} X P \) is diagonal for some invertible matrix \( P \), this means that \( X \) is diagonalizable. The columns of \( P \) form a basis of eigenvectors for \( X \). Therefore, statement (A) is true.
Step 2: Statement (B).
If \( X \) is diagonal with distinct entries and \( XY = YX \), this does not necessarily imply that \( Y \) is diagonal. For example, a matrix \( Y \) could still commute with a diagonal matrix \( X \) and not be diagonal. Hence, statement (B) is false.
Step 3: Statement (C).
If \( X^2 \) is diagonal, this does not imply that \( X \) is diagonal. For instance, if \( X \) is a non-diagonal matrix with off-diagonal entries that square to give a diagonal matrix, statement (C) is false.
Step 4: Statement (D).
If \( X \) is diagonal and commutes with all matrices \( Y \), then \( X \) must be a scalar matrix, i.e., \( X = \lambda I \), where \( I \) is the identity matrix and \( \lambda \) is a scalar. This is true because only scalar matrices commute with all other matrices. Hence, statement (D) is true.
Step 5: Conclusion.
Thus, the correct answers are (A), (B), and (D).