# Matrix eigenvalues

Calculates a square matrix eigenvalues.

## Matrix eigenvalues

A real number (or a 'scalar') is an eigenvalue for matrix M if there is a non-zero vector `vec v` (called in this case an eigenvector) such as `M * vec v = lambda * vec v`.

This equation can be rewritten as follows (`I` being the identity matrix),

`(M- lambda * I)*vec v = 0`,

therefore,

`det(M- lambda*I) = 0` where the symbol 'det' represents the matrix determinant.

Example: calculate the eigenvalues of the matrix `M = [[1,4],[2,-1]]`

We calculate values of lambda such as `det(M- lambda*I) = 0`

`det(M- lambda*I) = det([[1-lambda,4],[2,-1-lambda]]) = (1-lambda)(-1-lambda) - 8 = lambda^2 - 9 = 0`

The eigenvalues of M are `lambda = 3`, `lambda = -3`