Calculating the Number of Ways to Make n with k Integers from Given Ranges

In summary: For this example:##m' = 24 - 6 - 3 - 1 = 14####A = C^{14+2}_{2}####B(a) = C^{14-(14+1)+2}_{2} = C^{-1+2}_{2} = 0####B(b) = C^{14-(10+1)+2}_{2} = C^{14-11+2}_{2} = C^{5+2}_{2}####B(c) = C^{14-(6+1)+2}_{2} = C^{14-7+2}_{2} = C^{7+2}_{2}####B(a \cap b) =
  • #1
Awlad Hossain
2
0
we have to make n with k integers.k integers will have to be choosen from k ranges.Every range has a minimum value and a maximum value.In how many ways we can make n
according to the conditions.For example,k=4,n=10
and the ranges are :
1 1
2 2
3 3
4 4

we can make n in only one way.Another example is k=2,n=10
and the ranges are:
1 10
1 10
Here,the result will be 9How can I find the number of ways by using inclusion-exclusion principle.Can anyone give me hints with better explanation?
 
  • #3
Awlad Hossain said:
we have to make n with k integers.k integers will have to be choosen from k ranges.Every range has a minimum value and a maximum value.In how many ways we can make n
according to the conditions.For example,k=4,n=10
and the ranges are :
1 1
2 2
3 3
4 4

we can make n in only one way.
What does "make n" mean here? If you take one number from each range and add them together, you get 1 + 2 + 3 + 4 = 10. I suppose this is what you mean.
Awlad Hossain said:
Another example isk=2,n=10
and the ranges are:
1 10
1 10
Here,the result will be 9
Or more clearly (I think), there are 9 ways: 1 + 9, 2 + 8, 3 + 7, 4 + 6, 5 + 5, 6 + 4, 7 + 3, 8 + 2, and 9 + 1 for the 9 ways.
Awlad Hossain said:
How can I find the number of ways by using inclusion-exclusion principle.Can anyone give me hints with better explanation?
For some problems, the answer is zero. For example, if k = 3 and n = 10 with these ranges:
1 1
2 2
3 3
The only possible sum is 1 + 2 + 3 = 6
For a solution to exist it must be the case that ##\sum_k \text{range minima} \leq n \leq \sum_k \text{range maxima}##.
 
  • #4
So, if I may put some notation around this problem, we are trying to find the number of ways to specify a set of k integers ##\{s_i\}## such that each ##s_i## lies within its specified interval, ##a_i \leq s_i \leq b_i##, and ##\sum s_i = m##. The problem specification implies that the values are ordered by claiming 9 solutions (rather than 5) for the second case, so {9,1} is a different solution to {1,9}.

Obviously a solution is only possibly if ##\sum a_i \leq m \leq \sum b_i##. If ##m = \sum a_i## or ##m = \sum b_i## there is only one set of choices for S

I also considered changing the problem a little, defining ##r_i = b_i - a_i## and ##m' = m - \sum a_i## and then one needs to find ##\{t_i\}## with ##0 \leq t_i \leq r_i## and ##\sum t_i = m'##. This can be regarded as problem of distributing ##m'## identical balls into an ordered set of cups of limited size. If all the ##r_i > m'## then the limits do not come into play and the number of options is just ##C^{m'+k-1}_{k-1}##. This is obviously a maximum in any case.
 
  • #6
Here's a worked example:
Determine how many ways can you choose 3 integers, ##a##, ##b##, ##c##, such that ##a+b+c=24## and with ##6 \leq a \leq 14##, ##3 \leq b \leq 10##, ##1 \leq c \leq 6##

The general approach is as follows:
  • Transform the ranges so that they all run zero to ##r_i## and find the modified sum ##m'##
  • Check for an easy answer (1 or 0)
  • Calculate the number of combinations ##A## as if there were no top limits
    • As above this is ##C^{m'+k-1}_{k-1} ##, in this case ##k=3## so ##A = C^{m'+2}_{2} ##
  • Calculate the number of combinations, ##B(x)##, that break the constraint for each single variable
    • if u is the upper limit on the variable, u+1 breaks the constraint, so preallocate u+1 to that variable and count combinations for the allocation of the remaining units
    • ##B(x) = C^{m'-(u+1)+2}_{2} ##
    • Total these up
  • Calculate the number of combinations that break the constraint for pairs of variables, ##B(x\cup y)##
    • These have been double counted above so need removing
    • As above but preallocate multiple constraint-breaking numbers (if possible), ##C^{m'-(u+1)-(v+1)+2}_{2} ##
  • Calculate the number that break the constraint for all three variables
    • In principle this was triple counted and then triple removed, so needs adding back in, but there won't be any
  • Combine the above results according to the inclusion-exclusion rules
    • Result ##= A - (B(a)+B(b)+Br(c)) + (B(a\cap b)+B(a\cap c)+B(b\cap c)) - B(a\cap b\cap c)##
##a'=a-6##
##b'=b-3##
##c'=c-1##
Total of lower limits ##= 6+3+1 = 10##
Revised total ##m' = 24-10 = 14##
Revised upper limits ##r_i = {8,7,5}##
##\sum r_i = 20 ## ∴ no easy answer
Combinations disregarding upper limits ##C^{14+3-1}_{3-1}= C^{16}_2 = 120##
Combinations breaking 1-variable constraint
## B(a') = C^7_2 = 21##
## B(b') = C^8_2 = 28##
## B(c') = C^{10}_2 = 45##
Total ##21+28+45=94##
Combinations breaking 2-variable constraint
## B(a'\cap b')## not possible (9+8>14)
## B(a'\cap c)## not possible (9+6>14)
## B(b'\cap c')=C^2_2 = 1## (8+6=14)
Total ##1##
Reconcile on inclusion-exclusion
Result ##=120-94+1 = 27##
 
Last edited:

1. How do I determine the total number of possible outcomes in a counting problem?

The total number of possible outcomes in a counting problem can be determined by using the fundamental counting principle. This principle states that the total number of outcomes is equal to the product of the number of options for each individual event. For example, if there are 3 possible options for the first event and 4 possible options for the second event, the total number of outcomes would be 3 x 4 = 12.

2. What is the difference between combinations and permutations?

Combinations and permutations are two different ways of counting the number of possible outcomes in a problem. Permutations take into account the order of the items, while combinations do not. For example, a combination of 3 letters from the alphabet would include "ABC" and "CBA" as the same outcome, whereas in permutations they would be counted as separate outcomes.

3. How can I solve a counting problem with multiple events?

To solve a counting problem with multiple events, you can use the multiplication rule. This rule states that the total number of outcomes is equal to the product of the number of options for each event. For example, if there are 3 options for the first event, 4 options for the second event, and 5 options for the third event, the total number of outcomes would be 3 x 4 x 5 = 60.

4. When should I use the addition rule to solve a counting problem?

The addition rule is used when there are multiple ways to achieve the same outcome. For example, if you can reach a certain number by rolling a 4 on one die or a 3 on the other die, you would use the addition rule to calculate the total number of outcomes.

5. How can I check my work when solving a counting problem?

You can check your work by using a different method to solve the problem, or by using a simpler case to see if your answer makes sense. Additionally, you can use a calculator or computer program to verify your answer. It's always a good idea to double-check your work to ensure accuracy.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
889
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
12
Views
956
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
20
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
2K
  • Calculus and Beyond Homework Help
Replies
7
Views
2K
  • Calculus and Beyond Homework Help
Replies
9
Views
1K
  • Programming and Computer Science
Replies
10
Views
723
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
6K
Back
Top