This question already has an answer here:

I have a problem like this, I am given the following sets {a,b,c}, {d,e,f}, {h,i,j}. I want to pick one element from each set, and output a list of all the possibilities. The output will be a set of sets, all which have the length 3. I have tried many different approaches now.


marked as duplicate by m_goldberg, Kuba, Dr. belisarius, rm -rf Sep 13 '13 at 3:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 7
    $\begingroup$ Tuples[{{a, b, c}, {d, e, f}, {g, h, i}}], check the documentation of Tuples for more information. $\endgroup$ – Pinguin Dirk Sep 12 '13 at 20:57
  • 1
    $\begingroup$ Hey thanks that works well, I never thought about using tuples $\endgroup$ – JimmyJackson Sep 12 '13 at 21:07
  • 1
    $\begingroup$ To those voting to close again I'd like to ask: what are you searching for that makes this easy to find? I'm not saying it's not easy to find, but I'd like to see that proven. There are many functions in Mathematica and the mere existence of a documentation page is not proof enough to close a question as "easily found in the documentation" IMHO. $\endgroup$ – Mr.Wizard Sep 12 '13 at 23:37
  • 1
    $\begingroup$ @Pinguin I am in favor of you posting that as an answer. $\endgroup$ – Mr.Wizard Sep 12 '13 at 23:37
  • 1
    $\begingroup$ Also seems like a good question to keep for the googlability of the title. It's #1 hit for "mathematica all combinations one from each" and Tuples documentation isn't even on the first page. $\endgroup$ – ssch Sep 12 '13 at 23:49