Dr. E. Garcia
Mi Islita.com
Email | Last Update: 07/17/06
Topics
In Part 1 of this three-part tutorial we defined different type of matrices. We covered digraphs, stochastic matrices, and markov chains. We also mentioned how some search engine marketers have derived blogonomies out of these and similar concepts.
In Part 2 we covered matrix operations like addition, substraction and multiplication of matrices. We also discussed multiplication and division of matrices by a scalar and calculation of determinants from square matrices. We mentioned that if a determinant has a nonzero value, its matrix is described as regular and that if a determinant has zero value, its matrix is described as singular.
It is now time to put everything together, to demystify eigenvalues, eigenvectors, and present some practical applications.
Consider a scalar matrix Z, obtained by multiplying an identity matrix by a scalar; i.e., Z = c*I. Deducting this from a regular matrix A gives a new matrix A - c*I.
Equation 1: A - Z = A - c*I.
If its determinant is zero,
Equation 2: |A - c*I| = 0
and A has been transformed into a singular matrix. The problem of transforming a regular matrix into a singular matrix is referred to as the eigenvalue problem.
However, deducting c*I from A is equivalent to substracting a scalar c from the main diagonal of A. For the determinant of the new matrix to vanish the trace of A must be equal to the sum of specific values of c. For which values of c?
Figure 1 shows that the computation of eigenvalues is a straightforward process.
Figure 1. The eigenvalue problem.
In the figure we started with a matrix A of order n = 2 and deducted from this the Z = c*I matrix. Applying the method of determinants for m = n = 2 matrices discussed in Part 2 gives
|A - c*I| = c2 - 17*c + 42 = 0
Solving the quadratic equation,
c1 = 3 and c2 = 14.
Note that c1 + c2 = 17, confirming that these characteristic values must add up to the trace of the original matrix A (13 + 4 = 17).
The polynomial expression we just obtained is called the characteristic equation and the c values are termed the latent roots or eigenvalues of matrix A.
Thus, deducting either c1 = 3 or c2 = 14 from the principal of A results in a matrix whose determinant vanishes (|A - c*I| = 0)
In terms of the trace of A we can write:
c1/trace = 3/17 = 0.176 or 17.6%
c2/trace = 14/17 = 0.824 or 82.4%
Thus, c2 = 14 is the largest eigenvalue, accounting for more than 82% of the trace. The largest eigenvalue of a matrix is also called the principal eigenvalue.
There are many scenarios like in Principal Component Analysis (PCA) and Singular Value Decomposition (SVD) in which some eigenvalues are so small that are ignored. Then the remaining eigenvalues are added together to compute an estimated fraction. This estimate is then used as a correlation criterion for the so-called Rank Two approximation.
SVD and PCA are techniques used in cluster analysis. In information retrieval, SVD is used in Latent Semantic Indexing (LSI) while PCA is used in Information Space (IS). These will be discussed in upcoming tutorials.
Now that the eigenvalues are known, these are used to compute the latent vectors of matrix A. These are the so-called eigenvectors.
Equation 1 can be rewritten for any eigenvalue i as
Equation 3: A - ci*I
Multiplying by a column vector Xi of same number of rows as A and setting the results to zero leads to
Equation 4: (A - ci*I)*Xi = 0
Thus, for every eigenvalue ci this equation constitutes a system of n simultaneous homogeneous equations, and every system of equations has an infinite number of solutions. Corresponding to every eigenvalue ci is a set of eigenvectors Xi, the number of eigenvectors in the set being infinite. Furthermore, eigenvectors that correspond to different eigenvalues are linearly independent from one another.
At this point it might be a good idea to highlight several properties of eigenvalues and eigenvectors. The following pertaint to the matrices we are dicussing here, only.
If we know an eigenvalue its eigenvector can be computed. The reverse process is also possible; i.e., given an eigenvector, its corresponding eigenvalue can be calculated.
Let's illustrate these two cases.
Let's use the example of Figure 1 to compute an eigenvector for c1 = 3. From Equation 2 we write
Figure 2. Eigenvectors for eigenvalue c1 = 3.
Note that c1 = 3 gives a set with infinite number of eigenvectors. For the other eigenvalue, c2 = 14, we obtain
Figure 3. Eigenvectors for eigenvalue c2 = 14.
In addition, it is confirmed that |c1|*|c2| = |3|*|14| = |42| = |detA|.
As show in Figure 4, plotting these vectors confirms that eigenvectors that correspond to different eigenvalues are linearly independent of one another. Note that each eigenvalue produces an infinite set of eigenvectors, all being multiples of a normalized vector. So, instead of plotting candidate eigenvectors for a given eigenvalue one could simply represent an entire set by its normalized eigenvector. This is done by rescaling coordinates; in this case, by taking coordinate ratios. In our example, the coordinates of these normalized eigenvectors are:
Figure 4. Eigenvectors for different eigenvalues are linearly independent.
Mathematicians love to normalize eigenvectors in terms of their Euclidean Distance (L), so all vectors are unit length. To illustrate, in the preceeding example the coordinates of the two eigenvectors are (0.5, -1) and (1, 0.2). Their lengths are
for c1 = 3: L = [0.52 + -12]1/2 = 1.12
for c2 = 14: L = [12 + 0.22]1/2 = 1.02
Their new coordinates (ignoring rounding errors) are
for c 1 = 3: (0.5/1.12, -1/1.12) = (0.4, -0.9)You can do the same and normalize eigenvectors to your heart needs, but it is time consuming (and boring). Fortunately, if you use software packages these will return unit eigenvectors for you by default.
How about obtaining eigenvalues from eigenvectors?
This is a lot easier to do. First we rearrange Equation 4. Since I = 1 we can write the general expression
Equation 5: A*X = c*X
Now to illustrate calculations let's use the example given by Professor C.J. (Keith) van Rijsbergen in chapter 4, page 58 of his great book The Geometry of Information Retrieval (3), which we have reviewed already.
Figure 5. Eigenvalue obtained from an eigenvector.
This result can be confirmed by simply computing the determinant of A and calculating the latent roots. This should give two latent roots or eigenvalues, c = 41/2 = +/- 2. That is, one eigenvalue must be c1 = +2 and the other must be c2 = -2. This also confirms that c1 + c2 = trace of A which in this case is zero.
An Alternate Method: Rayleigh Quotients
An alternate method for computing eigenvalues from eigenvectors consists in calculating the so-called Rayleigh Quotient, where
Rayleigh Quotient = (XT*A*X)/(XT*X)
where XT is the transpose of X.
For the example given in Figure 5, XT*A*X = 36 and XT*X = 18; hence, 36/18 = 2.
Rayleigh Quotients give you eigenvalues in a straightforward manner. You might want to use this method instead of inspection or as double-checking method. You can also use this in combination with other iterative methods like the Power Method.
Eigenvalues can be ordered in terms of their absolute values to find the dominant or largest eigenvalue of a matrix. Thus, if two distinct hypothetical matrices have the following set of eigenvalues
One of the simplest methods for finding the largest eigenvalue and eigenvector of a matrix is the Power Method, also called the Vector Iteration Method. The method fails if there is no dominant eigenvalue.
In its basic form the Power Method is applied as follows:
It cannot get any easier than this. Let's take a look at a simple example.
Figure 6. Power Method for finding an eigenvector with the largest eigenvalue.
What we have done here is apply repeatedly a matrix to an arbitrarily chosen eigenvector. The result converges nicely to the largest eigenvalue of the matrix; i.e.
Equation 6: AkXi = cik*Xi
Figure 7 provides a visual representation of the iteration process obtained through the Power Method for the matrix given in Figure 3. As expected, for its largest eigenvalue the iterated vector converges to an eigenvector of relative coordinates (1, 0.20).
Figure 7. Visual representation of vector iteration.
It can be demonstrated that guessing an initial eigenvector in which its first element is 1 and all others are zero produces in the next iteration step an eigenvector with elements being the first column of the matrix. Thus, one could simply choose the first column of a matrix as an initial seed.
Whether you want to try a matrix column as an initial seed, keep in mind that the rate of convergence of the power method actually depends on the nature of the eigenvalues. For closely spaced eigenvalues, the rate of convergence can be slow. Several methods for improving the rate of convergence have been proposed (Shifted Iteration, Shifted Inverse Iteration or transformation methods). I will not discuss these at this time.
How about calculating the second largest eigenvalue of a matrix?
There are different methods for finding subsequent eigenvalues of a matrix. I will discuss only one of these: The Deflation Method. Deflation is a straightforward approach. Essentially, this is what we do:
Figure 8 shows deflection in action for the example given in Figure 1 and 2. After few iterations the method converges smoothly to the second largest eigenvalue of the matrix. Neat!
Figure 8. Finding the second largest eigenvalue with the Deflation Method.
Note. We want to thanks Mr. William Cotton for pointing us of an error in the original version of this figure, which was then compounded in the calculations. These have been corrected since then. After corrections, still deflation was able to reach the right second eigenvalue of c = 3. Results can be double checked using Raleigh's Quotients.
We can use deflation to find subsequent eigenvector-eigenvalue pairs, but there is a point wherein rounding error reduces the accuracy below acceptable limits. For this reason other methods, like Jacobi's Method, are preferred when one needs to compute many or all eigenvalues of a matrix.
Armed with this knowledge, you should be able to understand better articles that discuss link models like PageRank, their advantages and limitations, when these succeed or fail and why. The assumption from these models is that surfing the web by jumping from links to links is like a random walk describing a markov chain process over a set of linked web pages.
The matrix is considered the transition probability matrix of the Markov chain and having elements strictly between zero and one. For such matrices the Perron-Frobenius Theorem tells us that the largest eigenvalue of the matrix is equal to one (c = 1) and that the corresponding eigenvector, which satisfies the equation
Equation 7: A*X = X
does exists and is the principal eigenvector (state vector) of the Markov Chain, with elements of X being the pageranks. Thus, according to theory, iteration should enable one to compute the largest eigenvalue and this principal eigenvector, whose elements are the pagerank of the individual pages.
If you are interested in reading how PageRank is computed, stay away from speculators, especially from search engine marketers. It is hard to find accurate explanations in SEO or SEM forums or from those that sell link-based services. I rather suggest you to read university research articles from those that have conducted serious research work on link graphs and PageRank-based models. Great explanations are all over the place. However, some of these are derivative work and might not reflect how Google actually implements PageRank these days (only those at Google know or should know this or if PageRank has been phased out for something better). With all, these research papers are based on experimentation and their results are verifiable.
There is a scientific paper I would like readers to at least consider: Link Analysis, Eigenvectors and Stability, from Ng, Zheng and Jordan from the University of California, Berkeley (5). In this paper the authors use many of the topics herein described to explain the HITS and PageRank models. Regarding the later they write:
Figure 9. PageRank explanation, according to Ng, Zheng and Jordan from University of California, Berkeley
Note that the last equation in Figure 9 is of the form A*X = X as in Equation 7; that is, p is the principal eigenvector (p = X) and can be obtained through iterations.
After completing this 3-part tutorial you should be able to grasp the gist of this paper. The group even made an interesting connection between HITS and LSI (latent semantic indexing).
If you are a student and are looking for a good term paper on Perron-Frobenius Theory and PageRank computations, I recommend you the term paper by Jacob Miles Prystowsky and Levi Gill Calculating Web Page Authority Using the PageRank Algorithm (6). This paper discusses PageRank and some how-to calculations involving the Power Method we have described.
How many iterations are required to compute PageRank values? Only Google knows. According to this Perron-Frobenius review from Professor Stephen Boyd from Stanford (7), the original paper on Google claims that for 24 million pages 50 iterations were required. A lot of things have changed since then, including methods for improving PageRank and new flaws discovered in this and similar link models. These flaws have been the result of the commercial nature of the Web. Not surprisingly, models that work well under controlled conditions and free from noise often fail miserably when transferred to a noisy environment. These topics will be discussed in details in upcoming articles.
Meanwhile, if you are still thinking that the entire numerical apparatus validates the notion that on the Web links can be equated to votes of citation importance or that the treatment validates the link citation-literature citation analogy a la Eugene Garfield's Impact Factors, think again. This has been one of the biggest fallacies around, promoted by many link spammers, few IRs and several search engine marketers with vested interests.
Literature citation and Impact Factors are driven by editorial policies and peer reviews. On the Web anyone can add/remove/exchange links at any time for any reason whatever. Anyone can buy/sell/trade links for any sort of vested interest or overwrite links at will. In such noisy environment, far from the controlled conditions observed in a computer lab, peer review and citation policies are almost absent or at best contaminated by commercialization. Evidently under such circumstances the link citation-literature citation analogy or the notion that a link is a vote of citation importance for the content of a document cannot be sustained.