# Nakafa Framework: LLM
URL: /en/subject/university/bachelor/ai-ds/linear-methods/all-eigenvalues-calculation
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/subject/university/bachelor/ai-ds/linear-methods/all-eigenvalues-calculation/en.mdx
Output docs content for large language models.
---
export const metadata = {
    title: "All Eigenvalues Calculation",
    description: "Master the QR method for calculating all eigenvalues through iterative matrix decomposition. Learn convergence properties and diagonal elements.",
    authors: [{ name: "Nabil Akbarazzima Fatih" }],
    date: "07/17/2025",
    subject: "Linear Methods of AI",
};
## QR Method for All Eigenvalues
Using the QR method, you can calculate all eigenvalues of matrix . This process is carried out through iterations that gradually change the matrix form, like sharpening a knife repeatedly until it's sharp. Each iteration round makes the matrix increasingly approach a form that makes it easier for us to read its eigenvalues.
## QR Algorithm
1. **Initial step** is to set  and 
2. **Iteration process** that is repeated continuously. In each round, perform QR decomposition on matrix 
   
   
   
   After that, construct a new matrix by multiplying  and  in reverse order
   
   
   
   Add one to the value of  and check whether the iteration has reached a stable state
   
   
   
   The iteration stops when the largest change in diagonal elements is already very small.
## Similarity Properties in Iteration
Every matrix  that appears in the QR iteration has similar properties to the initial matrix . This means the eigenvalues do not change during the iteration process.
Like assembling the same puzzle in different ways. The puzzle pieces remain the same, but their arrangement can change. Likewise with our matrix, its mathematical content remains the same even though its structural form changes.
## Diagonal Element Convergence
If the condition  holds, then the elements on the main diagonal of matrix  will approach the corresponding eigenvalues
This process is like water flowing to the lowest place. The eigenvalues "fall" and occupy their respective diagonal positions according to their magnitude order.
## Non-Diagonal Element Convergence
If matrix  is symmetric, all elements outside the main diagonal will approach zero when .
Conversely, if the matrix is not symmetric, only the elements below the main diagonal approach zero, while those above do not. Imagine it like organizing a closet. If the closet is symmetric, all items can be neatly arranged. But if it's not symmetric, some parts remain messy.