Diagonalizing a matrix. Is it necessary to use $P^{-1}AP=D$? The matrix $D$ comes from $P^{-1}AP$, and has the form:
$$
\begin{bmatrix} 
\gamma_1 & & \\
& \ddots & \\ 
& & \gamma_n
\end{bmatrix}
$$
When asked to diagonalize, can I just put $\gamma$ values on the diagonal? The result will be different? There is a certain order for the eigenvalues on the diagonal?
I tought that maybe this formula was to prove that indeed the matrix is diagonalizable. If is just for that, there is any easier way to check? Inverting matrix often leads me to wrong calculations.
 A: Yes, if there is a matrix $P$ so that $P^{-1}AP=D$, then you can use $D$ as the diagonal matrix.
The order of the $\gamma_i$ does not matter as long as the $i _{th}$ eigenvalue is associated to the $i_{th}$ eigenvector. If there is more than one eigenvector associated to an eigenvalue, I think you will need to use the Jordan form.
A: To diagnonalize matrix A, you need to find its eigenvectors/eigenvalues. The matrix P is the matrix containing these eigenvectors ($P^{-1}$ is its inverse). The order of the eigenvectors also should correspond to the order of the eigenvalues in the diagonal matrix D. Unfortunately, there's no easier way to do it and one important application of this process is in finding the values of matrices raised to very large powers-i.e. numerical optimization. It takes a bit of practise and once you get into it, it becomes easier. 
e.g. Let's assume you need to calculate $A^{10}$, instead of multiplying A by itself 10 times, you can do the following:
$$ A^{10} = P( diag(\lambda_1,\lambda_2, \lambda_3 ))^{10}P^{-1}$$
$$ A^{10} = P( diag(\lambda_1^{10},\lambda_2^{10}, \lambda_3^{10} ))P^{-1}$$
In other words, to calculate $A^{10}$, you only need to raise the eigenvalues in the diagonal matrix to the power of 10 and then multiply by $P$ and $P^{-1}$. Now that's a lot easier and quicker than multiplying A by itself 10 times. I hope this makes sense. There are several other applications too-you can read more to motivate yourself.
