Matrix Determinant & Trace

Matrix Algebra DS practice problem on Onlearn.

Difficulty: medium.

Topics: Understanding Matrix Determinants and Traces, Laplace Expansion, Minor Matrix Calculation, Trace Summation, Base Case for Recursion, Matrix Indexing and Slicing, Linear Algebra, Numerical Analysis, Matrix Theory, Computational Mathematics, Vector Spaces, Matrix Operations, Recursive Algorithms, Cofactor Expansion, Diagonal Properties, Recursive Decomposition.

Given a square matrix represented as a list of lists, implement two functions: 'get trace(matrix)' which calculates the sum of diagonal elements, and 'get determinant(matrix)' which calculates the determinant using recursive cofactor expansion. Assume the input is a valid square matrix.