Question: A matrix is symmetric if every element of the matrix at row i and column j is equal to theelement at row j and column

A matrix is symmetric if every element of the matrix at row i and column j is equal to theelement at row j and column i. A matrix can only be symmetric if it is a square matrix(that is, the matrix has the same number of rows as columns).  Your task is to construct a Python function called symmetric which expects one argument: a two-dimensional table representing a square matrix. Your function should return True if the matrix is symmetric and False otherwise. You may assume that the table passed as the argument will have the same number of rows as columns and that it will contain only numbers.  Here are some examples of how your function should behave:

>>> m1 = [[5, 4, 3], [4, 0, 7], [3, 7, -1]]

>>> m2 = [[5, 4, 3], [4, 0, 6], [3, 7, -1]]

>>> m3 = [[0, 0], [0, 0]]

>>> m4 = [[0, 0], [1, 0]]

>>> symmetric(m1)True

>>> symmetric(m2)False

>>> symmetric(m3)True

>>> symmetric(m4)False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

You can create the symmetric function as follows def symmetricmatrix Check if ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!