Manipulate doesn’t work for plotting a region where a matrix is positive semi-definite

I’m facing the following problem and would very much like you help. Thanks is advance!

I have defined the following 4×4 matrix:
\frac{1}{r^2} & 1 & 1 & t\sqrt{x}\\
1 & \frac{1}{t^2} & 1 & \frac{\sqrt{x}}{t}\\
1 & 1 & 1 & \sqrt{q} \\
t\sqrt{x} & \frac{\sqrt{x}}{t} & \sqrt{q} & 1
where (t,r)(t,r) are two parameters (which I can choose arbitrarily to be any value in the segment (0,1](0,1]) and (x,q)(x,q) are the variables (each over the domain [0,1][0,1]).

Now, for a fixed pair of (r,t)(r,t) I want to plot a region of (x,q)(x,q) over which the matrix SS is positive semi-definite (I want it to be a valid covariance matrix). The thing is that when I try to use the Manipulate function (manipulation on (r,t)∈(0,1]2(r,t)\in(0,1]^2), and plotting the region of (x,t)(x,t), nothing shows.
Namely, Iv’e written the following:

S={{1/r^2, 1, 1, t Sqrt[x]}, {1, 1/t^2, 1, Sqrt[x]/t},
{1, 1, 1, Sqrt[q]}, {t Sqrt[x], Sqrt[x]/t, Sqrt[q], 1}};

{x, 0, 1}, {q, 0, 1}], {r, 0, 1}, {t, 0, 1}]

and I get an empty graph no matter what values I set for (r,t)(r,t). You might say that maybe this matrix is never positive semi-definite, but the strange this is that if I manually input numerical values to (r,t)(r,t) and plot the region, everything works fine.

I really need to manipulate over all possible parameter value of (r,t)(r,t). What is wrong here and how can I fix it?

Moreover, is it possible for Mathematica to parametrically find a local minima of a certain function (of the variable qq where (r,t,x)(r,t,x) serve as parameters) subject to the constraint that the above matrix must be positive semi-definite? If so, it would very much help me to know how to formalize such a command.




Same problem as in… and many others.
– Sjoerd C. de Vries
Jul 16 ’13 at 22:47


1 Answer


Try to define your matrix as a function of (x,q,r,t)(x,q,r,t) variables

S[x_, q_, r_, t_] := {{1/r^2, 1, 1, t Sqrt[x]}, {1, 1/t^2, 1, Sqrt[x]/t}, {1, 1, 1, Sqrt[q]}, {t Sqrt[x], Sqrt[x]/t, Sqrt[q], 1}};

Then Manipulate does what you want

PositiveDefiniteMatrixQ@S[x, q, r, t], {x, 0, 1}, {q, 0, 1}],
{{r, 1/2}, 0, 1}, {{t, 1/2}, 0, 1}]



Great! thank you very much. How about the minimization problem? Is it possible to do what I want?
– Ziv Goldfeld
Jul 16 ’13 at 9:14