I need some help. I do not understand how to get the answer (solution) to this question. I could not solve it, neither did it help when I saw the answer. This is a question from the chapter combinatorics from my textbook. Should be noted that my textbook has not be explaining anything that resembles this kinds of questions. So I am stuck. I would appreciate some insights. Thanks.

The question:

Let $n \in \mathbb{Z^+}$. How many solutions are there to the equation: $$x+y+z=n$$ such that $x,y,z \in \mathbb{N}$?

The answer:

$\frac{1}{2}(n^{2} + 3n + 2)$

How did they arrive at this answer?

  • 8
    $\begingroup$ You may want to check Stars and bars. You could also check this post. $\endgroup$ – StubbornAtom Oct 7 '16 at 10:10
  • 2
    $\begingroup$ This has been asked many times, please perform a search of stars and bars. $\endgroup$ – Jack D'Aurizio Oct 7 '16 at 10:11
  • 1
    $\begingroup$ @notmyrealname It's not some advanced tecnhique. All you need is some basic logic and combinatorics. $\endgroup$ – Stefan4024 Oct 7 '16 at 10:24
  • 2
    $\begingroup$ Applying the formula we get $\binom{n+2}{2}=\frac{n^2+3n+2}{2}$ $\endgroup$ – StubbornAtom Oct 7 '16 at 10:45
  • 1
    $\begingroup$ The answer you have provided is for non-negative $x,y,z$. For just finding out the answer remember that $\binom{n+k-1}{k-1}$ is the number of non-negative integral solutions of $x_1+x_2+...+x_k=n$, and $\binom{n-1}{k-1}$ is the number of positive integral solutions of the same equation. $\endgroup$ – StubbornAtom Oct 7 '16 at 10:56

Note that zero should be included

Considering $$z(x,y) = n-x-y$$

where $x,y\in \mathbb{N}\cup \{ 0 \}$ and $x+y\leq n$

The number of elements in the domain:

\begin{align*} \sum_{x=0}^{n} \sum_{y=0}^{n-x} 1 &= \sum_{x=0}^{n} (n-x+1) \\ &= (n+1)\times \frac{(n+1)+1}{2} \\ &= \frac{(n+1)(n+2)}{2} \end{align*}


Not the answer you're looking for? Browse other questions tagged or ask your own question.