# Singular

#### D.14.3.1 signatureL

Procedure from library `phindex.lib` (see phindex_lib).

Usage:
signatureL(M[,r]); M symmetric matrix, r int (optional).

Return:
the signature of M of type int or if r is given and !=0 then intvec with (signature, nr. of +, nr. of -) is returned.

Theory:
Given the matrix M, we construct the quadratic form associated. Afterwards we use the method of Lagrange to compute the signature. The law of inertia for a real quadratic form A(x,x) says that in a representation of A(x,x) as a sum of independent squares A(x,x)=sum_{i=1}^r a_iX_i^2.
The number of positive and the number of negative squares are independent of the choice of representation. The signature -s- of A(x,x) is the difference between the number -pi- of positive squares and the number -nu- of negative squares in the representation of A(x,x). The rank -r- of M (or A(x,x)) and the signature -s- determine the numbers -pi- and -nu- uniquely, since
r=pi+nu, s=pi-nu.
The method of Lagrange is a procedure to reduce any real quadratic form to a sum of squares.
Ref. Gantmacher, The theory of matrices, Vol. I, Chelsea Publishing Company, NY 1960, page 299.

Example:
 ```LIB "phindex.lib"; ring r=0,(x),ds; matrix M[5][5]=0,0,0,1,0,0,1,0,0,-1,0,0,1,0,0,1,0,0,3,0,0,-1,0,0,1; signatureL(M,1); //The rank of M is 3+1=4 ==> 2,3,1 matrix H[5][5]=0,-7,0,1,0,-7,1,0,0,-1,0,0,1,0,0,1,0,0,-3,5,0,-1,0,5,1; signatureL(H); ==> 1 ```