Algorithm of Order 3 Matrix in a Chosen Basis