Write down a bijection from $(X \times Y ) \times Z$ to $X \times (Y \times Z)$. Prove that it is one-to-one and onto. I am very new to this, so my following prove may have a lot of mistakes. 
Please point them out for me. Thanks. 
Write down a bijection from $(X \times Y ) \times Z$ to $X \times (Y \times Z)$. Prove that it is one-to-one and onto.
Prove $(X \times Y ) \times Z \iff X \times (Y \times Z)$
We need to show that $(X \times Y ) \times Z \subset X \times (Y \times Z)$
Let $ x \in X,y \in Y,z \in Z$
Then (a)
$((x,y),z) \to (x,y,z) \to (x,(y,z))$
Therefore it is one to one. 
Also (b)
We need to show that $ X \times (Y \times Z) \subset (X \times Y ) \times Z$
$(x,(y,z)) \to (x,y,z) \to ((x,y),z)$
Therefore it is onto
According to (a) and (b), $(X \times Y ) \times Z$ to $X \times (Y \times Z)$ are bijective
 A: In my opinion, you should actually write down the bijection explicitly. Like this:
$$f : (X \times Y) \times Z \rightarrow X \times (Y \times Z)$$
$$f(p) = \langle (p_0)_0,\langle(p_0)_1,p_1\rangle\rangle$$
I've used angled brackets for the ordered pair constructor to make the notation less confusing.
What I now recommend doing is ignoring the injectivity/surjectivity thing, and instead writing down another function
$$g:X \times (Y \times Z) \rightarrow (X \times Y) \times Z$$  $$g(q) = ...$$ in a similar vein. You should then show $$g(f(p))=p \qquad f(g(q))=q$$ by explicit computation, which completes the proof. Basically, this will just require repeatedly using the equations $$\langle a,b\rangle_0 = a, \qquad \langle a,b\rangle_1 = b$$ on the left hand side expressions to unravel layers of brackets until the right hand side pops out.
A: I see no bijection being clearly written down and no proof in your post. Also, the symbolism you use seems off. There is no equivalence nor set inclusions to verify here.
An obvious choice for the bijection is $\iota : (X \times Y ) \times Z \to X \times (Y \times Z)$ defined by
$$
\iota(((x,y),z)):= (x,(y,z))
$$


*

*It is one-to-one because
\begin{align}
\iota(((x,y),z))=\iota(((x',y'),z')) &\implies (x,(y,z)) = (x',(y',z'))\\
&\implies x=x' \text{ and } (y,z)=(y',z')\\
&\implies x=x' \text{ and } y=y' \text{ and } z=z'\\
&\implies (x,y)=(x',y') \text{ and } z=z'\\
&\implies ((x,y),z) = ((x',y'),z')
\end{align}
Here we took for granted that in set theory, two ordered pairs are equal if and only if their corresponding entries are equal (in order to prove this fact you would have to rely on axioms for your theory of sets).

*It is onto because if $(x,(y,z))$ is an element in the codomain of $\iota$, then $((x,y),z)$ is an element in its domain mapped to it, i.e. $\iota(((x,y),z))=(x,(y,z))$.

