A Hermitian matrix of dimension $N$ has $N^2$ real parameters. However, in the answer by rcollyer I see a larger number of parameters in the form of complex numbers (which means the representation isn't unique). In Heike's solution (which is from the documentation for `HermitianMatrixQ`

) we have to write `Re[n]`

on the diagonal which is OK in principle but creates the impression as if `n`

as a complex number has significance, which of course it doesn't.

So one should be able to specify the real-valuedness of the diagonal elements as an assumption instead. That's what I'm testing below:

```
Clear[h];
mat =
Table[If[i <= j, h[i, j], Conjugate[h[j, i]]], {i, 3}, {j, 3}];
MatrixForm[mat]
```

$\left(
\begin{array}{ccc}
h(1,1) & h(1,2) & h(1,3) \\
h(1,2)^* & h(2,2) & h(2,3) \\
h(1,3)^* & h(2,3)^* & h(3,3) \\
\end{array}
\right)$

The documentation states that `HermitianMatrixQ[mat]`

is "effectively" equivalent to `ConjugateTranspose[mat] == mat`

. Let's see if that is true:

```
Assuming[{Apply[And, Map[# ∈ Reals &, Diagonal[mat]]]},
Simplify[ConjugateTranspose[mat] == mat]]
(* ==> True *)
Assuming[{Apply[And,
Map[# ∈ Reals &, Diagonal[mat]]]},
Simplify[HermitianMatrixQ[mat]]]
(* ==> False *)
```

It is not the same. So it may be that the problems of the OP have to do with this inconsistency. My suggestion therefore would be to **avoid** using `HermitianMatrixQ`

as a test, and use the first variant instead.

**Edit**

Since `HermitianMatrixQ`

appears to be used internally, we're stuck with it and need to follow Heike's answer, or the one I give below.

The key word in the documentation is that the matrix passed to `HermitianMatrixQ`

must be **explicitly** hermitian. This means that although it does evaluate its arguments, it doesn't evaluate properly with `$Assumptions`

when attempting to `Simplify`

. That appears to severely limit the extent to which one can do symbolic matrix manipulations. I just checked that the same behavior also happens for `SymmetricMatrixQ`

.

**Edit 2: a new solution without **`Re[...]`

This seems to be the general policy for *all* conditionals that end in `...Q`

: the test is performed syntactically without using assumptions.

To get a neat representation of a hermitian matrix that is *manifestly* hermitian, one could use the following definition:

```
dimension = 3;
Clear[h];
diagonal = Table[Unique["h"], {dimension}];
Map[(# /: Conjugate[#] = #) &, diagonal];
mat = Table[
If[i <= j, h[i, j], Conjugate[h[j, i]]], {i, dimension}, {j,
dimension}];
mat = mat - DiagonalMatrix[Diagonal[mat]] + DiagonalMatrix[diagonal];
MatrixForm[mat]
```

$\left(
\begin{array}{ccc}
\text{h3} & h(1,2) & h(1,3) \\
h(1,2)^* & \text{h4} & h(2,3) \\
h(1,3)^* & h(2,3)^* & \text{h5} \\
\end{array}
\right)$

```
HermitianMatrixQ[mat]
```

`True`

Here I did *not* have to forcibly use real parts `Re`

on the diagonals. Instead, I used `TagSet`

to define the complex conjugate of each diagonal element to be equal to itself. That is sufficient to convince Mathematica that it is a real number.

1You might be surprised to find that

`CholeskyDecomposition[{{a, b, c}, {b, d, e}, {c, e, f}}]`

works as expected... – J. M.'s ennui – 2012-05-14T15:38:26.117The root cause of this problem is the issue described in this answer by @Leonid - that's at least the conclusion I drew in my answer below.

– Jens – 2012-05-14T22:31:08.720