C/C++ Calculate Determinant of Matrix in C++ - Get Help Now!

  • Thread starter Thread starter Caesar_Rahil
  • Start date Start date
  • Tags Tags
    Matrix
AI Thread Summary
To build a program in C++ that calculates the determinant of a matrix, one can start by understanding that the determinant of a 1x1 matrix is simply its single element. For larger n x n matrices, the determinant can be computed using a recursive approach, where the matrix is broken down into smaller (n-1) x (n-1) matrices. This involves selecting a row or column to expand upon and calculating the determinant of the resulting submatrices. Key challenges include declaring the determinant variable, managing dynamic memory allocation for matrices, and properly implementing recursion to handle varying dimensions at each recursive step. Clarification is needed on how to structure the program to handle these aspects effectively.
Caesar_Rahil
Messages
69
Reaction score
0
Hello...
I am trying to build a program that calculates the calculates the determinant of a matrix. IN C++
I could do that to 3x3 matrix, but I was thinking of generalizing it.
I am unable to find a way to do that, the only hint I can get from mathematics is that I can use recursion to break my matrix into smaller matrices. Still i am stumped, can anybody help me out?please
 
Technology news on Phys.org
Well, the determinant of a one by one matrix A is simply A[1, 1].
For an n by n matrix, you can expand along rows or columns, and proceed just as you would do by "hand". So summing over i = 1 to n, take out the first row, nth column (or nth row, first column) and calculate the determinant of the remaining matrix (which is then (n - 1) x (n - 1), of course).
 
Still didn't get it
 
What don't you get?
How to calculate a determinant?
How to program it?
What recursion is?
 
Firstly how do i declare a determinant. Since its variable, i have to allocate memory at runtime. Plus, how do i arrange for recursion as i have to specify dimension of determinant at each step??
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Back
Top