Example

I am taking a look at the following question to create a function to find the characteristic polynomial of a matrix.

Find the characteristic polynomial of the matrix:

##      [,1] [,2] [,3]
## [1,]    3    2    1
## [2,]    0    1    1
## [3,]    1    2    0

Theorem

Solution

The following code block prints the characteristic polynomial for a 3x3 matrix. I am interested in finding more general solutions for this problem as well.

## [1] "-1x^3 + 4x^2 + -5"