# Given matrix $A$, find a matrix $S$ such that result of $S^{-1} \circ A \circ S$ is a diagonal matrix

Given is matrix $A=\begin{pmatrix} 3 & 0 & 7\\ 0 & 1 & 0\\ 7 & 0 & 3 \end{pmatrix}$, find a matrix $S$ such that $D=S^{-1} \circ A \circ S$ where $D$ is a diagonal matrix.

So I'm not sure how this is supposed to work, I tried to create some linear system but soon realized there are too many unknowns! Then I thought about the zero matrix, if it's actually a diagonal matrix. This should be the case because a diagonal matrix is a matrix where all non-diagonal entries are zero and this is satisfied in a zero matrix.

But the bad thing is when we want the inverse of that zero matrix, we have a problem because division by zero doesn't work : /

So I can't use that matrix. But how else do you solve this problem?

• If $D$ were such a diagonal matrix, then to calculate the eigenvalues of $D$ one would do $0=\det(D-\lambda\cdot I)=\det(S^{-1}\cdot A\cdot S - \lambda\cdot S^{-1}\cdot S)=\det(S^{-1}(A-\lambda\cdot I)\cdot S)=\frac{1}{\det S}\cdot \det(A-\lambda\cdot I)\cdot \det(S)=\det(A-\lambda\cdot I)$. Hence, the eigenvalues of the matrix $A$ are the same eigenvalues of the matrix $D$. On the other hand, it is not difficult to show that the eigenvalues of a diagonal matrix are precisely the elements of the diagonal. – Darío G May 25 '18 at 21:48
• ... and the eigenvectors those of the matrix $S$ – G Cab May 25 '18 at 21:50
• I dislike the current answers because they aren't at all connecting your obvious lack of knowledge of the existence of an algorithm to solve this problem with the application of the algorithm. What follows is an elementary way of solving this problem (which justifies the algorithm, by the way). There aren't that many unknowns if you look at the problem in the right way. Assuming such matrices $S$ and $D$ exists, what you want can be rewritten as $AS=SD$. – Git Gud May 25 '18 at 22:22
• Now look at $S$'s columns. Write them as $v_1, v_2$ and $v_3$, where $S=[v_1\, |\, v_2\, |\, v_3 ]$. Note that $AS=[Av_1\, |\, Av_2\, |\, Av_3]$. You'll also have $SD=[d_{11}v_1\, |\, d_{22}v_2\, |\, d_{33}v_3]$. So you're basically looking at the three systems $$\begin{cases} (A-d_{11}I_3)v_1&=0_{3\times 1}\\ (A-d_{22}I_3)v_2&=0_{3\times 1}\\ (A-d_{33}I_3)v_3&=0_{3\times 1} \end{cases}$$ – Git Gud May 25 '18 at 22:22
• It is useful to find $d_{11}, d_{22}$ and $d_{33}$ before finding $v_1, v_2$ and $v_3$. In order to find, for instance, $d_{11}$, you can think of it as finding $d_{11}$ such that the matrix $A-d_{11}I_3$ isn't invertible (so that $(A-d_{11}I_3)v_1=0_{3\times 1}$ can be satisfied without $v_1$ being null, otherwise $S$ wouldn't be invertible). To to this you can just compute the determinant of $A-d_{11}I_3$ and equate the final expression to $0$. After solving for $d_{11}$ you will have found an eigenvalue of $A$. You're now ready to find $v_1$, rinse and repeat. – Git Gud May 25 '18 at 22:23

Find first the eigenvalues of $A$, these are the roots of the characteristic polynomial of $A$, $$(x-10)(x-1)(x+4)\ .$$ So the eigenvalues are $10$, $1$, $-4$. We subtract them from the diagonal and search for eigenvectors. Here are my choices: \begin{aligned} \begin{bmatrix} 3-10 & 0 & 7\\ 0& 1-10 & 0\\ 7 & 0 & 3-10 \end{bmatrix} \begin{bmatrix} 1\\0\\1 \end{bmatrix} &= \begin{bmatrix} 0\\ 0\\ 0 \end{bmatrix} \ ,\\ \begin{bmatrix} 3-1 & 0 & 7\\ 0& 1-1 & 0\\ 7 & 0 & 3-1 \end{bmatrix} \begin{bmatrix} 0\\1\\0 \end{bmatrix} &= \begin{bmatrix} 0\\ 0\\ 0 \end{bmatrix} \ , \\ \begin{bmatrix} 3-(-4) & 0 & 7\\ 0& 1-(-4) & 0\\ 7 & 0 & 3-(-4) \end{bmatrix} \begin{bmatrix} 1\\ 0\\ -1 \end{bmatrix} &= \begin{bmatrix} 0\\ 0\\ 0 \end{bmatrix} \ ,\\ \end{aligned} Equivalently, \begin{aligned} \begin{bmatrix} 3 & 0 & 7\\ 0& 1 & 0\\ 7 & 0 & 3 \end{bmatrix} \begin{bmatrix} 1\\0\\1 \end{bmatrix} &= \begin{bmatrix} 1\\0\\1 \end{bmatrix} \cdot[10] \ ,\\ \begin{bmatrix} 3 & 0 & 7\\ 0& 1 & 0\\ 7 & 0 & 3 \end{bmatrix} \begin{bmatrix} 0\\1\\0 \end{bmatrix} &= \begin{bmatrix} 0\\1\\0 \end{bmatrix} \cdot [1] \ , \\ \begin{bmatrix} 3 & 0 & 7\\ 0& 1 & 0\\ 7 & 0 & 3 \end{bmatrix} \begin{bmatrix} 1\\ 0\\ -1 \end{bmatrix} &= \begin{bmatrix} 1\\ 0\\ -1 \end{bmatrix} [-4] \ ,\\ \end{aligned} equalities of products of matrices of the shape $(3\times 3)\cdot(3\times 1)$, and respectively $(3\times 1)\cdot(1\times 1)$.

Now consider the matrix built from the eigenvectors, taken as columns. We have the block matrix computation, subsumming the above three equalities: $$\underbrace{ \begin{bmatrix} 3 & 0 & 7\\ 0& 1 & 0\\ 7 & 0 & 3 \end{bmatrix}}_A \underbrace{ \begin{bmatrix} 1 & 0 & 1\\ 0 & 1 & 0\\ 1& 0& -1 \end{bmatrix}}_S = \underbrace{ \begin{bmatrix} 1 & 0 & 1\\ 0 & 1 & 0\\ 1& 0& -1 \end{bmatrix}}_S \underbrace{ \begin{bmatrix} 10 & & \\ &1 & \\ & & -4 \end{bmatrix}}_D \ .$$ We have $AS=SD$, so the above choices answer the request.

• Perfect explanation! – Virtuoz May 25 '18 at 22:19

HINT

1. Find the eigenvalues by $|A-\lambda I|=0$

2. For each eigenvalue find the corresponding eigenvector(s) by $(A-\lambda_i I)v_i=0$

3. Consider the matrix $S=[v_1\, v_2\,v_3]$ and calculate $S^{-1}$

4. Then $D=S^{-1}AS$

Let $S$ be the matrix whose columns are eigenvectors of $A$

Then you will have $$AS=SD$$ where $D$ is the diagonal matrix with eigenvalues on the main diagonal.

Thus $$S^{-1}AS=D$$ is diagonal.