CREATE OWN LIBRARY

Skew Symmetric Matrix

Back to Programming

Description

In linear algebra, a matrix is said to be skew-symmetric, if the transpose is equal to the negative of the square matrix. The skew-symmetric matrix is only possible to check if it is a square matrix. Otherwise, the number of rows and columns in the original matrix will differ from the number of rows and columns in the transpose matrix.

The transpose of a matrix can be defined as a new matrix whose rows are the columns of the original matrix and the columns are the rows of the original matrix. If A is a matrix then its transpose is denoted as AT.

 

For example:

If a matrix is:

Then the transpose of the matrix is:

 

EXAMPLE OF THE SKEW SYMMETRIC MATRIX:

Let the matrix be: 

Now the transpose matrix will be:

 

Now, if we compare each element of matrix A with each element of matrix ATindex wise, we will get that AT = -A.

Therefore, matrix A is said to be a skew-symmetric matrix.

Algorithm

INPUT: A matrix A
OUTPUT: whether it is skew symmetric or not

PROCESS:
Step 1: [Taking the inputs]
	Read m, n [The number of rows and columns of the matrix]
Step 2: [Checking for a symmetric matrix]
		If m=n then
		[taking the elements of the matrix]
		For i=0 to m-1 repeat
			For j=0 to n-1 repeat
				Read a[i][j]
			[End of ‘for’ loop]
		[End of ‘for’ loop]
		[finding the transpose of a matrix]
	 	for i = 0 to m-1 repeat
        			for j = 0 to n-1 repeat
        				Set t[j][i]<-a[i][j]
			[End of ‘for’ loop]
		[End of ‘for’ loop]
		[printing the transpose matrix]
		Print "The transpose of the matrix is:"
		For i=0 to n-1 repeat
			For j=0 to m-1 repeat
				Print t[i][j]
				If j=m-1 then
					Move to the next line
				[End of ‘if’]
			[End of ‘for’ loop]
		[End of ‘for’ loop]
		[checking if the matrix is skew symmetric]
		For i= 0 to m-1 repeat 
        			For j= 0 to n-1 repeat
            				If -a[i][j] ≠ t[i][j] then
                				Print "The Matrix is not Skew Symmetric"
                				exit 
				[End of ‘if’]
        			[End of ‘for’ loop]
    		[End of ‘for’ loop]
    		Print "The matrix is skew symmetric”
	else
		print "The matrix is not a square matrix"
[End of ‘if’]
Step 3: Stop.

TIME COMPLEXITY:

 for(i= 0;i < n; i++)-------------- O(n) 

    { for(j= 0; j< n; j++)--------- O(n)

        { if(-a[i][j] != t[i][j]) ------- O(c1)

                {  printf("\nThe Matrix is not Symmetric\n");

                 exit(0); 

                }

        }

    }

Here c1 is constant so, the time complexity is: O(n*n*c1)= O(n2).