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.
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.