Matrix Equation $QA+A^TQ=-I$ 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)}.
 A: Let $v:=(1, -1) ^T$ and $w:=(-2, 1) ^T$. Then
$$QAv + A^TQv = -Qv+A^TQv = (-I+A^T)Qv= -v $$
and
$$QAw + A^TQw= -2Qw+A^TQw = (-2I+A^T)Qw= -w. $$ Since $A^T$ has the eigenvalues -1 and -2, the matrices $(-I+A^T) $ and $(-2I+A^T)$ are invertible. Hence,
$$Qv=(-I+A^T)^{-1}v$$ and $$Qw=(-2I+A^T)^{-1}w.$$
There is a formula, that you can invert $2\times 2$ matrices really fast. Further observe $Qe_1=-Q(v+w) $ and $Qe_2=-Q(2v+w) $.
A: 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.
$$
