Here is question:
for $A=\begin{pmatrix}-3&-2\\1&0\end{pmatrix}$, find 2×2 symmetrical matrix $Q$ such that $QA+A^TQ=-I$, using diagonalization of $A$.
Simply thinking, If I set all entries of Q as variables, and solving linear equations, then I can find Q. But how can I utilize the diagonalization of A to solving this problem? Eigenvalues of A are -1,-2, and corresponding ordered basis that consists of eigenvectors of A is {(1,-1),(-2,1)}.
The other answer gives one perspective, here's another. Let $P$ be the matrix whose columns are the eigenvectors of $A$, so that $D = P^{-1}AP$ is a diagonal matrix. That is, we'll take $$ D = \pmatrix{-1&0\\0&-2}, \quad P = \pmatrix{1&-2\\-1&1}. $$ Note that $$ QA + A^TQ = -I \implies\\ QA + A^TQ = -I \implies\\ Q(PDP^{-1}) + (PDP^{-1})^TQ = -I \implies\\ QPDP^{-1} + P^{-T}DP^TQ = -I \implies\\ P^T[QPDP^{-1} + P^{-T}DP^TQ]P = -P^TIP \implies\\ P^TQPDP^{-1}P + P^TP^{-T}DP^TQP = -P^TP \implies\\ P^TQPD + DP^TQP = -P^TP \implies\\ (P^TQP)D + D(P^TQP) = -P^TP. $$ So, if we make the substitution $R = P^TQP$ (which means that $Q = P^{-T}RP^{-1}$, then we can find $R$ by solving the system $$ RD + DR = -P^TP, $$ and then use this $R$ to obtain $Q = P^{-T}RP^{-1}.$
If you write out the set of equations for $RD + DR = P^TP$, you should find that it is very easy to solve for the entries of $R$. Indeed, if we take $\lambda_1 = -1, \lambda_2 = -2$, then you should find that $$ (\lambda_i + \lambda_j)r_{ij} = -[P^TP]_{ij}, \quad i,j = 1,2. $$