Home > Backend Development > C++ > Can a square matrix be expressed as the sum of a symmetric matrix and an antisymmetric matrix?

Can a square matrix be expressed as the sum of a symmetric matrix and an antisymmetric matrix?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-09-13 17:05:02
forward
1297 people have browsed it

Can a square matrix be expressed as the sum of a symmetric matrix and an antisymmetric matrix?

Symmetric matrix - A matrix whose transpose is equal to the matrix itself. Then it is called symmetric matrix.

Antisymmetric Matrix - Its transpose is equal to the negative value of the matrix, then it is called antisymmetric matrix.

The sum of a symmetric matrix and an antisymmetric matrix is ​​a square matrix. To find the sum of these matrices we have the following formula.

Suppose A is a square matrix. Then,

A = (½)*(A A`) (½ )*(A - A`),

A` is the transpose of the matrix.

(½ )(A A`) is a symmetric matrix.

(½ )(A - A`) is an antisymmetric 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;
}
Copy after login

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
Copy after login

The above is the detailed content of Can a square matrix be expressed as the sum of a symmetric matrix and an antisymmetric matrix?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template