Some clarification is required. You mention both permutation and combination. In permutation 'ae' isdifferent from 'ea', wheras in commbination both are the same. Secondly you mention 'every single combination of elements in each COLUMN of the matrix, but in your example you show combinations of elements in a ROW. Nevertheless, I think you have an interesting problem at hand and I could perhaps help you solving it