# issymmetric

Determine if a matrix is symmetric or skew-symmetric

### issymmetric(A)

• A should be a square matrix.
• If A is symmetric, scalar, or empty, it returns true.
• If A is not square or ndims(A) > 2, it returns false.

Example 1: B is a real symmetric matrix.

A=[1 2 3;4 5 6;7 8 9];
B=A+A'
issymmetric(B)

B =
2.000   6.000   10.00
6.000   10.00   14.00
10.00   14.00   18.00

ans =
1


### issymmetric(A, skew)

• A is as specified in the description above.
• skew has to be a character array, equal to either 'skew' or 'nonskew'.
• isymmetric(A,'nonskew') gives the same result as isymmetric(A).
• isymmetric(A,'skew') gives true when A is skew symmetric, i.e., for all i and j,

• If A is 0, or empty, it returns true.
• If A is not square or ndims(A) > 2, it returns false.

Example 2: A is complex and skew-symmetric.

A=[1 2 3;4 5 6;7 8 9]+[1 2 3;4 5 6;7 8 9] * i;
A(1,1)=0; A(2,2)=0; A(3,3)=0;
A(1,2)=-A(2,1);
A(1,3)=-A(3,1);
A(2,3)=-A(3,2)
issymmetric(A,'skew')

A =
0.000 + 0.000i  -4.000 - 4.000i  -7.000 - 7.000i
4.000 + 4.000i   0.000 + 0.000i  -8.000 - 8.000i
7.000 + 7.000i   8.000 + 8.000i   0.000 + 0.000i

ans =
1