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}}
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$