3

I have a $4\times 4$ matrix $$A=\left(\begin{array}{cccc}8 & 11 & 4 & 3\\11 & 12 & 4 & 7\\4 & 4 & 7 & 12\\3 & 7 & 12 & 17\end{array}\right).$$ I want to do the things I describe below.

  1. Find the eigenvalues.

  2. Find a unitary matrix $P$ (if there is any) so that the matrix $(P^{-1})AP$ is diagonal.

  3. Find (if there are any) an identity matrix $Q$ and an upper triangular matrix $R$ so that $A=QR$.

Comments (item by item)

  1. I want to know if there is a better way than calculating $\det(A-\lambda I)$.

  2. Well for this I think I have the answer as the matrix A is symmetric that means that it has 4 distinct eigenvectors that are orthogonal with each other also P a matrix composed by using the eigenvectors as columns gives us that $(P^{-1})AP$ = with the diagonal form of A. And P is unitary as if we take the inner product of all the eigenvectors with each other we get 0 since they are orthogonal with each other. Is there a flaw to the way i am thinking?

  3. I tried to solve this using the Gram–Schmidt process I found the first column of Q but then the numbers get too big and gets hard to compute. I have been thinking maybe symmetric matrices have some better way for QR decomposition

  • 1
    Can you post the matrix in question? – Amzoti May 18 '13 at 16:10
  • first row (8 11 4 3) second row (11 12 4 7) third row (4 4 7 12) fourth (3 7 12 17) – George 0X May 18 '13 at 16:13
  • 5
    By "identity" do you mean invertible or orthogonal/unitary? It really doesn't make sense to "find an identity matrix". – Erick Wong May 18 '13 at 16:18
  • i mean a square matrix that all it's entries are 0 except fromt the diagonal whitch is all 1 – George 0X May 18 '13 at 16:20
  • I think you have to churn the way you are using. The eigenvalues, eigenvectors are not integers, the diagonalization is doable and so is the QR decomposition. Have results for each. Note Q is a full 4x4 and R is upper triangular. – Amzoti May 18 '13 at 16:20
  • 2
    @George0X How does one have difficulty finding a matrix where every entry is already known? Surely you do not really mean "identity matrix"? – Erick Wong May 18 '13 at 16:21
  • With Pari-GP I get the following characteristic polynomial: $x^4 - 44x^3 + 340x^2 + 1096x - 569$; it doesn't seem likely you can explicitly find the diagonalization. – egreg May 18 '13 at 16:50
  • Maple produces the eigenvalues 32.52824630, 13.78493622, .457924187, -2.771106707. – user64494 May 18 '13 at 17:11
  • For point 2 you need an invertible matrix $P$. The identity will do nothing, of course. – egreg May 18 '13 at 18:06
  • About your last edit: it's not true that a symmetric $4\times4$ matrix has four distinct eigenvalues: the identity matrix $I$ has only the eigenvalue $1$. However, any symmetric matrix is diagonalizable, because it is normal; a diagonalizing matrix can be chosen to be orthogonal. – egreg May 20 '13 at 19:27
  • yeah of course i never said that it has 4 distinct eigenvalues but it has 4 distinct eigenvectors if chosen that way – George 0X May 20 '13 at 19:37

4 Answers4

6

I didn't notice the OP was asking for an easier way to unitary diagonalize a matrix. I'll leave this answer here, just because I find this algorithm interesting.


