0

Finding number of solutions for $x+y+z=7$ is given by $$\binom{n-1}{r-1}$$

Here $n=7$, $r=3$

But how to solve when constraints are given like each of $x$, $y$ and $z$ should not exceed a value of $3$?

lioness99a
  • 4,943
  • 1
    Where did you get that formula? The numbers are so small that you can write down the possibilities in two minutes. – ancient mathematician May 10 '17 at 09:51
  • Closely related to https://math.stackexchange.com/questions/2274456/find-the-number-of-solution-of-equation – Dirk May 10 '17 at 10:00
  • there must be about 100 related questions to this on MSE :) –  May 10 '17 at 10:15
  • Also it is crucial to know whether the numbers $x,y,z$ can be zero or not. Because the formula you mentioned above changes. –  May 10 '17 at 10:18
  • The formula you gave is valid when $x$, $y$, and $z$ are positive integers. If you meant the number of solutions in the positive integers, you should state that explicitly. There are more solutions if we allow the variables to be nonnegative. – N. F. Taussig May 10 '17 at 12:28

5 Answers5

1

HINT:

Let $3-x=X\implies X\ge0$ etc.

$$X+Y+Z=9-7=2$$

So, if $X=0,Y+Z=2\implies Y=2-Z\ge0\implies0\le Z\le2$

What if $X=1,2?$

0

I assume that you want positive integral solutions of the given equation

Hint :

You need to find coefficient of $x^7$ in the following expression $$(x^1+x^2+x^3)(x^1+x^2+x^3)(x^1+x^2+x^3)$$

That is coefficient of $x^7$ in $(x+x^2+x^3)^3$.

Jaideep Khare
  • 19,293
  • 1
    Your hint is valid if we want the number of solutions in the nonnegative integers. The formula stated in the problem suggests we want the number of solutions in the positive integers. – N. F. Taussig May 10 '17 at 12:31
  • @N.F.Taussig I gave this hint because the formula stated by OP ($\binom{n-1}{r-1}$) is valid only for non-negative integral solutions, therefore most probably OP means that, I have edited accordingly. – Jaideep Khare May 10 '17 at 12:34
  • @N.F.Taussig Also note that negative integer solutions aren't even possible. – Jaideep Khare May 10 '17 at 12:37
  • The number of solutions of the equation $$x_1 + x_2 + x_3 + \cdots + x_r = n$$ in the nonnegative integers is $$\binom{n + r - 1}{r - 1}$$ while the number of solutions of the same equation in the positive integers is $$\binom{n - 1}{r - 1}$$ – N. F. Taussig May 10 '17 at 12:38
  • @N.F.Taussig Oh sorry, I missed that.I have corrected now. – Jaideep Khare May 10 '17 at 12:44
  • For solutions in the positive integers, don't we want the coefficient of $x^7$ in the expansion of $(x^1 + x^2 + x^3)^3 = x^3(1 + x + x^2)^3$? Doesn't the coefficient of $x^7$ in the formula $(1 + x + x^2 + x^3)^3$ give the number of solutions in the nonnegative integers? – N. F. Taussig May 10 '17 at 14:09
0

$x,y,z\leq3$ implies $x\leq0$ is impossible $($ think $(0,3,3))$. Then sum is $(1,1,1)+4$, and combination of distribute 4 is only combinations of $(0,2,2),(1,1,2)$.

0

The formula you stated gives the number of solutions of the equation $$x_1 + x_2 + x_3 + \cdots + x_r = n$$ in the positive integers. Therefore, I will assume that you wish to find the number of solutions of the equation $$x + y + z = 7 \tag{1}$$ in the positive integers subject to the constraints that $x, y, z \leq 3$.

If there were no constraints, the number of solutions would be
$$\binom{7 - 1}{3 - 1} = \binom{6}{2}$$ as you stated.

From these, we must exclude those solutions in which one of the variables exceeds $3$. Observe that at most one of the variables can exceed $3$ since $2 \cdot 4 = 8 > 7$.

Observe that if $x > 3$, then $x' = x - 3$ is a positive integer. Substituting $x' + 3$ for $x$ in equation 1 yields \begin{align*} x' + 3 + y + z & = 7\\ x' + y + z & = 4 \tag{2} \end{align*} Equation 2 is an equation in the positive integers with $$\binom{4 - 1}{3 - 1} = \binom{3}{2}$$ solutions. By symmetry, there are the same number of solutions of equation 1 in which $y > 3$ or $z > 3$. Hence, the number of solutions of equation 1 in which none of the variables exceeds $3$ is

$$\binom{6}{2} - \binom{3}{1}\binom{3}{2}$$

N. F. Taussig
  • 76,571
0

We can solve this problem using generating functions. Note that $$ (x^1+x^2+x^3)^3 =\left(\frac{x(1-x^3)}{1-x}\right)^3 =\frac{x^3}{(1-x)^3}(1-3x^3+3x^6-x^9)\tag{1}$$ where in the last step we used the binomial theorem. We want the coefficient of $x^7$ in (1). Use the identity $$ \frac{1}{(1-x)^k}=\sum_{n=0}^\infty \binom{k+n-1}{k-1}x^n\tag{2} $$ (which can be obtained by repeatedly differentiating the geometric series) where $k\geq 1$ to get that $$ [x^n]\left(\frac{1}{(1-x)^3}\right)=\binom{n+2}{2}\tag{3} $$ and hence $$ [x^n]\left(\frac{x^3}{(1-x)^2}\right)=\binom{n+2-3}{2}=\binom{n-1}{2}.\tag{4} $$ where $[x^n]$ extracts the coefficent of $x^n$ in the generating function. By (1) and (4), it follows that $$ \begin{align} [x^7]\left[\frac{x^3}{(1-x)^3}(1-3x^3+3x^6-x^9)\right] &=\binom{7-1}{2}-3\binom{7-3-1}{2}+3\binom{7-6-1}{2}\\ &=\color{blue}{\binom{6}{2}-3\binom{3}{2}}. \end{align} $$