Verify positive definiteness using random numbers - Mathematica Stack Exchange most recent 30 from mathematica.stackexchange.com 2019-09-22T11:19:08Z https://mathematica.stackexchange.com/feeds/question/60422 https://creativecommons.org/licenses/by-sa/4.0/rdf https://mathematica.stackexchange.com/q/60422 1 Verify positive definiteness using random numbers Hirek https://mathematica.stackexchange.com/users/19394 2014-09-23T00:53:35Z 2018-03-14T10:20:36Z <p>I wish to verify whether T'T - IdentityMatrix is always positive definite for a certain choice of elements of T'T.</p> <pre><code>T'T = {{t11^2, t11*t12},{t11*t12, t12^2+t22^2}}; </code></pre> <p>Now, I have written the following program to check my assumptions on t11 etc which are: t11^2 > 1 t22^2 > 1 and t12 completely free.</p> <pre><code>co = 0; Do[{t11s = RandomReal[{1, 10^12}], If[RandomReal[{0, 1}] &gt;= 0.5, t11 = Sqrt[t11s], t11 = -Sqrt[t11s]], t22s = RandomReal[{1, 10^12}], If[RandomReal[{0, 1}] &gt;= 0.5, t22 = Sqrt[t22s], t22 = -Sqrt[t22s]], t12 = RandomReal[{-10^12, 10^12}], ttm = {{t11s, t11*t12}, {t11*t12, t12^2 + t22s}}, If[Transpose[ve].(ttm-IdentityMatrix).ve &gt; 0, co++]}, {10^5}] co </code></pre> <p>However, my program, based on random draws, generates odd results. For fixed ve as well as for random draws.</p> <p>Thank you so much!</p> https://mathematica.stackexchange.com/questions/60422/-/60426#60426 6 Answer by DumpsterDoofus for Verify positive definiteness using random numbers DumpsterDoofus https://mathematica.stackexchange.com/users/9697 2014-09-23T01:18:45Z 2014-09-24T01:23:26Z <p>The eigenvalues are </p> <pre><code>Eigenvalues[{{t11^2, t11*t12}, {t11*t12, t12^2 + t22^2}} - IdentityMatrix] </code></pre> <p>giving</p> <blockquote> <p>{1/2 (-2 + t11^2 + t12^2 + t22^2 - Sqrt[ t11^4 + 2 t11^2 t12^2 + t12^4 - 2 t11^2 t22^2 + 2 t12^2 t22^2 + t22^4]), 1/2 (-2 + t11^2 + t12^2 + t22^2 + Sqrt[ t11^4 + 2 t11^2 t12^2 + t12^4 - 2 t11^2 t22^2 + 2 t12^2 t22^2 + t22^4])}</p> </blockquote> <p>Assuming that the radicand is real-valued, one then notes that positive-definiteness is equivalent to</p> <pre><code>(-2 + t11^2 + t12^2 + t22^2)^2 &gt; t11^4 + 2 t11^2 t12^2 + t12^4 - 2 t11^2 t22^2 + 2 t12^2 t22^2 + t22^4 </code></pre> <p>which simplifies to </p> <p>\$\$1 + t11^2 (-1 + t22^2) &gt; t12^2 + t22^2\$\$</p> <p>which can be false when <code>t12</code> becomes arbitrarily large. Thus the matrix is not always positive definite; Daniel Lichtblau's answer shows a way to construct explicit counterexamples.</p> https://mathematica.stackexchange.com/questions/60422/-/60474#60474 6 Answer by Daniel Lichtblau for Verify positive definiteness using random numbers Daniel Lichtblau https://mathematica.stackexchange.com/users/51 2014-09-23T16:16:41Z 2014-09-23T16:23:47Z <p>Could look for a counterexample using <code>FindInstance</code>.</p> <pre><code>tmat = {{t11^2, t11*t12}, {t11*t12, t12^2 + t22^2}} - IdentityMatrix; evals = Eigenvalues[tmat]; FindInstance[(evals[] &lt;= 0 || evals[] &lt;= 0) &amp;&amp; t11^2 &gt;= 1 &amp;&amp; t22^2 &gt;= 1, Variables[tmat], Reals] (* Out= {{t11 -&gt; Sqrt, t12 -&gt; 1, t22 -&gt; Sqrt[3/2]}} *) </code></pre> <p>To get conditions on positive definiteness one could use <code>Reduce</code> with a setup similar to that above.</p>