Maths - Matrix algebra - Inverse

 

By: Nobody/Anonymous - nobody
file The inverse of a matrix.  
2006-02-07 18:43

hello, 
 
First I'd like to say that I'm not a hundred percent sure of the following, But I am pretty sure. 
 
I was trying to express the inverse of a matrix for implementing it in my project. 
The way I worked is basically. 
If P1 = [M] * P2 
Then we can express P1, extract the original X,Y and Z, and then group the transformed X,Y and Z and get the values of the inverse matrix. 
Doing this I got an expression which is similar to the matrix you got except with a pretty large denominator. 
I'm refering to the inverse matrix described on this page: 
https://www.euclideanspace.com/maths/algebra/matrix/arithmetic/index.htm 
I of course started thinking and it seems logical that there will be a denominator, since you're trying to take apart and regroup values which requires you'll find a common denominator. 
 
So I think the problam is you asumed that [b]*[b]^(-1)=[i]. 
Where I would think that: 
Sx, 0, 0, 0 
[b]*[b]^(-1) = 0, Sy, 0, 0 
0, 0, Sz, 0 
Where Sx, Sy and Sz are the scaling about each axis. 
This will of course produce the denominator. 
So the matrix you got would be the specific case where the scale matrix is [I] which could be useful in certain cases where you know that the scaling is 1 but is not the general inverse of a matrix. 
 
Can you verify this? 
 
T.D.

By: Nobody/Anonymous - nobody
file RE: The inverse of a matrix.  
2006-02-07 19:10

It took out my spaces. 
 
Sx, 0, 0, 0 
0, Sy, 0, 0 = [b]*[b]^(-1) 
0, 0, Sz, 0

By: Nobody/Anonymous - nobody
file RE: The inverse of a matrix.  
2006-02-07 21:29

wait I looked at it wrong. 
[B]*[B]^(-1)=[I] is right. 
Because we know the inverse of a scale only matrix is: 
1/Sx, 0, 0, 0 
0, 1/Sy, 0, 0 
0, 0, 1/Sz, 0 
 
It's right of course only if you calculate [B]^(-1) right. 
With your equation for the inverse it should come out [B]*[B]^(-1)=[S] but I have to check first. 
 
Let me think about this a bit.

By: Nobody/Anonymous - nobody
file RE: The inverse of a matrix.  
2006-02-07 22:05

Well I checked [B]*[B]^(-1)=[S] 
And the scales are exactly the denominator that I got in my calculation. 
So you need to divide each part of the matrix by the scale of that axis. 
Or at least I think it's the scale because until now I thought the scale should be the length of the normal of each of the planes, which makes sense because you can take it out as a comon multiplier. 
 
Anyway, here are the denominators that I got although it'll be best if you check them. 
For the first layer: m00*(m11*m22-m22*m21)+m01*(m12*m20-m10*m22)+m02*(m10*m21-m11*m20) 
For the second layer: m10*(m02*m21-m01*m22)+m11*(m00*m22-m02*m20)+m12*(m01*m20-m00*m21) 
For the third layer: m20*(m01*m12-m02*m11)+m21*(m02*m10-m00*m12)+m22*(m00*m11-m01*m10) 
 
T.D. 
 
By the way, sorry for writing so many posts.

By: Martin Baker - martinbakerProject Admin
file RE: The inverse of a matrix.  
2006-02-08 09:54

hello TD, 
 
I am sure that the left hand identity element is the same as the right hand identity element: 
 
[B]*[B]^(-1)=[B]^(-1)*[B]=[I] 
I tried multiplying out the terms of  
1/Sx, 0, 0 
0, 1/Sy, 0 
0, 0, 1/Sz 
by: 
Sx, 0, 0 
0, Sy, 0 
0, 0, Sz 
 
and then reversed the order and in both cases I got the identity element. 
 
I think all the denominators you got are equal to the determinant: 
https://www.euclideanspace.com/maths/algebra/matrix/functions/determinant/ 
Which is the common denominator for the inverse matrix. 
 
Martin

By: Nobody/Anonymous - nobody
file RE: The inverse of a matrix.  
2006-02-08 10:28

Yes I already corrected my self. 
[B]*[B]^(-1)=[I] Is correct. 
And it must be correct becasue you're taking the matrix that does the opposite of a given matrix, so joining them must bring you back to the 0-point which is [I]. 
 
But if we take the inverse matrix equation that you wrote on the matrix arithmatics page and try to multiply a matrix by its inverse using that equation you will not get [I] you would get a scaling matrix [S] Where the scales are the determinants. 
As I said your equation would work in the specific case of an orthogonal matrix. 
 
Also note that I got to the denominators by simply applying: 
P1=[M]*P2 
P2=[M]^(-1)*P1 
In much the same way we find the equation for matrix multiplication. 
 
Also the denominators are equal to the determinants and they would be because I solved the system.

By: Martin Baker - martinbakerProject Admin
file RE: The inverse of a matrix.  
2006-02-08 10:42

If you go to the last equation on this page 
 
https://www.euclideanspace.com/maths/algebra/matrix/arithmetic/ 
 
Did you notice the 1/det[m] * factor which is the determinant? 
 
In the case of an orthogonal matrix the determinant is 1. 
 
In the case of: 
Sx, 0, 0 
0, Sy, 0 
0, 0, Sz 
the determinant is Sx*Sy*Sz 
 
So the inverse is: 
SySz, 0, 0 
0, SxSz, 0 * (1/Sx*Sy*Sz) 
0, 0, SxSy 
 
which gives the required result, 
 
Martin

By: Nobody/Anonymous - nobody
file RE: The inverse of a matrix.  
2006-02-10 10:04

Oh, must have missed that. 
Nevermind then, thanks for clarifing.

By: Martin Baker - martinbakerProject Admin
file RE: The inverse of a matrix.  
2006-02-10 16:35

Hello T.D. 
 
This thread has made me realise that the pages about determinant and inverse were not as good as they should have been. I have therefore updated the following pages: 
https://www.euclideanspace.com/maths/algebra/matrix/functions/determinant/ 
https://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/ 
These pages explain the concepts and below them are specific pages for 2x2, 3x3 and 4x4 matrices. 
 
If you do get a chance to look at these pages I would welcome any feedback. 
 
Martin 

 


metadata block
see also:
Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Mathematics for 3D game Programming - Includes introduction to Vectors, Matrices, Transforms and Trigonometry. (But no euler angles or quaternions). Also includes ray tracing and some linear & rotational physics also collision detection (but not collision response).

Other Math Books

Terminology and Notation

Specific to this page here:

 

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.