# Ruby | Matrix eigensystem() function

The eigensystem() is an inbuilt method in Ruby returns the Eigensystem of the matrix.

Syntax: mat1.eigensystem()

Parameters: The function does not accepts any parameter.

Return Value: It returns the Eigensystem of the matrix.

Example 1:

 `# Ruby program for eigensystem() method in Matrix ` ` `  `# Include matrix  ` `require ``"matrix"` ` `  `# Initialize a matrix  ` `mat1 = Matrix[[``1``, ``0``], [``0``, ``2``]]        ` ` `  `# prints the eigensystem ` `puts  mat1.eigensystem() `

Output:

```Matrix[[1.0, 0.0], [0.0, 1.0]]
Matrix[[1.0, 0], [0, 2.0]]
Matrix[[1.0, 0.0], [0.0, 1.0]]
```

Example 2:

 `# Ruby program for eigensystem() method in Matrix ` ` `  `# Include matrix  ` `require ``"matrix"` ` `  `# Initialize a matrix  ` `mat1 =  Matrix[[``1``, ``1``, ``5``], [``4``, ``1``, ``5``], [``11``, ``2``, ``12``]]         ` ` `  `# prints the eigensystem ` `puts  mat1.eigensystem() `

Output:

```Matrix[[0.3051508362231803, 0.8432205915902499, -0.04211389264475984], [0.36021591185448126, -0.07469426749056905, -1.0068644256268935], [0.881548333331269, -0.6184679554209885, 0.20869263449203795]]
Matrix[[16.624920572145022, 0, 0], [0, -2.7558784453101666, 0], [0, 0, 0.13095787316514576]]
Matrix[[0.6383015261676529, 0.14992783363808046, 0.8521544829905635], [0.9627740639327973, -0.10080816379994396, -0.2920754272026449], [0.15693539149903699, -0.9320657209209471, 0.3265344924799822]]```

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.