Number of ordered triplets $(x, y, z)$ if $x, y, z \in \{1, 2, 3, 4, \ldots, n\}$ such that $x \geq y$ and $z \geq y$

59 Views Asked by At

I'm a little confused about this question as my answer is different from the book I'm solving.

Question :- Find number of ordered triplets $(x, y, z)$ if $x, y, z$ belong to $\{1,2,3,4, \ldots, n\}$ such that $x \geq y$ and $z \geq y$.

The answer given is $\binom{n+2}{3}$. And my answer is the summation $1^2 + 2^2 + \ldots + n^2$.