0
$\begingroup$

It is known that quadratic form $f\left(x_{1}, x_{2}\right)=x_{1}^{2}-4 x_{1} x_{2}+4 x_{2}^{2}$ can be transformed into quadratic form $g\left(y_{1}, y_{2}\right)=a y_{1}^{2}+4 x_{1} x_{2}+6 y_{2}^{2}$ by orthogonal transformation (It is known that matrix $\left(\begin{array}{ll} a & 2 \\ 2 & b \end{array}\right)$ and matrix $\left(\begin{array}{ll} 1 & -2 \\ -2 & 4 \end{array}\right)$ are congruent matrices under orthogonal transformation).

Now I want to find the value of a, b.

  Solve[Det[{{a, 2}, {2, b}}] == Det[{{1, -2}, {-2, 4}}] && 
      MatrixRank[{{a, 2}, {2, b}}] == MatrixRank[{{1, -2}, {-2, 4}}], {a, 
      b}]

But the above code returns an empty set after being run (the answer is {a->4,b->1}). What can I do to solve this matrix equation?

Updated content:

In addition, for the three-dimensional case, how to find the solution of the following matrix equation quickly:

Q = Array[x, {3, 3}]; 
A = {{1 - a, 1 + a, 0}, {1 + a, 1 - a, 0}, {0, 0, 2}} /. a -> 2; 
FindInstance[
 Thread[Transpose[Q] . A . Q == {{-4, 0, 0}, {0, 2, 0}, {0, 0, 2}}], 
 Flatten[Q], Reals]

Since Q is required to be a real matrix, the above code has been running and cannot return results.

Other examples for testing:

A = {{a, 0, 1}, {0, a, -1}, {1, -1, a - 1}};  
Transpose[Q] . A . Q == {{1, 0, 0}, {0, 1, 0}, {0, 0, 0}}
$\endgroup$
  • $\begingroup$ Should the two matrices have the same eigenvalues? If so, that would give two relatively simple equations. I don't think that your equations have a finite solution set. $\endgroup$ – mikado Aug 3 at 5:01
  • $\begingroup$ @mikado Yes, two contract matrices under orthogonal transformation are also similar to each other. But I want to solve this matrix equation directly without any skill. $\endgroup$ – A little mouse on the pampas Aug 3 at 5:10
  • 4
    $\begingroup$ "I want to solve this matrix equation directly without any skill." -- Oh. Otherwise, I would have suggested that you use A = {{a, 2}, {2, b}}; B = {{1, -2}, {-2, 4}}; Solve[{Det[A] == Det[B], Tr[A] == Tr[B]}, {a, b}] instead. Two symmetric $2 \times 2$ matrices have the same eigenvalues if and only if their trace and determinant coincide... $\endgroup$ – Henrik Schumacher Aug 3 at 5:21
  • $\begingroup$ @HenrikSchumacher Thank you very much for your help. $\endgroup$ – A little mouse on the pampas Aug 3 at 6:00
2
+50
$\begingroup$

Not too hard to do, if you recall that one can use a rotation matrix to perform the required orthogonal similarity transformation:

{{{a, 2}, {2, b}}, TrigExpand[RotationMatrix[2 ArcTan[u]]]} /. 
 Solve[With[{rot = TrigExpand[RotationMatrix[2 ArcTan[u]]]}, 
            Flatten[Thread /@ Thread[rot.{{a, 2}, {2, b}}.Transpose[rot] ==
                                     {{1, -2}, {-2, 4}}]]],
       {a, b, u}]
   {{{{1, 2}, {2, 4}}, {{-(3/5), 4/5}, {-(4/5), -(3/5)}}},
    {{{4, 2}, {2, 1}}, {{0, 1}, {-1, 0}}},
    {{{1, 2}, {2, 4}}, {{3/5, -(4/5)}, {4/5, 3/5}}},
    {{{4, 2}, {2, 1}}, {{0, -1}, {1, 0}}}}

Note also the use of the Weierstrass substitution to ease the algebra done by Solve[].

As an example verification,

{{0, -1}, {1, 0}}.{{4, 2}, {2, 1}}.Transpose[{{0, -1}, {1, 0}}] == {{1, -2}, {-2, 4}}
   True
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you very much. How to extend it to the case of three-dimensional matrix? A = {{a, 0, 1}, {0, a, -1}, {1, -1, a - 1}}; Transpose[Q] . A . Q == {{1, 0, 0}, {0, 1, 0}, {0, 0, 0}} I want to find the expression of the matrix Q. $\endgroup$ – A little mouse on the pampas Aug 13 at 7:26
  • $\begingroup$ That should be a separate question. $\endgroup$ – J. M.'s discontentment Aug 14 at 1:41
  • $\begingroup$ You can answer this question here. I have prepared a reward for you. $\endgroup$ – A little mouse on the pampas Aug 18 at 1:00
  • $\begingroup$ I have updated this question and hope you can update your answer. $\endgroup$ – A little mouse on the pampas Aug 18 at 1:14
  • $\begingroup$ You have misinterpreted my recommendation; I said that you should ask a new question for the $3\times 3$ case, since that is no longer related to your original question. $\endgroup$ – J. M.'s discontentment Aug 19 at 7:22

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.