As we know, there are only $\frac{n(n+1)}{2}$ variables in a symmetric $n$-dimensional semi-definite matrix. Is it possible to produce a $n$-dimensional semi-definite matrix whose trace is $1$ using only $\frac{n(n+1)}{2}-1$ variables, $\frac{n(n+1)}{2}$ from symmetry and one from the trace constraint?

If so, what is the best way?

Till now, I can produce a $n$-dimensional semi-definite matrix $\rho$ whose trace is $1$ in the way

t = ({
  {a, b, c, d},
  {e, f, g, h},
  {i, j, k, l},
  {m, n, o, p}
ρ = t.t\[Transpose]/Total[Flatten[t]^2];

but I need $n^2$ variables and sometimes Total[Flatten[t]^2] may be zero because of semi-definiteness. Any help or suggestions will be appreciated.

  • $\begingroup$ Here is a possible approach. (1) Pick the elements above the main diagonal. (2) Symmetrize (so the main diagonal is zeros). (3) Now pick the main diagonal elements to be at least as large as the sums of absolute values of the rest of elements on their respective rows. (4) Normalize (divide the matrix by the sun of the main diagonal elements). This will give pos semidef matrices although by no means will it give all such matrices. $\endgroup$ Aug 16, 2013 at 15:18
  • $\begingroup$ Possibly related: Constructing a symbolic Hermitian matrix. But usually positive semi-definiteness means that the eigenvalues have to be non-negative. Is that what you're actually after? Does the parametrization have to produce just some such matrices or all of them? $\endgroup$
    – Jens
    Aug 16, 2013 at 19:37
  • $\begingroup$ @Daniel Lichtblau All of them. Thanks! $\endgroup$ Aug 17, 2013 at 2:32
  • $\begingroup$ @Jens All of them, thanks! $\endgroup$ Aug 17, 2013 at 2:32

1 Answer 1


Use a lower-triangular t:

t = {
{a, 0, 0, 0},
{b, c, 0, 0},
{d, e, f, 0},
{g, h, i, j}};
p = # / Tr@# & [t.Transpose@t];
  • $\begingroup$ Thanks a lot! Since this is not the direct way, it may be not so fast. $\endgroup$ Aug 17, 2013 at 2:36
  • $\begingroup$ @EdenHarder It seems very fast to me. What do you mean by "not direct?" $\endgroup$
    – Jens
    Aug 17, 2013 at 6:53
  • $\begingroup$ @Jens 'Direct' means we produce it without any other matrice, for example, 't' here. $\endgroup$ Aug 17, 2013 at 7:24

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.