# determinants

• 04-06-2002
Unregistered
determinants
could some one point me to an algorithm to find the determinant of a square matrix, not using recursion?

Thanks
• 04-07-2002
ygfperson
why not using recursion? i'm guessing this is homework

here's a few hints:
Code:

```| 3 4 5 | | 6 7 8 | | 9 1 2 |```
there are 2 ways to determine determinates by minors
or by diagonals
Code:

```| 3 4 5 3 4 | | 6 7 8 6 7 | | 9 1 2 9 1 |```
the last two columns are repeats

try this:
assuming a matrix is int a[3][3];, and its filled like above
Code:

```#define BORDER_CONSTANT 3 int t=0, u=0; for (i=0;i<3;i++)   for (j=0;j<3;j++)     t+=a[(i+j)%BORDER_CONSTANT][i]; for (i=2;i<=0;i--)   for (j=0;j<3;j++)     u+=a[(i+j)%BORDER_CONSTANT][i]; printf("%d",t-u);```
i havent tested this or anything, but try to figure it out from this
• 04-07-2002
Shiro
>why not using recursion?

Since his/her assignment told him not to do.
• 04-07-2002
Unregistered
thanks. Yeah its home work, although it didnt say it couldnt be recursion, I didnt want to make it recursion. Also, its not C/C++, some new language(to me). I just couldnt get my algorithm to work right. But thanks