Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given n sets with 3 elements: $X_i=\{a_i,b_i,c_i\}$ where $\{i\in\mathbb{N}|1\leq i\leq n\}$. How can I define a n-tuple based on combination of this sets that produces the set $S$ with $3^n$ elements (n-tuples) as following: $S=\{(a_1,a_2,\cdots,a_n),(a_1,a_2,\cdots,b_n),(a_1,a_2,\cdots,c_n),\cdots,(c_1,c_2,\cdots,c_n)\}$.

share|cite|improve this question
up vote 4 down vote accepted

If I understand your question correctly, what you want is simply the Cartesian product of the $n$ sets:

$$\prod_{i=1}^nX_i=\Big\{\langle x_1,\dots,x_n\rangle:x_1\in X_i,x_2\in X_2,\dots,x_n\in X_n\Big\}\;.$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.