GATE CSE
First time here? Checkout the FAQ!
x
+1 vote
58 views

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.

asked in Algorithms by Veteran (14.9k points) 6 19 58 | 58 views

1 Answer

+2 votes
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.
answered ago by Active (1.1k points) 4 7 16
selected ago by
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$.
Note that $x_2$ is strictly less than 4, which means $x_2\leq3$. Subtracting one from the lower bound also requires subtracting one from the upper bound.


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Top Users Oct 2017
  1. Arjun

    23338 Points

  2. Bikram

    17048 Points

  3. Habibkhan

    7912 Points

  4. srestha

    6238 Points

  5. Debashish Deka

    5438 Points

  6. jothee

    4968 Points

  7. Sachin Mittal 1

    4772 Points

  8. joshi_nitish

    4286 Points

  9. sushmita

    3964 Points

  10. Rishi yadav

    3794 Points


Recent Badges

Popular Question user1234
Copy Editor Ayush Upadhyaya
Popular Question asu
Popular Question .
Popular Question makhdoom ghaya
Popular Question junaid ahmad
Notable Question learner_geek
Notable Question jothee
Popular Question jothee
Notable Question Jeffrey Jose
27,290 questions
35,142 answers
83,926 comments
33,231 users