retagged by
377 views
0 votes
0 votes

what is the time complexity to find the determinant of a n*n upper triangular matrix in terms of n?

retagged by

2 Answers

1 votes
1 votes
Let's take an upper triangular matrix for proper visualization :-

$a_{11} \ a_{12} \ ............ a_{1n}$

$0 \ \ \ \ a_{22} \ .............a_{2n}$

.

.

.

$0 \ \ \ \ 0..........................a_{nn}$

 

What would be the determinant of this matrix ?

One observation , if we see the last row of the matrix , only one element is non-zero , others are 0 , thus anyway they're contributing 0 to the final determinant ,

Thus the determinant will be $a_{nn}*A[n-1][n-1]$.

In $A[n-1][n-1]$ it can be observed that , last row in $A[n-1][n-1]$ has only $a_{n-1n-1}$ as non-zero , others are 0 , so they'll only contribute 0 to the final determinant .

Thus $det(A) = a_{nn}*a_{n-1n-1}A[n-2][n-2]$.

Thus we can see a recursive behavior here.

Thus the determinant can be written as ,

$det(A) = a_{nn}*a_{n-1n-1}*.......a_{11}$.

which is nothing but product of the diagonal elements of the array.

how can this be found?

$for(i=1;i<=n;i++)\{\\det*=A[i][i];\\\}$.

This has a complexity of $\Theta(n)$
0 votes
0 votes

Matrix is upper triangular so determinant = multiplication of all diagonal elements

Diagonal elements = n so complexity = theta(n)

Related questions

0 votes
0 votes
0 answers
1
0 votes
0 votes
0 answers
2
utpal podder asked Feb 13, 2019
325 views
1 votes
1 votes
1 answer
3
Shreya Roy asked Feb 28, 2017
304 views
If a graph has k-independent components, it it n-k+1 colorable
3 votes
3 votes
1 answer
4
Shreya Roy asked Feb 28, 2017
1,657 views
Number of distinct BFS, DFS trees in a complete graph ?