trace takes as argument a matrix A. trace returns the trace of the matrix A, that is the sum of the diagonal elements. Input:
Output: