# Power Method Pseudocode for Finding Dominant Eigen Value and Eigen Vector

Earlier in Power Method Algorithm for Finding Dominant Eigen Value and Eigen Vector article we discussed an Algorithm for finding largest Eigen value and corresponding Eigen vector. In this article we are going to develop pseudocode for this method so that it will be easy while implementing on computer.

## Pseudocode for Power Method

```  1. Start

2. Input:
a. Order of Matrix (n)
b. Tolerable Error (e)

For i = 1 to n
For j = 1 to n
Next j
Next i

4. Read Initial Guess Vector (X):
For i = 1 to n
Next i

5. Initialize: Lambda_Old = 1

6. Multiplication (X_NEW = A * X):
For i = 1 to n
Temp = 0.0
For j = 1 to n
Temp = Temp + Ai,j * Xj
Next j
X_NEWi = Temp
Next i

7. Replace X by X_NEW:
For i = 1 to n
Xi = X_NEWi
Next i

8. Finding Largest:
Lambda_New = |X1|
For i = 2 to n
If |Xi| > Lambda_New
Lambda_New = |Xi|
End If
Next i

9. Normalization:
For i = 1 to n
Xi = Xi/Lambda_New
Next i

10. Display:
Print Lambda_New
For i = 1 to n
Print Xi
Next i

11. Checking Accuracy:
If |Lambda_New - Lambda_Old| > e
Lambda_Old = Lambda_New
Goto Step (6)
End If

12. Stop

-----------------------------------
Note: All array indexes are assumed to start from 1.
```