<s>[INST] Finding $S$, $D$, and $S^{-1}$ such that $A = SDS^{-1}$ 
Let $A = \begin{bmatrix}18&12\\-40&-26\end{bmatrix}$Find $S$, $D$, and $S^{-1}$ such that $A = SDS^{-1}$

So I did $\det(A-\lambda I)$ to get the char. poly. eqn. and got eigenvalues $\lambda_1 = -6, \lambda_2 = -2$ then: 
I  did $(A - \lambda_1 I)$ to get $\begin{bmatrix}1&1/2\\0&0\end{bmatrix}$ and similarly $(A - \lambda_2 I)$ to get $\begin{bmatrix}1&3/5\\0&0\end{bmatrix}$ 
so I got $S = \begin{bmatrix}1/2&3/5\\1&1\end{bmatrix}$, $D = \begin{bmatrix}-6&0\\0&-2\end{bmatrix}$, and $S^{-1} = \begin{bmatrix}-10&6\\10&-5\end{bmatrix}$ but my answer is incorrect for some reason 
 [/INST] The characteristic polynomial of $A=\left[\begin{array}{rr}
18 & 12 \\
-40 & -26
\end{array}\right]$ is
$$
\chi_A(t)=\det(tI-A)=\det\left[\begin{array}{rr}
t - 18 & -12 \\
40 & t + 26
\end{array}\right]=t^{2} + 8t + 12=(t + 2) \cdot (t + 6)
$$
The eigenvalues of $A$ are thus $\lambda=-2$ and $\mu=-6$.
To compute a basis of $E_\lambda$, note that
$$
E_\lambda=\DeclareMathOperator{Null}{Null}\Null(\lambda I-A)
=\Null\left[\begin{array}{rr}
-20 & -12 \\
40 & 24
\end{array}\right]\overset{\circledast}{=}\Null\left[\begin{array}{rr}
1 & \frac{3}{5} \\
0 & 0
\end{array}\right]=\DeclareMathOperator{Span}{Span}\Span\left\{
\left[\begin{array}{rr}
3 \\ -5
\end{array}\right]
\right\}
$$
where the equality marked $\circledast$ comes from row-reducing.
So, one of the columns of $S$ should be a nonzero scalar multiple of $\left[\begin{array}{rr}
3 \\ -5
\end{array}\right]
$.
To compute a basis of $E_\mu$, note that
$$
E_\mu=\Null(\mu I-A)=\Null
\left[\begin{array}{rr}
-24 & -12 \\
40 & 20
\end{array}\right]\overset{\circledast}{=}
\Null
\left[\begin{array}{rr}
1 & \frac{1}{2} \\
0 & 0
\end{array}\right]=\Span\left\{
\left[\begin{array}{rr}
1 \\ -2
\end{array}\right]\right\}
$$
So the other column of $S$ should be a nonzero scalar multiple of $\left[\begin{array}{rr}
1 \\ -2
\end{array}\right]$.
Putting this together, we have $A=SDS^{-1}$ where
\begin{align*}
D &=
\left[\begin{array}{rr}
\color{red}{-2} & 0 \\
 0 & \color{blue}{-6}
\end{array}\right] &
S &=
\left[\begin{array}{rr}
\color{red}{3} & \color{blue}{1}\\ \color{red}{-5} & \color{blue}{-2}
\end{array}\right]
\end{align*}
</s>