Search code examples
rlinear-algebrasolvereigenvalue

Solve for a matrix if I have a desired first eigenvalue with R?


Here is a simplified version of my problem. Suppose I have the following matrix:

[0  4x
.6   0]

I want to solve for x given that I want my first (biggest) eigenvalue to be equal to 1. Is there an easy way to solve this in R?


Solution

  • Try

    f <- function(x){
        m <- matrix(c(0, 4*x, .6, 0), 2, 2, byrow=TRUE)
        Re(eigen(m)$values[1]) - 1
    }
    uniroot(f, c(-1, 1))$root