Check the number of rows and columns in your original matrix "A." If the number of rows is equal to the number of columns, then it is possible that this matrix has a corresponding diagonal matrix. If this is the case, let N be equal to the number of rows.
Calculate the matrix's eigenvalues. The easiest way to calculate eigenvalues is through the use of mathematical software. If you must calculate eigenvalues by hand, create a scalar diagonal matrix by multiplying an identity matrix "I" by a scalar "c." Calculate the determinant of the matrix "A -- cI." Solve for "c." This will yield at least one value for "c." These values are the eigenvalues of "A."
Confirm that the number of eigenvalues for "A" equals the number of rows in "A," "N." If this equality does not hold, you cannot compute the diagonal matrix for "A."
Compute the eigenvectors for "A" from the eigenvalues for "A." Set up a column vector with values x = (x1, x2, ..., xN). Solve the equation [A -- cI]x = 0. The eigenvector is the solution to this equation, "x." You can compute the eigenvectors for "A" by following this process N times, or one time for each value of "c."
Find the diagonalizing matrix "P." Combine all of the eigenvectors you found for "A." P is the matrix formed by this combination.
Find the inverse of "P," "B." Set up the equation "PB = I," where I is the identity matrix that you used previously. Solve this equation for B to receive the inverse.
Calculate the diagonal matrix. Multiply the matrices "A," "P" and "B" in the order BAP. The resulting matrix is the diagonal matrix.