0

Not Yet Answered # Please help me with n x n matrix

Please help me to write a C++ program which finds the determinant of a n x n Matrix. I'm a beginner in C++ and have read all the posts related to this topic ,but it didn't help me at all. I know the code will be recursive, so i started to solve a 3 x 3 matrix first. Though it is possible to find the determinant without using loops & conditions by applying the formula (first element x (product of .....), i don't find it logical where we could exploit loops and conditions. Hence, i request you to help with the logical part of finding a determinant of n x n matrix.

Sky Diploma 571 Discussion Starter techly Sky Diploma 571 Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...

Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...

0

0

Well, You know that the 3 x 3 Matrix could be solved by first element (2x2 Matrix,) -(2nd Element )* (2x2 ) Matix ................

The same applies to the NxN matrix on a large scale,

All you have to do is to.

(first element ) * (Det of (N-1) * (N-1) ) Matrix. - element 2 ......... Element 'n' * (Det of (N-1)* (N-1))

This would go on recursevly. Until you get to the 3x3 or 2x2 matrix where in you can use the formulae,

All you will need to make is a recursive function, which would use a for loop to do the above mentioned thing, until the end results are 2x2 matrix when you can use the formula `a*d - b*c`

to find the determinant.

The other thing that you will have to figure out is on how to send the matrix as an Arguement, I mean how does the Elemination of the ROw And column take place.

0

Thank you very much for your kind reply.

All you will need to make is a recursive function, which would use a for loop to do the above mentioned thing, until the end results are 2x2 matrix when you can use the formula a*d - b*c to find the determinant

Hence, it's a complicated logic, isn't it ?

The other thing that you will have to figure out is on how to send the matrix as an Arguement, I mean how does the Elemination of the ROw And column take place.

Could i make use of diagonal elements [ (0,0),(1,1),(2,2)....(n,n)] to eliminate Rows and columns ?

0

Firstly,

>>Hence, it's a complicated logic, isn't it ?

Pardon Me, If my Words make it look kinda complicated,

A trick would be to first determine on how to solve a 4x4 matrix then I guess we will understand on how to accomplish the task.

>>Could i make use of diagonal elements [ (0,0),(1,1),(2,2)....(n,n)] to eliminate Rows and columns ?

Well I am unable to comprehend how diagnol elements will help.

Please stand by for answers from other Daniweb- members too.

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

Hi. Im using vb 2010. I want to dynamically add textboxes to my form by clicking on a button. I've google searched and so far this code worked:

```
Private Sub btn_addline_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_addline.Click
Dim txtB1 As New TextBox
Dim i
For i = ...
```