# Computing inverse of a 4*4, 5*5 matrix.

## Recommended Posts

Is it possible to compute the inverse of a 4*4, 5*5 .... Matrix ?

If yes, will it be difficult computation ?

If no, why ?

Thanks & Regards,

Prashant S Akerkar

Edited by Sensei
##### Share on other sites

• 2 weeks later...

Yes, it is possible to find the inverse of a 4 by 4 or 5 by 5 matrix (or a 100000 by 100000 matrix).  Surely you have learned that every "non-singular" matrix (having non-zero determinant) has an inverse.   Whether it is 'hard' or not depends upon what you call 'hard'.  It certainly is tedious!

The simplest way to find the inverse of such a matrix, I think, is to use "row reduction" to reduce the given matrix to the identity matrix while applying the same operations to the identity matrix.  The reason this works is that such row operation (add a multiple of one row to another, multiply a row by a number, swap two rows) corresponds to multiplication by an "elementary matrix"- one that is created by applying that same row operation to an identity matrix.  If multiplying matrix "A" by a sequence of elementary matrices gives the identity matrix, then their product is the inverse matrix to A.  And multiplying the identity matrix by all of them is there product.

Here is a simple four by four example: Suppose $A= \begin{bmatrix}1 & 3 0 & 0 \\ -1 & 4 & 1 & 0 \\ 2 & 3 & 2 & 1\\ 0 & 2 & 1 & 0\end{bmatrix}$.

I write it "side-by-side" the identity matrix:

$\begin{bmatrix}1 & 3 0 & 0 \\ -1 & 4 & 1 & 0 \\ 2 & 3 & 2 & 1\\ 0 & 2 & 1 & 0 \end{bmatrix}\begin{bmatrix}1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1\end{bmatrix}$

There is already a "1" leading the first row and a "0" leading the fourth row so the "reduce" the first column I can "add the first row to the second row" and "subtract twice the first row from the third row":

$\begin{bmatrix}1 & 3 0 & 0 \\ 0 & 7 & 1 & 0 \\ 0 & -3 & 2 & 1\\ 0 & 2 & 1 & 0 \end{bmatrix}\begin{bmatrix}1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ -3 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1\end{bmatrix}$

There is a "7" in "second row second column" so I need to divide that row by 7 to get a "1" there.  Once I have done that I can add 3 times the new second row to the third row and subtract 2 times the new second row from the fourth row to get "0" below the "1":

$\begin{bmatrix}1 & 3 0 & 0 \\ 0 & 1 & \frac{1}{7} & 0 \\ 0 & 0 & \frac{17}{7} & 1\\ 0 & 0 & \frac{5}{7} & 0 \end{bmatrix}\begin{bmatrix}1 & 0 & 0 & 0 \\ \frac{1}{7} & \frac{1}{7} & 0 & 0 \\ -\frac{18}{7} & \frac{3}{7} & 1 & 0 \\ \frac{2}{7} & \frac{2}{7} & 0 & 1\end{bmatrix}$.

As I said, it is tedious (and error prone) so I am going to stop here.  You can continue with the last two rows and columns yourself if you wish to see that you actually do get the inverse matrix.

Edited by Country Boy
##### Share on other sites

Quote

Yes, it is possible to find the inverse of a 4 by 4 or 5 by 5 matrix (or a 100000 by 100000 matrix).

Yeah if you have a good graphics card you should be able to run a 100000 by 100000 matrix reasonably quickly.

Quote

If no, why ?

Modern graphics cards make use of parallelization for matrix multiplication therefore matrix calculations are extremely fast on modern computers provided you are making use of the graphics card.

##### Share on other sites

53 minutes ago, HallsofIvy said:

Here is a simple four by four example: Suppose $A=$.

Your matrix has the top right corner missing.

Edited by John Cuthber
##### Share on other sites

Thanks.

Can I conclude that the inverse of a 4*4 or 5*5 Matrix can be computed but it is a tedious long process ?

Thanks & Regards,

Prashant S Akerkar

##### Share on other sites

On 31/07/2018 at 4:48 AM, prashantakerkar said:

Is it possible to compute the inverse of a 4*4, 5*5 .... Matrix ?

If yes, will it be difficult computation ?

If no, why ?

Thanks & Regards,

Prashant S Akerkar

On 14/08/2018 at 5:14 AM, prashantakerkar said:

Thanks.

Can I conclude that the inverse of a 4*4 or 5*5 Matrix can be computed but it is a tedious long process ?

Thanks & Regards,

Prashant S Akerkar

Take all that 'junk' and put it to a cross section, and reverse the point to point scales.

##### Share on other sites

2 hours ago, Brett Nortj said:

Take all that 'junk' and put it to a cross section, and reverse the point to point scales.

On 14/8/2018 at 4:14 AM, prashantakerkar said:

Thanks.

Can I conclude that the inverse of a 4*4 or 5*5 Matrix can be computed but it is a tedious long process ?

Thanks & Regards,

Prashant S Akerkar

if you do it by hand.

But it's quick if you use a computer.

##### Share on other sites

3 hours ago, John Cuthber said:

if you do it by hand.

But it's quick if you use a computer.

Thanks.

Thanks & Regards,

Prashant S Akerkar

##### Share on other sites

• 1 month later...
On ‎8‎/‎15‎/‎2018 at 12:58 AM, John Cuthber said:

if you do it by hand.

But it's quick if you use a computer.

If someone else has done the tedious work of programming the computer!

Edited by Country Boy
##### Share on other sites

1 hour ago, Country Boy said:

If someone else has done the tedious work of programming the computer!

They have.

##### Share on other sites

1 hour ago, John Cuthber said:

They have.

There is a small point to make though, about the case when you starting problem has all rational coefficients and you need to have an exact rational solution. If the programmer is not all too clever, because this is a lot less trivial than to solve for `real' numbers, then you might end up with only a crude approximation, or the execution time might go through the roof. If the programmer is not an idiot, the code preferably prevents either one from happening.

## Create an account

Register a new account