Regarding points 1) and 2), let me introduce an interesting algorithm to diagonalize a real symmetric matrix using only elementary row operations (taken from Schaum's Outline of Theory and Problems of Linear Algebra, by Lipschutz and Lipson).


Congruence Diagonalization of a Symmetric Matrix


And here is a worked example of the above mentioned algorithm:

enter image description here

  • 2
    thank you for showing me this; I think this is almost what we have been seeing recently here on MSE, and differs just in things like the transpose. Note that the final expression in Example 12.2 reads "and then $D = P^{-1}AP$" but should read "and then $D = P^TAP$" I think you should leave this here: it is quite possible that this method (or the way I wrote it at my question) is exactly what they wanted George 0X to do, and he misinterpreted. Otherwise, to orthogonally diagonalize it would need entirely numerical methods and be impossible by hand. – Will Jagy Aug 09 '15 at 23:49
2

Here is what you get from the algorithm in the Schaum's Outline, Schaum's Outline of Theory and Problems of Linear Algebra, by Lipschutz and Lipson (third edition), as in the answer by el.Salvador.

$$ P^T H P = D $$ $$ Q^T D Q = H $$ $$ H = \left( \begin{array}{rrrr} 8 & 11 & 4 & 3 \\ 11 & 12 & 4 & 7 \\ 4 & 4 & 7 & 12 \\ 3 & 7 & 12 & 17 \\ \end{array} \right) $$

==============================================

$$\left( \begin{array}{rrrr} 1 & - \frac{ 11 }{ 8 } & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) $$ $$ P = \left( \begin{array}{rrrr} 1 & - \frac{ 11 }{ 8 } & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q = \left( \begin{array}{rrrr} 1 & \frac{ 11 }{ 8 } & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D = \left( \begin{array}{rrrr} 8 & 0 & 4 & 3 \\ 0 & - \frac{ 25 }{ 8 } & - \frac{ 3 }{ 2 } & \frac{ 23 }{ 8 } \\ 4 & - \frac{ 3 }{ 2 } & 7 & 12 \\ 3 & \frac{ 23 }{ 8 } & 12 & 17 \\ \end{array} \right) $$

==============================================

$$\left( \begin{array}{rrrr} 1 & 0 & - \frac{ 1 }{ 2 } & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) $$ $$ P = \left( \begin{array}{rrrr} 1 & - \frac{ 11 }{ 8 } & - \frac{ 1 }{ 2 } & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q = \left( \begin{array}{rrrr} 1 & \frac{ 11 }{ 8 } & \frac{ 1 }{ 2 } & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D = \left( \begin{array}{rrrr} 8 & 0 & 0 & 3 \\ 0 & - \frac{ 25 }{ 8 } & - \frac{ 3 }{ 2 } & \frac{ 23 }{ 8 } \\ 0 & - \frac{ 3 }{ 2 } & 5 & \frac{ 21 }{ 2 } \\ 3 & \frac{ 23 }{ 8 } & \frac{ 21 }{ 2 } & 17 \\ \end{array} \right) $$

==============================================

$$\left( \begin{array}{rrrr} 1 & 0 & 0 & - \frac{ 3 }{ 8 } \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) $$ $$ P = \left( \begin{array}{rrrr} 1 & - \frac{ 11 }{ 8 } & - \frac{ 1 }{ 2 } & - \frac{ 3 }{ 8 } \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q = \left( \begin{array}{rrrr} 1 & \frac{ 11 }{ 8 } & \frac{ 1 }{ 2 } & \frac{ 3 }{ 8 } \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D = \left( \begin{array}{rrrr} 8 & 0 & 0 & 0 \\ 0 & - \frac{ 25 }{ 8 } & - \frac{ 3 }{ 2 } & \frac{ 23 }{ 8 } \\ 0 & - \frac{ 3 }{ 2 } & 5 & \frac{ 21 }{ 2 } \\ 0 & \frac{ 23 }{ 8 } & \frac{ 21 }{ 2 } & \frac{ 127 }{ 8 } \\ \end{array} \right) $$

==============================================

$$\left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ 0 & 1 & - \frac{ 12 }{ 25 } & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) $$ $$ P = \left( \begin{array}{rrrr} 1 & - \frac{ 11 }{ 8 } & \frac{ 4 }{ 25 } & - \frac{ 3 }{ 8 } \\ 0 & 1 & - \frac{ 12 }{ 25 } & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q = \left( \begin{array}{rrrr} 1 & \frac{ 11 }{ 8 } & \frac{ 1 }{ 2 } & \frac{ 3 }{ 8 } \\ 0 & 1 & \frac{ 12 }{ 25 } & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D = \left( \begin{array}{rrrr} 8 & 0 & 0 & 0 \\ 0 & - \frac{ 25 }{ 8 } & 0 & \frac{ 23 }{ 8 } \\ 0 & 0 & \frac{ 143 }{ 25 } & \frac{ 228 }{ 25 } \\ 0 & \frac{ 23 }{ 8 } & \frac{ 228 }{ 25 } & \frac{ 127 }{ 8 } \\ \end{array} \right) $$

==============================================

$$\left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & \frac{ 23 }{ 25 } \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) $$ $$ P = \left( \begin{array}{rrrr} 1 & - \frac{ 11 }{ 8 } & \frac{ 4 }{ 25 } & - \frac{ 41 }{ 25 } \\ 0 & 1 & - \frac{ 12 }{ 25 } & \frac{ 23 }{ 25 } \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q = \left( \begin{array}{rrrr} 1 & \frac{ 11 }{ 8 } & \frac{ 1 }{ 2 } & \frac{ 3 }{ 8 } \\ 0 & 1 & \frac{ 12 }{ 25 } & - \frac{ 23 }{ 25 } \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D = \left( \begin{array}{rrrr} 8 & 0 & 0 & 0 \\ 0 & - \frac{ 25 }{ 8 } & 0 & 0 \\ 0 & 0 & \frac{ 143 }{ 25 } & \frac{ 228 }{ 25 } \\ 0 & 0 & \frac{ 228 }{ 25 } & \frac{ 463 }{ 25 } \\ \end{array} \right) $$

==============================================

$$\left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & - \frac{ 228 }{ 143 } \\ 0 & 0 & 0 & 1 \\ \end{array} \right) $$ $$ P = \left( \begin{array}{rrrr} 1 & - \frac{ 11 }{ 8 } & \frac{ 4 }{ 25 } & - \frac{ 271 }{ 143 } \\ 0 & 1 & - \frac{ 12 }{ 25 } & \frac{ 241 }{ 143 } \\ 0 & 0 & 1 & - \frac{ 228 }{ 143 } \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q = \left( \begin{array}{rrrr} 1 & \frac{ 11 }{ 8 } & \frac{ 1 }{ 2 } & \frac{ 3 }{ 8 } \\ 0 & 1 & \frac{ 12 }{ 25 } & - \frac{ 23 }{ 25 } \\ 0 & 0 & 1 & \frac{ 228 }{ 143 } \\ 0 & 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D = \left( \begin{array}{rrrr} 8 & 0 & 0 & 0 \\ 0 & - \frac{ 25 }{ 8 } & 0 & 0 \\ 0 & 0 & \frac{ 143 }{ 25 } & 0 \\ 0 & 0 & 0 & \frac{ 569 }{ 143 } \\ \end{array} \right) $$

==============================================

$$ P^T H P = D $$ $$\left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ - \frac{ 11 }{ 8 } & 1 & 0 & 0 \\ \frac{ 4 }{ 25 } & - \frac{ 12 }{ 25 } & 1 & 0 \\ - \frac{ 271 }{ 143 } & \frac{ 241 }{ 143 } & - \frac{ 228 }{ 143 } & 1 \\ \end{array} \right) \left( \begin{array}{rrrr} 8 & 11 & 4 & 3 \\ 11 & 12 & 4 & 7 \\ 4 & 4 & 7 & 12 \\ 3 & 7 & 12 & 17 \\ \end{array} \right) \left( \begin{array}{rrrr} 1 & - \frac{ 11 }{ 8 } & \frac{ 4 }{ 25 } & - \frac{ 271 }{ 143 } \\ 0 & 1 & - \frac{ 12 }{ 25 } & \frac{ 241 }{ 143 } \\ 0 & 0 & 1 & - \frac{ 228 }{ 143 } \\ 0 & 0 & 0 & 1 \\ \end{array} \right) = \left( \begin{array}{rrrr} 8 & 0 & 0 & 0 \\ 0 & - \frac{ 25 }{ 8 } & 0 & 0 \\ 0 & 0 & \frac{ 143 }{ 25 } & 0 \\ 0 & 0 & 0 & \frac{ 569 }{ 143 } \\ \end{array} \right) $$ $$ Q^T D Q = H $$ $$\left( \begin{array}{rrrr} 1 & 0 & 0 & 0 \\ \frac{ 11 }{ 8 } & 1 & 0 & 0 \\ \frac{ 1 }{ 2 } & \frac{ 12 }{ 25 } & 1 & 0 \\ \frac{ 3 }{ 8 } & - \frac{ 23 }{ 25 } & \frac{ 228 }{ 143 } & 1 \\ \end{array} \right) \left( \begin{array}{rrrr} 8 & 0 & 0 & 0 \\ 0 & - \frac{ 25 }{ 8 } & 0 & 0 \\ 0 & 0 & \frac{ 143 }{ 25 } & 0 \\ 0 & 0 & 0 & \frac{ 569 }{ 143 } \\ \end{array} \right) \left( \begin{array}{rrrr} 1 & \frac{ 11 }{ 8 } & \frac{ 1 }{ 2 } & \frac{ 3 }{ 8 } \\ 0 & 1 & \frac{ 12 }{ 25 } & - \frac{ 23 }{ 25 } \\ 0 & 0 & 1 & \frac{ 228 }{ 143 } \\ 0 & 0 & 0 & 1 \\ \end{array} \right) = \left( \begin{array}{rrrr} 8 & 11 & 4 & 3 \\ 11 & 12 & 4 & 7 \\ 4 & 4 & 7 & 12 \\ 3 & 7 & 12 & 17 \\ \end{array} \right) $$

Will Jagy
  • 139,541
2

This is what I get in a session with Pari-GP:

? M=[8,11,4,3;11,12,4,7;4,4,7,12;3,7,12,17]
%1 =
[8 11 4 3]

[11 12 4 7]

[4 4 7 12]

[3 7 12 17]

? charpoly(M)
%2 = x^4 - 44*x^3 + 340*x^2 + 1096*x - 569
? qfsign(M)
%3 = [3, 1]
? qfjacobi(M)
%4 = [[-2.7711067095643205005042713725054278775,
       0.45792421148127108739250530588654614018, 
       13.784936206564400480761522475780657126, 
       32.528246291518648932350243590838224611]~, 
      [0.56546566894067682530206059221727842481, 
       0.48618155778071956234867882744958918213, 
       0.54955525973510618817381976083023906288, 
       0.37664981962144319750903998279270607039; 
      -0.46810465013958985829800140380345548297, 
      -0.47042263023491137214267988086021197332, 
       0.55128143386128172202765139532340765196, 
       0.50563758380920349835989610695765410760; 
      -0.54210521905381975449864154038806958910, 
       0.64436536825618266659441254842846620785, 
      -0.31320991082067338855031289595942215904, 
       0.43910676996647412411072995204550132449; 
       0.40896032233185550464871681388665378512, 
      -0.35654356540099667600450300414305218092, 
      -0.54403800321396212602733917384888354204, 
       0.64003967985456572726102891872973617133]]

The first four numbers after $\mathtt{qfjacobi(M)}$ are the eigenvalues, the rest is a matrix $P$ that diagonalizes $A$. I don't think it's possible to explicitly compute the roots of the characteristic polynomial, in this case.

egreg
  • 238,574
  • Of course it is possible to compute the roots of a 4th degree polynomial explicitly. It can be very unpleasant, but there is a formula for it. – Gerry Myerson May 20 '13 at 13:04
  • 3
    @GerryMyerson Would you like to try? ;-) – egreg May 20 '13 at 16:12
  • Not especially --- it's not my equation. But if OP wants to try, the method is at http://en.wikipedia.org/wiki/Quartic_function#Solving_a_quartic_equation – Gerry Myerson May 21 '13 at 10:56
1

For correct results to compare your own solutions against, you can use Wolfram Alpha.

1: Find the eigenvalues (I want to know if there is a better way than calculating $\det(A−\lambda I)$).

If approximate solutions are acceptable, then you can look in to numeric methods for computing these. See computing the eigenvalues, eigenvalue algorithm and, looking at question 3, also QR algorithm. But if you are to do this by hand, then I'd go for this determinant, since manually performing iterative approaches is even more tedious than manually computing roots of fourth degree polynomials.

2: […] for this i think i have the answear […]

Sounds right, except you might have to normalize your eigenvectors to unit length.

3: Find (if there are any) an identity matrix $Q$ and an upper triangular matrix $R$ so that $A=QR$. (I tried to solve this using the Gram–Schmidt process i found the first collum of $Q$ but then the numbers get too big and gets hard to compute. I have been thinking maybe symmetric matrices have some better way for QR decomposition)

QR Decomposition mentions two more ways to calculate this, namely Housholder reflection and Givens rotations. Neither mentions any explicit gains for symmetric matrices, and Givens rotations in particular seem to work best with sparse matrices. The numbers involved will have up to 6 digits in numerator and denominator, but if you keep taking the square roots till the very end, then this should still be possible. Definitely possible with a pocket calculator. And probably still easier than the eigenvalues, given the numbers involved.

Wolfram Alpha can solve this task as well, but the solution is far from unique, so here it won't be so much use to compare your own solutions against those.

MvG
  • 42,596