Problem 4: Transpose and Identity Verification
Easypython
Problem Description
Write a Python program that takes a square matrix, computes its transpose, and then verifies that multiplying the original matrix by an identity matrix of the same size returns the original matrix unchanged.
Input
A square matrix (as a nested list).
Output
The transposed matrix, and a confirmation message that multiplying by the identity matrix leaves the original unchanged.
Constraints
- The input matrix must be square (same number of rows and columns).
Example Input
textmatrix = [[1,2],[3,4]]
Example Output
textTranspose: [[1 3] [2 4]] Matrix unchanged after identity multiplication: True
Concepts Covered
.T (transpose), np.eye(), np.matmul(), array comparison.