We then have $x_1 + x_2' + x_3' + x_4 + x_5 = 5 (0\leq x_1\leq 3,0\leq x_2'\leq 2,x_3'\geq 0)$.

Based on what, you did this $0\leq x_2'\leq 2$? it was $x_2 \leq 3$.

Based on what, you did this $0\leq x_2'\leq 2$? it was $x_2 \leq 3$.

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+1 vote

Following is the given solution in the solution manual:

I understood how we got x1 + x2 + x3 + x4 + x5 = 5, I understood too how we got x1+x2+x3+x4+x5 = 1, when x1>=4.

but I am unable to understand the highlighted part. how did we get x1 + x2 + x3 + x4 + x5 = 2. please explain.

PS: i solved this question using generating functions and i am getting the same answer as 106.

+1 vote

Best answer

We have $x_1 + x_2 + x_3 + x_4 + x_5 = 21 (0\leq x_1\leq 3,1\leq x_2<4,x_3\geq 15)$. Note that $x_2$ is strictly less than 4. Hence to help us solve the equation, we modify it by subtracting the lower bounds of the constraints from the total sum i.e 21. By doing that, there is also a modification to the upper bounds due to the fact that $x_2$ and $x_3$ are already assigned some value i.e 1 and 15 respectively.

We then have $x_1 + x_2' + x_3' + x_4 + x_5 = 5 (0\leq x_1\leq 3,0\leq x_2'\leq 2,x_3'\geq 0)$. The number of solutions for this equation without considering upper bounds is $\binom{5+5-1}{5} = \binom{9}{5} = 126$. Now we can subtract the #solutions for $x_1\geq4$ and $x_2'\geq3$. Both these conditions cannot hold simultaneously since the sum should be 5 and thus we needn't consider the intersection of the cases. We then would obtain $x_1 + x_2' + x_3' + x_4 + x_5 = 1$ and $x_1 + x_2' + x_3' + x_4 + x_5 = 2$ giving us 5 and 15 as #solutions respectively. (P.S: The second highlighted portion arises from solving for $x_2'\geq3$). Subtracting these figures from 126 would fetch us 106.

We then have $x_1 + x_2' + x_3' + x_4 + x_5 = 5 (0\leq x_1\leq 3,0\leq x_2'\leq 2,x_3'\geq 0)$. The number of solutions for this equation without considering upper bounds is $\binom{5+5-1}{5} = \binom{9}{5} = 126$. Now we can subtract the #solutions for $x_1\geq4$ and $x_2'\geq3$. Both these conditions cannot hold simultaneously since the sum should be 5 and thus we needn't consider the intersection of the cases. We then would obtain $x_1 + x_2' + x_3' + x_4 + x_5 = 1$ and $x_1 + x_2' + x_3' + x_4 + x_5 = 2$ giving us 5 and 15 as #solutions respectively. (P.S: The second highlighted portion arises from solving for $x_2'\geq3$). Subtracting these figures from 126 would fetch us 106.

- All categories
- General Aptitude 1.2k
- Engineering Mathematics 4.8k
- Digital Logic 2k
- Programming & DS 3.5k
- Algorithms 3k
- Theory of Computation 3.8k
- Compiler Design 1.5k
- Databases 2.8k
- CO & Architecture 2.5k
- Computer Networks 2.9k
- Non GATE 941
- Others 1.2k
- Admissions 336
- Exam Queries 410
- Tier 1 Placement Questions 17
- Job Queries 52
- Projects 8

34,241 questions

40,932 answers

116,232 comments

39,846 users