I would like to check if what I have done is correct. Please, any input is appreciated.

**Problem statement:** Consider a non-singular matrix . Construct an algorithm using Gaussian elimination to find Provide the operation counts for this algorithm.

**My attempted algorithm and operations count:**

Let be an augmented $n$ x $2n$ matrix.

INPUT: number of unknowns and equations n, augmented matrix

OUTPUT: , provided that the inverse exists

STEP 1: For do STEPS 2-4

STEP 2: Let $p$ be the smallest integer with such that . If no integer $p$ exists then output ('no unique solution exists'); STOP

STEP 3: If then perform

STEP 4: For do STEPS 5-6

STEP 5: Set .

STEP 6: Perform

STEP 7: If then output NO UNIQUE SOLUTION EXISTS and STOP

STEP 8: For ,

For do STEPS 9 and 10

STEP 9: Set

STEP 10: Perform

STEP 11: for

STEP 12: OUTPUT $A^{-1}$ and STOP.

**I am getting the operations count as follows:** A total of $(2n^3+9n^2+n)/3$ multiplications and divisions and a total of $(2n^3+6n^2-8n)/3$ additions and subtractions for a grand total of $4n^3/3 + 5n^2 - 7n/3$ operations. **Does this sound about right?**

Thanks for any help.