# what is a practical use for the determinant of a matrix?

This topic is 2910 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, just so I can better understand the matrix. Can one of the math gurus out there give me an example of the practical use of the determinant of the matrix AND the transpose of the matrix?

Thanks
Nikos

##### Share on other sites

Hi, just so I can better understand the matrix. Can one of the math gurus out there give me an example of the practical use of the determinant of the matrix AND the transpose of the matrix?

Thanks
Nikos

When a matrix is used to represent linear transformations (as is commonly the case in 3D graphics), the determinant effectively represents the degree of unambiguousness inside a matrix.

That is, if determinant is non-zero, the matrix can be inverted because the components don't "cancel out" each other (which would cause zero determinant).

In the same context, transpose of a 3x3 orthogonal rotation matrix is effectively its inverse. This works because the vectors within the 3x3 matrix represent the per-direction scaling factors caused by rotation, and if the vectors represent unique directions with regard to each other (orthogonality), those scaling factors can be simply flipped around to cancel the rotation that the original matrix represents.

In computer graphics, a full transpose of a 4x4 matrix can be done to save some GPU operations. This is related to the physical register layout and the instructions needed to multiply matrices.

Do note that in general, matrices can also be used to represent various other stuff in addition to linear transformations. Therefore, "the matrix" is ambiguous by itself.

Again, in general, matrix inversion is useful if you know the result vector and the linear formula (coefficients of which is what a matrix represents), and you want to find the original vector.

##### Share on other sites
If you're working in 3D and using 4x4 matricies as transforms, the determinant has an immediately useful value.

If you put a unit cube through the transform, then the determinant will tell you what the volume of the output cube will be; in other words it tells you the volume scaling that the matrix will do.

Hence, well behaved 3D transforms will all have positive non-zero dets; and all rotation/translations which you expect to do no scaling will have a det of 1.

This also helps explain why zero det matricies can't be inverted. In order for it to have det zero, it must shrink one of your unit cube dimensions to zero. Hence there can't be a matrix which goes the other way, because there's no way to reinflate that deleted dimension back to one. Hence there's no inverse for the matrix.

Obviously, since you HAVE to squash one of the dimensions away to go from the 3D world to the 2D render plane, this means all projection matricies must have det = 0. And hence, this is why there is no general case system for taking a pixel in the window and finding it's location in 3D space, because that would amount to being able to invert your projection matrix.

##### Share on other sites

Hi, just so I can better understand the matrix. Can one of the math gurus out there give me an example of the practical use of the determinant of the matrix AND the transpose of the matrix?

Thanks
Nikos

Most of linear algebra is essential to understand 3d programming and graphics techniques. If you are doing lighting or something related like bump mapping, sometimes you need to convert coordinates from one space to another like convert coordinates to eye space, tangent space, etc... To do that, you come up with a change of basis matrix which is composed of three linearly independent vectors. Let's say you have three candidate vectors but you can't tell whether they form a basis or not. To check that your vectors are linearly independent and hence, form a basis for the space, you could take the determinant of the matrix composed of the three candidate vectors as columns. If the determinant of this matrix is non-zero, then the vectors are linearly independent and you found a basis. This, for example, applies to the famous TBN matrix that you will encounter if you read bump mapping articles. Even just coming up with candidate vectors involves solving systems of equations and using cross-products--all of which make heavy use of the determinant. See http://www.blacksmit..._derivation.php and http://www.blacksmit...ng_using_cg.php for example if you want to know how bump mapping works.

One use for the transpose is that it tells you when a matrix is orthogonal. When a matrix is orthogonal, then its inverse is the same as the transpose. This will be the case for rotations and translations and is good to know so that you can optimize code. When you pass normals to a shader, you won't need to multiply by the normal matrix if all you are doing are rotations and translations. This is because the normal matrix is the inverse transpose which means it's the actually the same as the orthogonal matrix. The TBN matrix that I mentioned above is also orthogonal and knowing this fact makes going from tangent space to world space easy.

http://www.lighthous...-normal-matrix/

##### Share on other sites
It's signed volume. That is all.

##### Share on other sites
A linear endomorphism is invertible if and only if its matrix has non-zero determinant.

The signed area of a triangle is
| x1 y1 1 |
| x2 y2 1 | * (1/2)
| x3 y3 1 |

The signed volume of a tetrahedron is
| x1 y1 z1 1 |
| x2 y2 z2 1 | * (1/6)
| x3 y3 z3 1 |
| x4 y4 z4 1 |

Determinants can be used to solve systems of linear equations (Cramer's rule).

The determinant can be used to compute the eigenvalues of a matrix.

The transposed of a rotation matrix is its inverse.

If you have a system of linear equations with more equations than variables, you can reduce the number of equations by multiplying both sides of the equation in matrix form by the transpose of the matrix. The solution of the resulting system is the minimum-squares approximation to the first problem.

##### Share on other sites
Far from being a math guru, but since I used this not too long ago, here's another use case:

The sign of the determinant of a matrix can be used to calculate the relative position of a point to a plane:

Given four points a=(ax,ay,az), b=(bx,by,bz), c=(cx,cy,cz) and d=(dx,dy,dz) the sign of the determinant of the matrix defined as

[a,b,c,d]=
|ax-dx ay-dy az-dz|
|bx-dx by-dy bz-dz|
|cx-dx cy-dy cz-dz|

shows you the relative position of d compared to the plane defined by a,b,c.

This helps, for example when testing intersections between triangles.

edit: damn editing the post totally messed up my awesome matrix. put in a new line...

##### Share on other sites
A determinant of zero effectively means there are infinite solutions of x to a system of equations, therefore there is no unique solution.

##### Share on other sites

If you're working in 3D and using 4x4 matricies as transforms, the determinant has an immediately useful value.

If you put a unit cube through the transform, then the determinant will tell you what the volume of the output cube will be; in other words it tells you the volume scaling that the matrix will do.

Hence, well behaved 3D transforms will all have positive non-zero dets; and all rotation/translations which you expect to do no scaling will have a det of 1.

This also helps explain why zero det matricies can't be inverted. In order for it to have det zero, it must shrink one of your unit cube dimensions to zero. Hence there can't be a matrix which goes the other way, because there's no way to reinflate that deleted dimension back to one. Hence there's no inverse for the matrix.

Obviously, since you HAVE to squash one of the dimensions away to go from the 3D world to the 2D render plane, this means all projection matricies must have det = 0. And hence, this is why there is no general case system for taking a pixel in the window and finding it's location in 3D space, because that would amount to being able to invert your projection matrix.

##### Share on other sites
Thank you for all your great replies. It is a really big help.

Nikos

I will digest the information and see what comes out the other end:)

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 13
• 30
• 9
• 16
• 12