# $$\text{IsSymmetric}$$¶

You can use the $$\text{IsSymmetric}$$ to determine if a matrix is symmetric.

You can use the \issymmetric backslash command to insert this function.

The following variants of this function are available:

• $$\text{boolean } \text{IsSymmetric} \left ( \text{<matrix>} \right )$$

• $$\text{boolean } \text{IsSymmetric} \left ( \text{<matrix>}, \text{<relative tolerance>} \right )$$

The $$\text{<matrix>}$$ parameter is the matrix to be tested. The optional $$\text{<relative tolerance>}$$ parameter specifies the tolerance to apply when comparing values. If not specified, the $$\text{IsSymmetric}$$ function will use a tolerance of $$1.0 \times 10^{-8}$$.

A matrix, $$M$$, is considered symmetric if $$M = M ^ T$$. This function relaxes this constraint by allowing a test to within a given tolerance. The $$\text{IsSymmetric}$$ function considers a matrix to be symmetric if the matrix is square and:

$\left \vert M _ { i,j } - M _ { j,i } \right \vert \leq \frac{1}{2} \left \vert M _ { i,j } + M _ { j,i } \right \vert t _ {rel}$

For all $$1 \leq i \leq \text{nrows} \left ( M \right )$$ and $$1 \leq j \leq i$$ where $$t _ {rel}$$ is the relative tolerance. Note that this test is only applied if $$M _ { i,j } \ne M _ { j,i }$$.

Figure 162 shows the basic use of the $$\text{IsSymmetric}$$ function.

Figure 162 Example Use Of The IsSymmetric Function