Data Structures & AlgorithmsModerateICPC regional · GATE CS

Problem: The matrix [[2,0],[0,3]] is raised to the power 4 (matrix power). What is the sum of all entries of the result?

  1. A. 625
  2. B. 97
  3. C. 20
  4. D. 1296

Correct answer: B. 97

A diagonal matrix powers entry-wise on its diagonal: diag(16, 81), whose entries sum to 97. (2 + 3)⁴ gives 625, multiplying by 4 gives 20, and 6⁴ = 1296 is the determinant's power.

More Coding Interview Problems questions

Exams that ask this topic