answersLogoWhite

0


Best Answer

means whether the matrix is same or not

program for symmetric matrix :

include<stdio.h>

#include<conio.h>

main()

{

int a[10][10],at[10][10],k,i,j,m,n;

clrscr();

printf("enter the order of matrix");

scanf("%d %d",&m,&n);

printf("enter the matrix");

for(i=0;i<m;i++)

{

for(j=0;j<n;j++)

scanf("%d",&a[i][j]);

}

for(i=0;i<m;i++)

{

for(j=0;j<n;j++)

at[i][j]=a[j][i];

}

for(i=0;i<m;i++)

{

for(j=0;j<n;j++)

{

if(at[i][j]!=a[i][j])

k=1;

}

}

if(k==1)

printf("not symmetric");

else

printf("symmetric");

getch();

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

8y ago

First we find transpose of a matrix and then compare it with the original matrix. For a symmetric matrix A^T = A.

  • Step 1 - Accepts a square matrix as input
  • Step 2 - Create a transpose of a matrix and store it in an array
  • Step 3 - Check if input matrix is equal to its transpose or not

    If it is equal, then the input square matrix is symmetric.

Please find the program attached to find the matrices symmetricity.

To find whether a matrix symmetric or not we can use the following code:

for(i=0;i

for(j=0;j

if(a[i][j]!=a[j][i])

{ch='n';}

This answer is:
User Avatar

User Avatar

Wiki User

12y ago
  1. #include
  2. using namespace std;
  3. const int MAXROW = 10;
  4. const int MAXCOL = 10;
  5. int main()
  6. {
  7. srand(time(NULL));
  8. int a [MAXROW][MAXCOL];
  9. for (int row = 0; row < MAXROW; row++)
  10. {
  11. for (int col = 0; col < MAXCOL; col++)
  12. {
  13. a[row][col] = rand() % 10;
  14. cout << a[row][col]<< "\t";
  15. if (a[row][col] == a[col][row])
  16. cout << "Symmetric" << endl;
  17. else
  18. cout << "Not symmetric" << endl;
  19. }
  20. cout << endl;
  21. }
  22. return 0;
  23. }
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program using c plus plus to check whether the given square matrix is symmetric or not?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a skew symmetric matrix?

A skew symmetric matrix is a square matrix which satisfy, Aij=-Aji or A=-At


What is a symmetric matrix?

a square matrix that is equal to its transpose


What is the definition of a symmetric matrix?

Symmetric Matrix:Given a square matrix A such that A'=A, where A' is the transpose of A, then A is a symmetric matrix.note: No need to think about diagonal elements, they can be anything.


Is null square matrix a skew symmetric?

yes, it is both symmetric as well as skew symmetric


What is the definition of a matrix?

Symmetric Matrix:Given a square matrix A such that A'=A, where A' is the transpose of A, then A is a symmetric matrix.note: No need to think about diagonal elements, they can be anything.


what is the definition of The Matrix?

Symmetric Matrix:Given a square matrix A such that A'=A, where A' is the transpose of A, then A is a symmetric matrix.note: No need to think about diagonal elements, they can be anything.


What is the symbol for skew?

In linear algebra, a skew-symmetric matrix is a square matrix .....'A'


How do you write a program in c plus plus to check if an array is symmetric?

To determine if an array is symmetric, the array must be square. If so, check each element against its transpose. If all elements are equal, the array is symmetric.For a two-dimensional array (a matrix) of order n, the following code will determine if it is symmetric or not:templatebool symmetric(const std::array& matrix){for (size_t r=0 ; r


What type of matrix is a vector?

Vector matrix has both size and direction. There are different types of matrix namely the scalar matrix, the symmetric matrix, the square matrix and the column matrix.


Can a zero matrix be a skew symmetric matrix?

My knowledge limits to square matrices. The answer is yes, because 0 = -0


What is the definition of an anti-symmetric matrix?

The Definition of an Anti-Symmetric Matrix:If a square matrix, A, is equal to its negative transpose, -A', then A is an anti-symmetric matrix.Notes:1. All diagonal elements of A must be zero.2. The cross elements of A must have the same magnitude, but opposite sign.


What is bisymmetry?

Bisymmetry is the state or quality of being bisymmetric - symmetric around both of the main diagonals of a square matrix.