MATLAB Incorrectly Calculating Eigenvalues of Unitary Matrix

Click For Summary
SUMMARY

The forum discussion centers on the issue of MATLAB incorrectly calculating the eigenvalues of a unitary matrix. The user provided a matrix A defined as A=[1/sqrt(2),i/sqrt(2),0; -1/sqrt(2),i/sqrt(2),0; 0,0,1] and observed that the eigenvalues returned by the eig function do not satisfy the property |\lambda| = 1 for unitary matrices. A suggestion was made to check the eigenvalues using the abs function, which confirmed that the magnitudes are indeed 1. Additionally, the correct method to verify if A is unitary involves using the ctranspose function, not the Hermitian conjugate.

PREREQUISITES
  • Understanding of unitary matrices and their properties
  • Familiarity with MATLAB syntax and functions, specifically eig and ctranspose
  • Knowledge of complex numbers and their representation in MATLAB
  • Basic linear algebra concepts, particularly eigenvalues and eigenvectors
NEXT STEPS
  • Learn how to use MATLAB's ctranspose function for matrix operations
  • Explore the properties of unitary matrices in depth
  • Investigate the behavior of MATLAB's eig function with different types of matrices
  • Study the implications of complex eigenvalues in linear algebra
USEFUL FOR

This discussion is beneficial for MATLAB users, mathematicians, and engineers who are working with complex matrices and need to understand eigenvalue calculations in the context of unitary matrices.

ColdFusion85
Messages
141
Reaction score
0
This is a MATLAB question. I am trying to find the eigenvalues of a matrix with both real and complex numbers. This is my session.

>> A=[1/sqrt(2),i/sqrt(2),0; -1/sqrt(2),i/sqrt(2),0; 0,0,1]

A =

0.7071, 0 + 0.7071i, 0
-0.7071, 0 + 0.7071i, 0
0, 0, 1.0000

>> eig(A)

ans =

0.9659 - 0.2588i
-0.2588 + 0.9659i
1.0000

However, matrix A is unitary, so |\lambda| should equal 1. This is true for the third eigenvalue, but not for the other two. I even noticed that MATLAB fails to confirm A is unitary:

A =

0.7071, 0 + 0.7071i, 0
-0.7071, 0 + 0.7071i, 0
0, 0, 1.0000

>> B=[1/sqrt(2),-1/sqrt(2),0; i/sqrt(2),i/sqrt(2),0;0,0,1]

B =

0.7071, -0.7071, 0
0 + 0.7071i, 0 + 0.7071i, 0
0, 0, 1.0000

>> A*B

ans =

0, -1, 0
-1, 0, 0
0 , 0, 1

Why is MATLAB giving me incorrect answers? It was even doing this for me yesterday when I was dealing with real matricies. It was giving me eigenvalues with imaginary components when they were, in fact, all real. What's the deal?
 
Physics news on Phys.org
ColdFusion85 said:
However, matrix A is unitary, so |\lambda| should equal 1. This is true for the third eigenvalue, but not for the other two.
Have you checked using the abs function for each eigenvalue? I get 1 on checking for each eigenvalue.
ColdFusion85 said:
I even noticed that MATLAB fails to confirm A is unitary
Are you trying to find the Hermitian conjugate of A and multiplying A with it to get I? Don't do it like that. Use ctranspose(A)*A. You'll surely get the identity matrix.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
0
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
2
Views
3K
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K