# powerMethod: Power Method for Eigenvectors In matlib: Matrix Functions for Teaching and Learning Linear Algebra and Multivariate Statistics

## Description

Finds a dominant eigenvalue, λ_1, and its corresponding eigenvector, v_1, of a square matrix by applying Hotelling's (1933) Power Method with scaling.

## Usage

 1 powerMethod(A, v = NULL, eps = 1e-06, maxiter = 100, plot = FALSE) 

## Arguments

 A a square numeric matrix v optional starting vector; if not supplied, it uses a unit vector of length equal to the number of rows / columns of x. eps convergence threshold for terminating iterations maxiter maximum number of iterations plot logical; if TRUE, plot the series of iterated eigenvectors?

## Details

The method is based upon the fact that repeated multiplication of a matrix A by a trial vector v_1^{(k)} converges to the value of the eigenvector,

v_1^{(k+1)} = A v_1^{(k)} / \vert\vert A v_1^{(k)} \vert\vert

The corresponding eigenvalue is then found as

λ_1 = \frac{v_1^T A v_1}{v_1^T v_1}

In pre-computer days, this method could be extended to find subsequent eigenvalue - eigenvector pairs by "deflation", i.e., by applying the method again to the new matrix. A - λ_1 v_1 v_1^{T} .

This method is still used in some computer-intensive applications with huge matrices where only the dominant eigenvector is required, e.g., the Google Page Rank algorithm.

## Value

a list containing the eigenvector (vector), eigenvalue (value), iterations (iter), and iteration history (vector_iterations)

## Author(s)

Gaston Sanchez (from matrixkit)

## References

Hotelling, H. (1933). Analysis of a complex of statistical variables into principal components. Journal of Educational Psychology, 24, 417-441, and 498-520.

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 A <- cbind(c(7, 3), c(3, 6)) powerMethod(A) eigen(A)$values[1] # check eigen(A)$vectors[,1] # demonstrate how the power method converges to a solution powerMethod(A, v = c(-.5, 1), plot = TRUE) B <- cbind(c(1, 2, 0), c(2, 1, 3), c(0, 3, 1)) (rv <- powerMethod(B)) # deflate to find 2nd latent vector l <- rv$value v <- c(rv$vector) B1 <- B - l * outer(v, v) powerMethod(B1) eigen(B)$vectors # check # a positive, semi-definite matrix, with eigenvalues 12, 6, 0 C <- matrix(c(7, 4, 1, 4, 4, 4, 1, 4, 7), 3, 3) eigen(C)$vectors powerMethod(C) 

matlib documentation built on April 4, 2018, 5:03 p.m.