Learn How To Find if a Matrix is a Skew Symmetric Matrix in C Programming. The following C programs use functions, arrays and Transpose concepts to check if a Square Matrix is Skew Symmetric or not.
What is a Skew Symmetric Matrix?
A Skew Symmetric Matrix is the one that is negative of its Transpose Matrix. A Matrix whose Transpose is negative to that of the original Matrix, it is known as a Skewed Symmetric Matrix.
Example
Input Matrix
0 5 -4
-5 0 1
4 -1 0
Transpose Matrix
0 -5 4
5 0 -1
-4 1 0
Since the Input Matrix and the Transpose are Negatives of each other, the Matrix is Skew Symmetrical.
Algorithm To Find Skew Matrix
- Input the Matrix from the User.
- Find the Transpose of the Matrix.
- If the Input Matrix is equal to the negative of its Transpose Matrix, then the Matrix is Skew Symmetrical.
Method 1: C Program To Find if a Matrix is Skew Symmetric Matrix or Not without Functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #include<stdio.h> int main() { int matrix[3][3]; int row, column, a, b, x = 0; printf("Enter the Number of Rows:\t"); scanf("%d", &a); printf("Enter the Number of Columns:\t"); scanf("%d", &b); printf("\nEnter the Elements of the Square Matrix of Dimension [%d][%d]\n", row_limit, column_limit); for(row = 0; row < a; row++) { for(column = 0; column < b; column++) { printf("Enter Element:\t"); scanf("%d", &matrix[row][column]); } } printf("\nEntered Matrix\n"); for(row = 0; row < a; row++) { for(column = 0; column < b; column++) { printf("%d\t", matrix[row][column]); } printf("\n"); } for(row = 0; row < a; row++) { for(column = 0; column < b; column++) { if(matrix[row][column] != -matrix[column][row]) { x = 1; break; } } } if(x == 1) { printf("\nThe Entered Matrix is Not A Skewed Symmetric Matrix\n"); } else { printf("\nThe Entered Matrix is A Skewed Symmetric Matrix\n"); } return 0; } |
Method 2: C Program To Check Skewed Symmetric Matrix using Functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #include<stdio.h> void tranpose(); void getmatrix(); int check(); int m, n, rows, columns; int matrix[3][3], transpose[3][3]; int main() { int x; printf("Enter the Number of Rows:\t"); scanf("%d", &m); printf("Enter the Number of Columns:\t"); scanf("%d", &n); printf("\nEnter the Elements of the Square Matrix of Dimension [%d][%d]\n", m, n); getmatrix(); tranpose(); x = check(); if(x == 0) { printf("\nThe Entered Matrix is A Skewed Symmetric Matrix\n"); } else { printf("\nThe Entered Matrix is Not A Skewed Symmetric Matrix\n"); } return 0; } void tranpose() { for(rows = 0 ; rows < m ; rows++) { for(columns = 0; columns < n; columns++) { transpose[columns][rows] = matrix[rows][columns]; } } } void getmatrix() { for(rows = 0; rows < m; rows++) { for(columns = 0; columns < n; columns++) { printf("Enter Element:\t"); scanf("%d", &matrix[rows][columns]); } } } int check() { if(m == n) { for(rows = 0; rows < m; rows++) { for(columns = 0; columns < m; columns++) { if(matrix[rows][columns] != -transpose[rows][columns]) { break; } } if(columns != m) { break; } } if(rows == m) { return 0; } } else { return 1; } } |
Output

In case you get any compilation errors or any doubts in this C Program To Check if a Matrix is Skew Symmetrical or Not, let us know about it in the comment section below.