Determinant in c++

I'm writing a menu driven program in c++ that can prompt the user to enter a size of a Matrix, enter the elements of the Matrix, enter a second Matrix if the user wants to do the following, Add, Subtract, Multiply, Divide the Matrices and also find the determinant if it is a nxn Matrix. I'm done with Adding, Subtracting, Multiplying and Dividing the matrices. Can anyone help me on how to create a function to get the Determinant. I've been working on this for a while, my brain is giving up on me.
http://en.wikipedia.org/wiki/Determinant

Seems like Laplace's formula is the best one to implement for a general nxn matrix.

I've had my share of linear algebra courses. But one thing I never have learned is: how do you devide matrices???

As for the deterninant, jsmith is right. Look it up at wikipedia. Either you use Laplace's formula or you transform it into a triangular matrix and compute the trace. Depends on the actual numbers and the size of the matrix what is numerically better.
Thanx jsmith, your reply helped. Still have to put it in c++ though. Hope its not as complicated as I think.

As for the division of Matrices, it was a trick question on the project. You don't divide Matrices.
Last edited on
Topic archived. No new replies allowed.