# How do you calculate determinants and eigenvalues in Mathematica?

• Mathematica
• Lambda96
In summary, the conversation was about a bonus assignment involving the use of Mathematica to calculate matrices and their determinants. The person is a beginner with Mathematica and was able to complete some tasks, but is having trouble with task d and getting an error. They are seeking help from others and were able to use a trick to plot the eigenvalues for different values of n without repeating the calculation.
Lambda96
TL;DR Summary
How to calculate eigenvalues, eigenvectors, determinants and inverses of a general nxn matrix
Hi,

In my linear algebra homework, there is a bonus assignment where we are supposed to use Mathematica to calculate matrices and their determinants etc. here is the assignment.

Unfortunately, I am a complete newbie when it comes to Mathematica, this is the first time I have worked with Mathematica.

I was able to calculate the task a to c. Here is the solution for task b and the Matrix for the case ##n=5##.

I have now problems with the task d, where I should calculate the determinants, eigenvalues, etc for the general case n or rather give a formula.

For the determinant as an example I proceeded as follows and unfortunately I get the following error:

Unfortunately I don't know how to fix the error or is my initial equation already wrong?

You can't leave n undefined. Mathematica can't find the rule for arbitrary n by itself. You have to calculate the result for explicit values of n, and then find by yourself the general rule.

Lambda96 and renormalize
As DrClaude says, ##n## must be specified explicitly:

The pattern is pretty obvious.

DrClaude and Lambda96
Thanks DrClaude and renormalize for your help

Thanks also renormalize for the trick with plotting n objects in Mathematica, so I could directly plot the eigenvalues from ##n=1## to ##n=10## without repeating the calculation 10 times

I could now recognize corresponding patterns for the other values

renormalize and DrClaude

## 1. How do I calculate the eigenvalues of a matrix in Mathematica?

To calculate the eigenvalues of a matrix in Mathematica, you can use the Eigenvalues function. For example, if you have a matrix m, you can find its eigenvalues by executing Eigenvalues[m].

## 2. How do I find the eigenvectors of a matrix in Mathematica?

To find the eigenvectors of a matrix in Mathematica, you can use the Eigenvectors function. For a given matrix m, you can obtain its eigenvectors by running Eigenvectors[m].

## 3. How can I compute the determinant of a matrix in Mathematica?

To compute the determinant of a matrix in Mathematica, you can use the Det function. For instance, for a matrix m, you can find its determinant by using Det[m].

## 4. How do I calculate the inverse of a matrix in Mathematica?

To calculate the inverse of a matrix in Mathematica, you can use the Inverse function. Given a matrix m, you can find its inverse by executing Inverse[m].

## 5. How can I perform all these calculations (eigenvalues, eigenvectors, determinant, inverse) for a matrix in a single step in Mathematica?

While there isn't a single built-in function that performs all these calculations simultaneously, you can write a custom function to do so. For example:

matrixCalculations[m_] := {    "Eigenvalues" -> Eigenvalues[m],    "Eigenvectors" -> Eigenvectors[m],    "Determinant" -> Det[m],    "Inverse" -> Inverse[m]}
You can then call matrixCalculations[m] with your matrix m to get all the desired properties.

Replies
1
Views
227
Replies
1
Views
2K
Replies
2
Views
2K
Replies
2
Views
8K
Replies
1
Views
1K
Replies
4
Views
3K
Replies
6
Views
1K
Replies
1
Views
4K
Replies
5
Views
3K
Replies
1
Views
2K