PIXELBANKv8.2.1
Menu

Matrix Operations

Problem Statement

Perform common matrix operations.

Background

NumPy linear algebra operations:

  • np.linalg.inv(A) - matrix inverse
  • np.linalg.det(A) - determinant
  • np.trace(A) - trace (sum of diagonal)
  • A.T - transpose

Your Task

Write a function matrix_ops(mat) that computes matrix properties.

Output Format

Return a dictionary with:

  • "transpose": Transposed matrix (list)
  • "trace": Sum of diagonal elements
  • "determinant": Determinant (rounded to 2 decimals)
  • "is_symmetric": True if mat == mat.T

Example:

Input:
[[1, 2], [3, 4]]
Output:
{'transpose': [[1, 3], [2, 4]], 'trace': 5, 'determinant': -2.0, 'is_symmetric': False}
Reasoning:

trace = 1+4 = 5, det = 14 - 23 = -2, not symmetric since [0,1] ≠ [1,0]

Constraints:

  • mat is a square matrix
  • Round determinant to 2 decimal places
Editor

Test Results

0/0
Run code to see test results.