# How do you solve a matrix equation in Mathematica?

**URL:** <https://community.wolfram.com/t/how-do-you-solve-a-matrix-equation-in-mathematica/2169>\
**Category:** Questions\
**Tags:** mathematica, algebra\
**Created:** [May 9, 2014, 10:17pm UTC](https://community.wolfram.com/t/how-do-you-solve-a-matrix-equation-in-mathematica/2169 "2014-05-09T22:17:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthewknill](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@matthewknill](https://community.wolfram.com/u/matthewknill)\
**Post date:** [May 9, 2014, 10:17pm UTC](https://community.wolfram.com/t/how-do-you-solve-a-matrix-equation-in-mathematica/2169/1 "2014-05-09T22:17:01Z")

</div>

I cannot find how to solve a matrix equation in Mathematica.

Below is a matrix equation:  
{{3,4},{4,5}}A=={{5,6},{7,4}}  
Here are two matrices and I would like to solve for A, how would I do it in Mathematica?

By hand you multiply each side by the inverse.

Thanks!!!

---

<div class="post-metadata">

**Author:** ![fkampas](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/fkampas/32/41217_2.png) [@fkampas](https://community.wolfram.com/u/fkampas)\
**Post date:** [May 9, 2014, 11:06pm UTC](https://community.wolfram.com/t/how-do-you-solve-a-matrix-equation-in-mathematica/2169/2 "2014-05-09T23:06:38Z")

</div>

```auto
In[6]:= A = Array[a, {2, 2}];

In[7]:= A /. Solve[{{3, 4}, {4, 5}}.A == {{5, 6}, {7, 4}}]

Out[7]= {{{3, -14}, {-1, 12}}}

```

---

<div class="post-metadata">

**Author:** ![matthewknill](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@matthewknill](https://community.wolfram.com/u/matthewknill)\
**Post date:** [May 10, 2014, 3:17am UTC](https://community.wolfram.com/t/how-do-you-solve-a-matrix-equation-in-mathematica/2169/3 "2014-05-10T03:17:13Z")

</div>

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![fkampas](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/fkampas/32/41217_2.png) [@fkampas](https://community.wolfram.com/u/fkampas)\
**Post date:** [May 10, 2014, 12:21pm UTC](https://community.wolfram.com/t/how-do-you-solve-a-matrix-equation-in-mathematica/2169/4 "2014-05-10T12:21:29Z")

</div>

```auto
In[1]:= LinearSolve[{{3, 4}, {4, 5}}, {{5, 6}, {7, 4}}]

Out[1]= {{3, -14}, {-1, 12}}

```

is probably a better way to do it.

---

<div class="post-metadata">

**Author:** ![sukrause](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/sukrause/32/41348_2.png) [@sukrause](https://community.wolfram.com/u/sukrause)\
**Post date:** [May 10, 2014, 7:36pm UTC](https://community.wolfram.com/t/how-do-you-solve-a-matrix-equation-in-mathematica/2169/5 "2014-05-10T19:36:54Z")

</div>

> By hand you multiply each side by the inverse.

that you can do too

```auto
In[82]:= A = Inverse[{{3, 4}, {4, 5}}].{{5, 6}, {7, 4}}

Out[82]= {{3, -14}, {-1, 12}}

```

to refind the former result.
