Thread: Need Help with Matrices and Arrays

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    116

    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. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    116
    can anyone help me?

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by dcwang3 View Post
    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?

  5. #5
    Registered User
    Join Date
    Feb 2008
    Posts
    116
    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...

  6. #6
    Registered User
    Join Date
    Feb 2008
    Posts
    116
    Quote Originally Posted by dcwang3 View Post
    Like I don't understand covariance and eigenvalues.....
    like I stated above....

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    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.

  8. #8
    Registered User
    Join Date
    Feb 2008
    Posts
    116
    ok awesome thanks for the example. I am in linear algebra right now, but we haven't covered determinants nor anything like the eigenvalues...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Adding Arrays and Matrices
    By dlf in forum C++ Programming
    Replies: 3
    Last Post: 11-30-2005, 02:36 PM
  2. Multidimensional arrays as Matrices
    By alvifarooq in forum C++ Programming
    Replies: 9
    Last Post: 05-30-2005, 12:15 AM
  3. 2-D Arrays (Matrices)
    By Mak in forum C Programming
    Replies: 2
    Last Post: 11-27-2003, 03:01 PM
  4. What are the differences between arrays and matrices?
    By incognito in forum C++ Programming
    Replies: 3
    Last Post: 03-11-2003, 01:09 AM
  5. File I/O with 2D arrays
    By hypertension in forum C Programming
    Replies: 2
    Last Post: 02-04-2003, 08:47 AM