Symmetric Matrix − A matrix whose transpose is equal to the matrix itself. Then it is called a symmetric matrix.
Skew-symmetric matrix − A matrix whose transpose is equal to the negative of the matrix, then it is called a skew-symmetric matrix.
The sum of symmetric and skew-symmetric matrix is a square matrix. To find these matrices as the sum we have this formula.
Let A be a square matrix. then,
A = (½)*(A + A`)+ (½ )*(A - A`),
A` is the transpose of the matrix.
(½ )(A+ A`) is symmetric matrix.
(½ )(A - A`) is a skew-symmetric matrix.
Example
#include <bits/stdc++.h> using namespace std; #define N 3 void printMatrix(float mat[N][N]) { for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) cout << mat[i][j] << " "; cout << endl; } } int main() { float mat[N][N] = { { 2, -2, -4 }, { -1, 3, 4 }, { 1, -2, -3 } }; float tr[N][N]; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) tr[i][j] = mat[j][i]; float symm[N][N], skewsymm[N][N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { symm[i][j] = (mat[i][j] + tr[i][j]) / 2; skewsymm[i][j] = (mat[i][j] - tr[i][j]) / 2; } } cout << "Symmetric matrix-" << endl; printMatrix(symm); cout << "Skew Symmetric matrix-" << endl; printMatrix(skewsymm); return 0; }
Output
Symmetric matrix - 2 -1.5 -1.5 -1.5 3 1 -1.5 1 -3 Skew Symmetric matrix - 0 -0.5 -2.5 0.5 0 3 2.5 -3 0