Function Repository Resource:

# MatrixSign

Evaluate the matrix sign function

Contributed by: Jan Mangaldan
 ResourceFunction["MatrixSign"][m] gives the matrix sign of m. ResourceFunction["MatrixSign"][m,v] gives the matrix sign of m applied to the vector v.

## Details

The matrix sign function was introduced by Roberts in 1971 as a tool for model reduction and for solving Lyapunov and algebraic Riccati equations.
The matrix sign function sgn is defined by sgn(m)=m·(m2)-1/2, where mp is MatrixPower[m,p].
ResourceFunction["MatrixSign"] works only on square matrices.
In ResourceFunction["MatrixSign"][m,v] the matrix m can be a SparseArray object.

## Examples

### Basic Examples (2)

Sign of a 2×2 matrix:

 In[1]:=
 Out[1]=

Sign applied to a vector:

 In[2]:=
 Out[2]=

### Scope (7)

Find the matrix sign of a MachinePrecision matrix:

 In[3]:=
 Out[3]=

Matrix sign of a complex matrix:

 In[4]:=
 Out[4]=

Matrix sign of an exact matrix:

 In[5]:=
 Out[5]=

Matrix sign of an arbitrary-precision matrix:

 In[6]:=
 Out[6]=

Matrix sign of a symbolic matrix:

 In[7]:=
 Out[7]=

Computing the sign of large machine-precision matrices is efficient:

 In[8]:=
 Out[8]=

Directly applying the sign to a single vector is more efficient:

 In[9]:=
 Out[9]=

Directly apply the matrix sign of a sparse matrix to a sparse vector:

 In[10]:=
 Out[10]=

### Properties and Relations (5)

The matrix sign is involutory:

 In[11]:=
 Out[11]=

If m is invertible, its matrix sign has eigenvalues of ±1:

 In[12]:=
 Out[13]=

The matrix sign of a diagonal matrix is diagonal:

 In[14]:=
 Out[14]=

If m is invertible, then sgn(m) is unimodular (has Det(sgn(m))=±1):

 In[15]:=
 Out[15]=
 In[16]:=
 Out[16]=

If m is diagonalizable with m=v-1.d.v, then sgn(m)=v-1.sgn(Re(d)).v:

 In[17]:=
 Out[17]=
 In[18]:=
 Out[18]=

### Neat Examples (1)

Verify an identity involving the matrix sign and the matrix square root:

 In[19]:=
 Out[19]=

## Version History

• 1.0.0 – 23 March 2021