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

combinatoricsdiscrete mathematics

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!

,

Best Answer

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$$