Question: How to solve matrix equation (Lyapunov Equation)?

Let us assume we have a square matrix $A$ with known entries. We know the system is asymptotically stable by inspection of the eigenvalues, hence we know that the Lyapunov equation


will have a symmetric matrix P as a solution with Id being the identity matrix. How can I obtain the entries of the P matrix? I have tried the following code but was not able to solve for the entires of the P matrix.


I would be happy if someone could share a solution to this problem.



A := <<a__11|a__12>,<a__21|a__22>>;
P := <<p__11|p__12>,<p__12|p__22>>;
Id := <<1|0>,<0|1>>;
eqn := Transpose(A).P+P.A = -Id;


Please Wait...