# Fun with matrix calculations! (help meeee...)

**URL:** <https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347>\
**Category:** Factual Questions\
**Created:** [September 19, 2005, 12:05pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347 "2005-09-19T12:05:22Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlyingRamenMonster](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@FlyingRamenMonster](https://boards.straightdope.com/u/FlyingRamenMonster)\
**Post date:** [September 19, 2005, 12:05pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/1 "2005-09-19T12:05:22Z")

</div>

That’s right, time to help the irresponsible student with her exam prep! Actually, I’m not sure this will even be _on_ the exam. But it’s bothering me and I can’t concentrate on the important stuff.

Suppose we have these matrices. You are given Matrix A and Matrix B, and you are asked to find C if AC = B. It’s fairly simple to solve for 2x2 matrices, but how do you do 3x3s? My wonderfully helpful textbook tells me to just leave it up to my calculator, but the calculators we have can’t handle that sort of thing (they can do matrix multiplication but they can’t find inverse matrices). I seem to recall some sort of method involving the identity matrix but I can’t. Freaking. Remember. Argh.

Help.

---

<div class="post-metadata">

**Author:** ![FlyingRamenMonster](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@FlyingRamenMonster](https://boards.straightdope.com/u/FlyingRamenMonster)\
**Post date:** [September 19, 2005, 12:09pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/2 "2005-09-19T12:09:59Z")

</div>

Um, to clarify: how does one solve for C given that AC = B, with 3x3 matrices, _without_ having to find the inverse of a 3x3 matrix?

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [September 19, 2005, 12:58pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/3 "2005-09-19T12:58:15Z")

</div>

I’m not sure how you’d do it _without_ finding the inverse of A. I suppose you know that, if AC = B, then C = A[sup]-1[/sup]B.

To find the inverse of A, you can set up a 3x6 matrix with A on the left and I (the identity matrix) on the right, and do the row operations required to turn the left side into I (a la the Gauss-Jordan elimination method), and what shows up on the right will be A[sup]-1[/sup].

Are you sure your calculator won’t find inverses? I would have thought that any calculator that would do matrix multiplication could also find inverses.

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [September 19, 2005, 1:01pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/4 "2005-09-19T13:01:05Z")

</div>

Actually, I guess if you really wanted to do it without finding an inverse matrix, you could write C with variables standing for all nine entries, work out what AC would be, set its entries equal to those of B, and solve the resulting systems of equations. But that would be at least as much work as finding A[sup]-1[/sup].

---

<div class="post-metadata">

**Author:** ![FlyingRamenMonster](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@FlyingRamenMonster](https://boards.straightdope.com/u/FlyingRamenMonster)\
**Post date:** [September 19, 2005, 1:15pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/5 "2005-09-19T13:15:42Z")

</div>

Well then. I don’t think whatever method we were taught worked for _all_ 3x3 matrices, it was just a shortcut for certain _kinds_… man, it probably doesn’t help any that I haven’t looked at matrices since March, does it? Sigh. Thank Og these are my _mock_ finals.

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [September 19, 2005, 1:22pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/6 "2005-09-19T13:22:59Z")

</div>

The method outlined by Thudlow Bink works well for all square matrices. It’s very simple to compute the inverse of a matrix with this method, too. Suppose you had a 2x2 matrix like so:

```auto

 a b
 c d

```

Simply add an identity matrix to the right hand side, so the old matrix becomes:

```auto

 a b 1 0
 c d 0 1

```

and, using elementary row operations, get the matrix so that it looks like so:

```auto

 1 0 e f
 0 1 g h

```

where e f g and h are the entries of your inverse matrix. It’s the same principle for 3x3 matrices, too. You can now use your inverse to compute the matrix C.

Hope this helped.

---

<div class="post-metadata">

**Author:** ![CalMeacham](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/calmeacham/32/35_2.png) [@CalMeacham](https://boards.straightdope.com/u/CalMeacham)\
**Post date:** [September 19, 2005, 1:28pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/7 "2005-09-19T13:28:11Z")

</div>

No matter what you do, you’re essentially inverting a matrix to do it – you’ll do the same math, even if it’s not obvious at the time that this is true.  
Google “matrix inversion” and you get some sites on it, even ones like this that give explicit algebraic formulae:

> **[Invertible matrix](https://en.wikipedia.org/wiki/Matrix_inversion)**
>
> In linear algebra, an n-by-n square matrix A is called invertible (also nonsingular or nondegenerate), if there exists an n-by-n square matrix B such that
> where In denotes the n-by-n identity matrix and the multiplication used is ordinary matrix multiplication. If this is the case, then the matrix B is uniquely determined by A, and is called the (multiplicative) inverse of A, denoted by A−1. Matrix inversion is the process of finding the matrix B that satisfies the prior equation for a given inv...

[http://cnx.rice.edu/content/m2113/latest/](http://cnx.rice.edu/content/m2113/latest/)

---

<div class="post-metadata">

**Author:** ![rayh](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@rayh](https://boards.straightdope.com/u/rayh)\
**Post date:** [September 19, 2005, 1:41pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/8 "2005-09-19T13:41:37Z")

</div>

Or you could use an [online matrix calculator](http://wims.unice.fr/wims/wims.cgi?session=B19866D6B2.3&+lang=en&+module=tool%2Flinear%2Fmatrix.en).

---

<div class="post-metadata">

**Author:** ![FlyingRamenMonster](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@FlyingRamenMonster](https://boards.straightdope.com/u/FlyingRamenMonster)\
**Post date:** [September 19, 2005, 2:12pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/9 "2005-09-19T14:12:52Z")

</div>

Ohh, thanks for the help, everyone 😃 I did look at that Wikipedia page and to tell the truth, it hurt my brain. I’m not the most mathematically-minded person and abstract stuff trips me up easily. I still swear we had a faster way of working out solutions by hand but I don’t suppose it matters anymore since my friend has just pointed out that our calculators can indeed do inverses and I have somehow managed to get through a whole year (and several tests where this knowledge would have come in handy) without discovering this. Now if you’ll excuse me, I’m off to beat my head against a wall.

_thump_  
_thump_  
_thump_

---

<div class="post-metadata">

**Author:** ![Shalmanese](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Shalmanese](https://boards.straightdope.com/u/Shalmanese)\
**Post date:** [September 19, 2005, 4:30pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/10 "2005-09-19T16:30:01Z")

</div>

> [@csharpmajor](#):
>
> Ohh, thanks for the help, everyone 😃 I did look at that Wikipedia page and to tell the truth, it hurt my brain. I’m not the most mathematically-minded person and abstract stuff trips me up easily. I still swear we had a faster way of working out solutions by hand but I don’t suppose it matters anymore since my friend has just pointed out that our calculators can indeed do inverses and I have somehow managed to get through a whole year (and several tests where this knowledge would have come in handy) without discovering this. Now if you’ll excuse me, I’m off to beat my head against a wall.
> 
> _thump_  
> _thump_  
> _thump_

OT: But does your username refer to the musical note, the programming language or both?

---

<div class="post-metadata">

**Author:** ![Mathochist](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mathochist](https://boards.straightdope.com/u/Mathochist)\
**Post date:** [September 19, 2005, 4:52pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/11 "2005-09-19T16:52:19Z")

</div>

> [@csharpmajor](#):
>
> Ohh, thanks for the help, everyone 😃 I did look at that Wikipedia page and to tell the truth, it hurt my brain. I’m not the most mathematically-minded person and abstract stuff trips me up easily. I still swear we had a faster way of working out solutions by hand but I don’t suppose it matters anymore since my friend has just pointed out that our calculators can indeed do inverses and I have somehow managed to get through a whole year (and several tests where this knowledge would have come in handy) without discovering this. Now if you’ll excuse me, I’m off to beat my head against a wall.
> 
> _thump_  
> _thump_  
> _thump_

Here’s another formula that works to calculate the inverse. It’s more computation intensive than the elementary row operations method, but you never have to guess what move to make next[1].

For each entry a[sub]ij[/sub] in the matrix, strike out the ith row and jth column. This leaves an n-1 by n-1 matrix. Take its determinant and call it A[sub]ji[/sub]. Yes, that’s not a typo in the subscript – put it in the jth column and ith row of a new matrix.

Now take the determinant of the _whole_ original matrix and call it A. Divide A into each entry of the new matrix. The resulting matrix is the inverse of the original matrix.

[1] Truth be told, the other method you don’t have to guess if you know what you’re doing, but it can be annoying if you’re unused to it.

---

<div class="post-metadata">

**Author:** ![Punoqllads](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@Punoqllads](https://boards.straightdope.com/u/Punoqllads)\
**Post date:** [September 19, 2005, 5:12pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/12 "2005-09-19T17:12:01Z")

</div>

Minor detail for the last algorithm: entries where i and j aren’t either both odd or both even need to be multiplied by -1.

---

<div class="post-metadata">

**Author:** ![Mathochist](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mathochist](https://boards.straightdope.com/u/Mathochist)\
**Post date:** [September 19, 2005, 5:18pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/13 "2005-09-19T17:18:37Z")

</div>

> [@Punoqllads](#):
>
> Minor detail for the last algorithm: entries where i and j aren’t either both odd or both even need to be multiplied by -1.

Ah, you’re right. It’s amazing the things you forget to mention after internalizing the subject’s background.

Maybe I should try to get a low-level linear algebra class at my next job.

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [September 19, 2005, 7:05pm UTC](https://boards.straightdope.com/t/fun-with-matrix-calculations-help-meeee/322347/14 "2005-09-19T19:05:27Z")

</div>

Note: **Mathochist** has described, in words, the “analytic solution” in **CalMeacham** ’s first link (the one that hurt **csharpmajor** ’s brain :)).
