HermitianMatrixQ seems to ignore a variety of ways I tried to help it get the right answer. For example,

mat = Sum[a[i] PauliMatrix[i], {i, 0, 3}];

Assuming[{a[_] \[Element] Reals}, HermitianMatrixQ[mat]] (* False*)

$Assumptions = {a[_] \[Element] Reals};
HermitianMatrixQ[mat] (* False, even though *)
FullSimplify[mat - mat\[ConjugateTranspose]] (* {{0,0},{0,0}} *)

So, by the last line, we can see that mat really IS hermitian and FullSimplify is powerful enough to demonstrate it. But, HermitianMatrixQ is not, presumably because it's not checking for $Assumptions.

The advice in this question is to specify a SameTest. However, as you might imagine, this may not be an easily sustainable choice when the matrix has more symbolic parameters.


  1. Is there a way to get HermitianMatrixQ to pay attention to assumptions of any kind?
  2. Is this the intended behavior? Is this a bug?
  • $\begingroup$ Since I'm asking if it's a bug, I observed this behavior in $Version=="12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019)". $\endgroup$ – evanb Oct 17 '19 at 17:56
  • $\begingroup$ As a workaround, changing a[_] to Re[a[_]] as Array[Re[a[#]] &, 4, 0].Array[PauliMatrix, 4, 0] // HermitianMatrixQ yields True. $\endgroup$ – NonDairyNeutrino Oct 17 '19 at 18:52
  • $\begingroup$ A friend points out this related gem: Assuming[{a \[Element] Reals}, Conjugate[a]] yields Conjugate[a]. $\endgroup$ – evanb Oct 17 '19 at 22:29
  • 1
    $\begingroup$ Yes it is intended. No it is not a bug. Documentation for Assuming states it only affects functions that take Assumptions as an option. Those are listed in the Properties & Relations section. $\endgroup$ – Daniel Lichtblau Oct 17 '19 at 22:41
  • $\begingroup$ So why does HermitianMatrixQ not accept assumptions, rather than the relatively unusual SameTest? $\endgroup$ – evanb Oct 17 '19 at 22:59

Your Answer

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

Browse other questions tagged or ask your own question.