# The number of possible combination of column values with possibly common elements

I would like to calculate possible combinations for a given set of data:

There is an x amount of columns (let's say 3) each column contains y amount of words (lets say 2), now I would like to calculate total amount of permutations possible, the thing is that columns may have common elements and repetition is not allowed, i.e you can't choose the same elements twice or more

For example: column 1 contains "one" and "two", column 2 contains "one" and "four", column 3 contains "four" and "six" then all possible combinations are:

["one", "four", "six"], ["two", "one", "four"], ["two", "one", "six"], ["two", "four", "six"], That's 4, how I can calculate that, is there a closed form or recursive form solution for large matrices?

• So the columns can contain repeats, and you want to count selections of one item from each column in which such selections do not contain repeats, if I get your meaning. In that case the count will depend of course on the compositions of the various columns, not just how many columns and rows. It seems to me there may not be a "closed form" answer, unless it is in terms of what all the columns look like. – coffeemath Jun 15 '15 at 3:43
• Yes, that's exactly what I mean, I suppose there should be a recursive form of solution to this question but I haven't figured it out yet. – Haytan Jun 17 '15 at 4:51