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

Let $x_1$ and $x_2$ be two real numbers and define the column vector $\mathbf{x}=[x_1,x_2]$. Let $\mathbf{A}_1$ and $\mathbf{A}_2$ be two $2\times 2$ real symmetric matrices. Then I need to plot the surfaces \begin{align} \mathbf{x}^T\mathbf{A}_1\mathbf{x}+1 &\leq 0 \\ \mathbf{x}^T\mathbf{A}_2\mathbf{x}+1 &\leq 0 \end{align}

How do I do this in Mathematica?

share|improve this question
Please try to write some code. – Dr. belisarius Aug 11 '14 at 4:13
@belisarius I really want to and I understand it is inappropriate to ask without trying. I come from a matlab & engineering background and doing this in matlab is a pain. Just started with mathematica 2 hrs back. – dineshdileep Aug 11 '14 at 5:32
Well, you've a kickstart below – Dr. belisarius Aug 11 '14 at 16:51
up vote 4 down vote accepted
a = # + Transpose@# &@RandomReal[{0, 1}, {2, 2}];
RegionPlot[{x, y}.a.{x, y} > 0, {x, -2, 2}, {y, -2, 2}]

Mathematica graphics

share|improve this answer
+1, but the condition is $x^TAx+1\le0$, not $x^TAx>0$. – Rahul Aug 11 '14 at 6:33
@RahulNarain Nobody is perfect :) – Dr. belisarius Aug 11 '14 at 7:07

Using V10 functionality and borrowing from Belisarius:

a = # + Transpose@# &@RandomReal[{0, 1}, {2, 2}];

We create an ImplicitRegion

region = ImplicitRegion[First[{x, y}.a.{{x}, {y}}] > 0, {x, y}];

And discretize it:

DiscretizeRegion[region, {{-2, 2}, {-2, 2}}]

Mathematica graphics

If you want Frame:

Show[%, PlotRange -> {{-2, 2}, {-2, 2}}, Frame -> True]

Mathematica graphics

share|improve this answer

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.