Why pasting a finite number of commutative diagrams is commutative I am aware that if you paste two commutative squares, that diagram is commutative, but, in general, how can one prove that a diagram (with squares or triangles) is commutative iff every subdiagram is commutative? I can't see how to generalize. Thanks in advance
 A: A commutative diagram indexed by a preorder (in particular, a poset) $J$ is nothing more or less than a functor $D:J\to C$. Thus the reason that a diagram is commutative if and only if all triangles or squares in it are commutative follows from the composition axiom of a functor: $D(x\circ y)=D(x)\circ D(y)$ says exactly that all triangles in the diagram commute, while one could equivalently define a functor by requiring $D(x)\circ D(y)=D(z)\circ D(w)$ whenever $x\circ y=z\circ w$, which says that all squares commute. (For the less immediate implication between the usual and the new definition of a functor, let $z$ be an identity and $w=x\circ y$.) It's unnatural to ask for commutative diagrams, in the sense that $D$ identifies any two paths between two objects in its image, indexed by non-posets, since a commutative diagram indexed by any category $J$ must factor through the universal poset under $J$. So this is probably the result you want.
A: Let us see the case of a diagram made of $2$ square subdiagrams.
$\require{AMScd}$
\begin{CD}
    A @>f>> B @>j>> E\\
    @V g V V  @VV h V @VV lV\\
    C @>>i> D @>>k> F
\end{CD}
For the diagram above to commute, the following three equalities must hold: 
\begin{align} 
l\circ j\circ f &= k\circ i\circ g, \tag{1} \\
h \circ f &=  i \circ g, \tag{2} \\ 
l\circ j &= k \circ h \tag{3}.
\end{align} 
Actually, for the diagram to commute it suffices to show that (2) and (3) hold (i.e. that the two subdiagrams commute), since (1) follows from the last two, essentially by associativity of composition and transitivity of equality. Indeed, 
\begin{align}
 (l\circ j)\circ f &= (k \circ h) \circ f &&\text{by (3)} \\
&= k \circ (h \circ f) &&\text{by associativity} \\
 &= k \circ (i \circ g) &&\text{by (2)}.
\end{align}
This argument can be generalized in a straightforward way to a diagram made of $n$ (square or triangle) subdiagrams, for any $n \geq 2$ (the idea is the same as in the case $n = 2$). Formally, you can prove it by induction on $n$. The details of the proof are not really interesting and require heavy notations, I give you just an intuition.
By definition, the big diagram $D$ made of $n$ square subdiagrams is commutative if, given any two points $A$ and $B$ of $D$, all paths from $A$ to $B$ commute. But to prove that, it is sufficient to check that the $n$ square subdiagrams commute. 
Indeed, note that the if you have two paths $f$ and $g$ from $A$ to $B$, then you can transform $f$ into $g$ in steps, where each step only deals with edges of one square subdiagram (as we have seen explicitly for the case $n = 2$).
As an exercise, write an explicit proof for the case $n = 3$.
