# How many solutions are there to the equation $x_1 + x_2 + x_3 + x_4 + x_5 = 21$,

## Question

How many solutions are there to the equation $x_1 + x_2 + x_3 + x_4 + x_5 = 21$,

such that

all of $x_{i}$ where $i=1,2,3,4,5$ are non negative

and

$0\leq x_1 \leq 3$

$1\leq x_2 \lt 4$

and

$x_3 \geq 15$

## Attempt

first used $0\leq x_1 \leq 3$ and

$1\leq x_2 \lt 4$ and then find the number of solutions

violating $0\leq x_1 \leq 3$ $\\,\,$and$\,\,$$1\leq x_2 \lt 4 will give x_1 \gt 3$$\\,\,$and$\,\, x_2 \gt 3$

Now number of solutions are there to the equation $x_1 + x_2 + x_3 + x_4 + x_5 = 21$,

=$\binom{21+5-1}{21}=12,650$

Now number of solutions are there to the equation $x_1 + x_2 + x_3 + x_4 + x_5 = 21$, such that $0\leq x_1 \leq 3$ and $1\leq x_2 \lt 4$

=$12650-$number of solutions are there to the equation $x_1 \gt 3$$\\,\,and\,\, x_2 \gt 3 ----------------------------------------------- solving number of equation for x_1 \gt 3$$\\,\,$and$\,\, x_2 \gt 3$

let $x_1=x_1^{'}+3$

$x_2=x_2^{'}+3$

our equation becomes

$x_1^{'}+3+x_2^{'}+3+x_3+x_4+x_5=21$

$\Rightarrow x_1^{'}+x_2^{'}+x_3+x_4+x_5=15$

$\therefore$ number of equation=

$\binom{15+5-1}{15}=3876$

Now,

Now number of solutions are there to the equation $x_1 + x_2 + x_3 + x_4 + x_5 = 21$, such that $0\leq x_1 \leq 3$ and $1\leq x_2 \lt 4$

=$12650-3876=8,774$

now among $8,774$ we have to find $x3 \geq 15$

for $x_3 \geq 15$,

let $x_3 =x_3 ^{'}+15$

our equation becomes

$x_1 + x_2 + x_3^{'} +15+ x_4 + x_5 = 21$,

$x_1 + x_2 + x_3 + x_4 + x_5 = 6$

$\therefore$ number of equation =$\binom{6+5-1}{6}=210$

so final answer$=8,774-210=8,564$

But the answer is $106$

Where am i wrong??

Please correct me or else give me the correct way

Thanks!

,

• Any constraints on $x_4$ and $x_5$? non-negative integers? – CY Aries May 16 '17 at 10:50
• no ! no any constraint on $x4$ and $x5$ – virat May 16 '17 at 10:52
• yes all of $x_{i}$ where $i=1,2,3,4,5$ are non negative – virat May 16 '17 at 10:52
• math.stackexchange.com/questions/397127/… – Darío A. Gutiérrez May 16 '17 at 11:03
• @DaríoA.Gutiérrez link is of no use ,as i am asking for help "to give correction in my approach" – virat May 16 '17 at 11:05

Let $S_{a, b, c, d, e}$ be the number of solutions with $x_1\ge a$, $x_2 \ge b$, $x_3\ge c$, $x_4\ge d$ and $x_5\ge e$.

The equation can be written as

$$(x_1-a)+(x_2-b)+(x_3-c)+(x_4-d)+(x_5-e)=21-a-b-c-d-e$$

So we have

$$S_{a, b, c, d, e} =\binom{21-a-b-c-d-e+4}{4}$$

if $a+b+c+d +e\le21$ and is $0$ otherwise.

The answer to this question is

$$S_{0, 1,15,0,0}-S_{4,1,15,0,0}-S_{0,4,15,0,0}+S_{4,4,15,0,0}=\binom{9}{4}-\binom{5}{4}-\binom{6}{4}+0=106$$

• got it @CY Kwong sir !thanks ! – virat May 16 '17 at 12:25

see this answer for more explanations on the method

The answer is the coefficient of $x^{21}$ in

$$(1+x+x^2+x^3)(x+x^2+x^3)(1+x+x^2+\ldots)^3$$ which is the same as the coefficient of $x^{21}$ in

$$x(1-x^4)^2(1-x)^{-5}= x(1-2x^4 +x^8)\sum_{k=0}^\infty \binom{4+k}{k}x^k$$

which can be read off as

$$\binom{24}{20} -2\binom{20}{16} + \binom{17}{12}$$

• I wouldn't agree. If $1 \le x_{2} \le 4$, then why did you write $x+x^2+x^3$ and not $x+x^2+x^3+x^4$ ? – Karagum Dec 13 '17 at 20:36