# Solving matrix equation using Solve?

**URL:** <https://community.wolfram.com/t/solving-matrix-equation-using-solve/19628>\
**Category:** Questions\
**Tags:** algebra, equation-solving, symbolic-computations\
**Created:** [February 16, 2022, 10:22am UTC](https://community.wolfram.com/t/solving-matrix-equation-using-solve/19628 "2022-02-16T10:22:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonnakov](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/antonnakov/32/39927_2.png) [@antonnakov](https://community.wolfram.com/u/antonnakov)\
**Post date:** [February 16, 2022, 10:22am UTC](https://community.wolfram.com/t/solving-matrix-equation-using-solve/19628/1 "2022-02-16T10:22:39Z")

</div>

Hi, I am a new Mathematica user.

Is there a way to solve analytically the following matrix equation for the unknown matrix C?

```
Solve[A11 . C == C . A21 . C + C . A22 , C]

```

where A11, A21, A22 and C are all 2x2 matrices?

Not sure my syntax above is correct but Mathematica says “Solve: This system cannot be solved with the methods available to Solve.”

Perhaps an analytical solution is not always available?

I would appreciate any comments or suggestions…

---

<div class="post-metadata">

**Author:** ![gianlucagorni](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@gianlucagorni](https://community.wolfram.com/u/gianlucagorni)\
**Post date:** [February 16, 2022, 1:39pm UTC](https://community.wolfram.com/t/solving-matrix-equation-using-solve/19628/2 "2022-02-16T13:39:44Z")

</div>

You can declare that your variable `c` is a matrix:

```
A11 = RandomInteger[{-3, 3}, {2, 2}];
A22 = RandomInteger[{-3, 3}, {2, 2}];
A21 = RandomInteger[{-3, 3}, {2, 2}];
Solve[A11 . c == c . A21 . c + c . A22 && 
  Element[c, Matrices[{2, 2}]], c]

```

---

<div class="post-metadata">

**Author:** ![antonnakov](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/antonnakov/32/39927_2.png) [@antonnakov](https://community.wolfram.com/u/antonnakov)\
**Post date:** [February 16, 2022, 1:59pm UTC](https://community.wolfram.com/t/solving-matrix-equation-using-solve/19628/3 "2022-02-16T13:59:55Z")

</div>

Thanks a lot, that’s very useful!!

The problem I am trying to solve is listed below, it says “running”, hopefully it works also with symbols  
Where beta kappa sigma theta are all real numbers.

```
A11 = {{\[Beta] + \[Kappa]/\[Sigma], \[Kappa]}, {1/\[Sigma], 1}};
A21 = {{\[Theta]/(\[Sigma] . \[Sigma]) - \[Kappa]/\[Sigma] - \[Beta], \
\[Theta]/\[Sigma] - \[Kappa]}, {\[Beta] . \[Theta]/(\[Sigma] . \
\[Sigma]), \[Beta] . \[Theta]/\[Sigma]}};
A22 = {{1 + \[Kappa]/\[Sigma], 
    1}, {\[Beta] . \[Kappa]/\[Sigma], \[Beta]}};
Solve[A11 . c == c . A21 . c + c . A22 && 
  Element[c, Matrices[{2, 2}]], c]

```

---

<div class="post-metadata">

**Author:** ![gianlucagorni](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@gianlucagorni](https://community.wolfram.com/u/gianlucagorni)\
**Post date:** [February 16, 2022, 2:03pm UTC](https://community.wolfram.com/t/solving-matrix-equation-using-solve/19628/4 "2022-02-16T14:03:26Z")

</div>

That is nonlinear and with symbolic parameters, good luck!
