<s>[INST] Looking for general approach to find number of $(x,y,z)$ so that $x+y=z$ How many $(x,y,z)$ exist so that $x+y=z$ holds for $x<y<z\le10$ ($x,y,z\in \mathbb{Z}^+$ ) ?
$1)15\quad\quad\quad\quad\quad\quad2)20\quad\quad\quad\quad\quad\quad3)40\quad\quad\quad\quad\quad\quad4)45\quad\quad\quad\quad\quad\quad5)50\quad\quad\quad\quad\quad\quad$
I solved this problem with counting all the possibilities: $z$ should be at least $3$ and for $z=3$ the only possibility is $3=1+2$ I continued to count for other values of $z$:
$$z=3\to1\quad z=4\to1\quad z=5\to2\quad z=6\to2\quad z=7\to3\quad z=8\to3\quad z=9\to4\quad z=10\to4$$
So the answer is $1+1+2+2+3+3+4+4=20$.
But I wonder is it possible to solve this problem without counting all the possibilities like I did?  for example I don' know what to do if it was $x<y<z\le100$.
 [/INST] One of the ways would be to first look at the number of positive integer solutions of $x+y \leq 10$. Taking $x = a + 1, y = b  +1$, it is equivalent to,
Number of non-negative solutions of $a + b + c = 8$ and that is $\displaystyle {10 \choose 2} = 45$. We discard solutions where $a = b = 0$ (as $x+y \gt 2)$ and we discard in general all solutions where $a = b $ (i.e $x = y$). That gives us $40$ solutions where $x \ne y$. This includes solutions where $x \gt y$ and $y \gt x$ and due to symmetry, the solutions that we are interested in is $\frac{40}{2} = 20$.
</s>