Thread: Need Help with Matrices and Arrays

1. Need Help with Matrices and Arrays

Hey guys:

I need an explanation to what my professor wants out of my homework. I don't want you to do it for me, but I would like to have a better understand of what exactly I need to do. Like I don't understand covariance and eigenvalues.....

Question:

"Write a C program that allows the user to enter three 2-D vectors, and computes (and displays) their sample covariance matrix and its eigenvalues. (You may only use the library functions sqrt, printf and scanf). Your program must print appropriate prompts and messages."

If someone could explain it to me, that would be wonderful, thanks!!!

2. can anyone help me?

3. Originally Posted by dcwang3
can anyone help me?
Remember: the specific-ness of the answer can never exceed the specific-ness of the question. What part of the assignment/link I posted don't you understand?

4. This is what my professor final put up after I asked him about question #1

An m-D vector can be represented as an m x 1 matrix. A transpose of an m x n matrix A denoted by AT is an nxm matrix with

Observe that the definition of matrix multiplication allows us to multiply non-square matrices, i.e. one can always multiply an m x d matrix with an d x n matrix with the product being an m x n matrix.

Let xi , 1<=i<=n, be n 2-D vectors. Their average is given by

Their sample covariance matrix, A, is given by

Once you have the sample covariance matrix A, the eigenvalues are roots of the equation det(A - xI), where xI is x times the Identity matrix and det stands for determinant

The equation you get is a quadratic equation in x, which you need to now solve to get the eigenvalues.

-----------------

I understand the covariance but I do not understand the eigenvalues...

5. Originally Posted by dcwang3
Like I don't understand covariance and eigenvalues.....
like I stated above....

6. Maybe a specific example, suppose you have the matrix A:
[ 2 4 ]
[ 3 5 ]
We turn this into the matrix A-xI
[ 2-x 4 ]
[ 3 5-x]
This has determinant det (A-xI) = (2-x)(5-x)-(3)(4) = x^2-7x-2. You can then solve this quadratic equation using whatever method you like to use to solve quadratic equations. Note: you did this in your linear algebra class, so dig that book back out.

7. ok awesome thanks for the example. I am in linear algebra right now, but we haven't covered determinants nor anything like the eigenvalues...