# How to calculate determinant in PCA?

2 views (last 30 days)

Show older comments

Im going to program PCA, but for that, I have to calculate the Eigen Vector and Eigen Value.

My question is in calculate the eigen value we have to calculate the determinant of the matrix which all the (diagonal value - lamda).

In this case we can consider the number of lamda Depends on the matrix dimension.

I can program it manually for the matriks before the diagonal substracted by lamda.

But for the diagonal after substracted by lamda, how to calculate it??

Because, eventually we have to do factorisation to get the lamda (x1,x2,..,xn).

Here is the example :

Matriks =[ 3 5 6

5 7 4

3 8 9]

Then we have to substract the diagonal value with eigen value, in this case because we havent knoen it, we will consider it as x.

Matrix_New=[ 3-x 5 6

5 7-x 4

3 8 9-x]

And the determinant is (3-x)(7-x)(9-x).

I already tried to multiply it, but matlab gives error. Do u know how to do calculation (3-x)(7-x)(9-x) ??

I know there is matlab function, but Im not allowed to use it!!

I really appriciate any help :)

##### 0 Comments

### Answers (1)

Roger Stafford
on 16 Feb 2014

To say "calculate the eigen value we have to calculate the determinant of the matrix which all the (diagonal value - lamda)" is saying things a little backwards. What you need to do is to determine the possible values of lambda that would make that determinant equal to zero.

Your attempt to find an expression for the determinant is flawed. It would really be:

(3-x)*(7-x)*(9-x)+5*4*3+6*8*5-(3-x)*8*4-(7-x)*3*6-(9-x)*5*5

= 42-36*x+19*x^2-x^3 = 0

So then you need to find the three values of x which are roots of this last equation. These will be your eigenvalues. That is not so easy to do. You can either use matlab's 'roots' function, or if you are not allowed to do that, there does exist a rather complicated solution to cubic equations which you can find on the internet.

http://en.wikipedia.org/wiki/Cubic_function

##### 2 Comments

Roger Stafford
on 17 Feb 2014

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!