Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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. – Daniel Lichtblau Aug 16 '13 at 15:18
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? – Jens Aug 16 '13 at 19:37
@Daniel Lichtblau All of them. Thanks! – Eden Harder Aug 17 '13 at 2:32
@Jens All of them, thanks! – Eden Harder Aug 17 '13 at 2:32
up vote 3 down vote accepted

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];
share|improve this answer
Thanks a lot! Since this is not the direct way, it may be not so fast. – Eden Harder Aug 17 '13 at 2:36
@EdenHarder It seems very fast to me. What do you mean by "not direct?" – Jens Aug 17 '13 at 6:53
@Jens 'Direct' means we produce it without any other matrice, for example, 't' here. – Eden Harder Aug 17 '13 at 7:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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