I would like to use the Count[list, pattern] method to count all 4x4 matrices with entries in $\lbrace 0 ,1 \rbrace$ that have a certain Jordan canonical form. The problem is that I haven't the slightest clue how to "generate" the family of matrices or phrase the rule in the argument of Count... how would I go about these things? Any help is much appreciated (and sorry if this is a basic question that could've been found with more persistent google-ing).

  • $\begingroup$ It's very hard to give advice as to how to generate the family of matrices without any details about this family. $\endgroup$ – yohbs Feb 16 '18 at 3:01
  • $\begingroup$ @yohbs The only rules I have for this family are that all matrices should be 4x4 and the entries should be either 0 or 1. From there, I want to count all of the matrices in this family that have a certain Jordan form (pattern argument). $\endgroup$ – Dan Feb 16 '18 at 3:04
fourbyfourbinarymatrices = Tuples[{0, 1}, {4, 4}];

Length @ fourbyfourbinarymatrices


Among the first 1000 elements of fourbyfourbinarymatrices 136 of them have a JordanDecomposition whose first component has a trace equal to 2:

Count[fourbyfourbinarymatrices[[;; 1000]],
   _?(Tr[JordanDecomposition[#][[1]]] == 2 &)]


And 4 of them have a similarity matrix in their JordanDecomposition that is equal to Reverse/@IdentityMatrix[4]:

Count[fourbyfourbinarymatrices[[;; 1000]], 
  _?(JordanDecomposition[#][[1]] === (Reverse /@ IdentityMatrix[4]) &)]


| improve this answer | |
  • $\begingroup$ The concrete constructions and examples are very helpful. Thanks a bunch! Follow-up question: how does Mathematica enumerate the tuples in our matrix list? $\endgroup$ – Dan Feb 16 '18 at 3:27
  • 1
    $\begingroup$ @Dan, glad it was useful. Thank you for the accept. Welcome mma.se. Re how Tuples enumerates the tuples, I don't know how it is implemented. $\endgroup$ – kglr Feb 16 '18 at 3:32
  • 2
    $\begingroup$ @Dan This should give you some hint: base = 2; FromDigits[Flatten[#], base] & /@ Tuples[Range[0, base-1], {4, 4}][[1 ;; 10]] ;o) Does also work with other bases... $\endgroup$ – Henrik Schumacher Feb 16 '18 at 7:04
Count[myMatrixList, # == JordanDecomposition[#]&]
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.