was studying the book "Principles and Techniques in Combinatorics" and I came across the following question from Chapter 1 that I can not solve. I would if possible give an explanation and or a solution to such an issue.
Question: (Chapter 1. Permutations and Combinations, p. 23, exercise 1, question 27) Let $S = \{1, 2, . . . , n + 1\}$ where $n\geq 2$, and let $T=\{(x,y,Z)\in S^3; x< z \mbox{ and } y<z\}$. Show by counting $|T|$ in two different ways that $\displaystyle\sum_{k=1}^n k^2=|T|= \begin{pmatrix}n+1\\ 2 \end{pmatrix}+ 2\begin{pmatrix}n+1\\ 3 \end{pmatrix}$.
Thank you very much.
Kind regards.