Are $\prod_{i\in I}{X_i^2}$ and $(\prod_{i\in I}{X_i})^2$ the same? We have:
$$\prod_{i\in I}{X_i}=\left\{f:I\to\bigcup_{i\in I}{X_i}~\Big|~ (\forall i\in I)\big(f(i)\in 
X_i\big)\right\}$$
Is it true:
$$\left|\prod_{i\in I}{X_i^2}\right|=\left|\left(\prod_{i\in I}{X_i}\right)^2\right|$$
and can we assume:
$$\prod_{i\in I}{X_i^2}=\left(\prod_{i\in I}{X_i}\right)^2$$
 A: In the context where the variables in the question stand for sets, one way to prove the equality of cardinalities will be to construct a bijection. This approach will be a bit messy, but not too much. Another approach will be to recall that the categorical product in $Set$, the category of sets, is the product construction at hand. As in any category, the categorical product is associative and commutative up to isomorphism (and even coherently, though this is not important for this answer). That means that you can rearrange the terms in each product to get the other and be assured that there is an isomorphism between the two. Viewed this way, the equality of cardinalities is a by-product of a much stronger property of the cartesian structure of $Set$, which in turn is automatic from the universal property of cartesian products.  
A: It is not literally true that
$$\prod_{i\in I}{X_i^2}=\left(\prod_{i\in I}{X_i}\right)^2\;:$$
elements of the lefthand side are functions with domain $I$ such that $f(i)\in X_i\times X_i$ for each $i\in I$, while elements of the righthand side are ordered pairs of functions with domain $I$ such that $f(i)\in X_i$ for each $i\in I$. However, there is a natural bijection between the two sets, and the existence of that bijection proves that they have the same cardinality.
Specifically, for any 
$$\langle f,g\rangle\in\left(\prod_{i\in I}{X_i}\right)^2$$
we define a unique $$h_{f,g}\in\prod_{i\in I}{X_i^2}$$
by
$$h_{f,g}(i)=\big\langle f(i),g(i)\big\rangle\;.$$
I leave it to you to verify that the map
$$\varphi:\left(\prod_{i\in I}{X_i}\right)^2\to\prod_{i\in I}{X_i^2}:\langle f,g\rangle\mapsto h_{f,g}$$
is a bijection.
A: As sets these are different sets. One set is a set of functions, and the other is a set of ordered pairs of functions. 
To see that the cardinality is equal, note that:


*

*If $I$ is finite then this is really just by definition of cardinal multiplication.

*If $I$ is infinite (and without loss of generality no $X_i$ is a singleton or empty) then: $$\left|\prod_{i\in I}X_i\right|^2=\left|\prod_{i\in I}X_i\right|\leq\left|\prod_{i\in I}X_i^2\right|\leq\left|\left(\prod_{i\in I}X_i\right)^2\right|$$
To see the last inequality note that $f(i)=\langle a_i,b_i\rangle$ factors into $\langle a,b\rangle$ which are choice functions, and this is an injective function.
