How many ordered pairs of non-negative integers ( M , N ) are there which satisfy the inequality M + N ≤ 2 5 ?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
All other solutions considered cases where M + N = k , and summed over k . By creating this additional variable A = 2 5 − M − N , we simplified all the cases.
For a detailed explanation of the stars and bars procedure, refer to this blog post .
If m and n are integers, then so must be m+n
m+n could be 25. In this case we have 26 possible solution pairs (m=0, to m=25)
m+n could also be 24, with 25 solution pairs
and so on all the way to
m+n=0 with only 1 solution pair
We use the pairing trick to add 1+2+3+...26 to give 13 pairs that each add to 27 (pair 1 with 26, 2 with 25 and so on)
so the total is 27*13=351
Basically, we can either brute force this with casework, or consider a much simpler solution. I'm going to go through the simpler solution for obvious purposes.
Consider an integer 0<= K<= 25. Now, consider the equation M + N + K = 2 5 . Note for any M+N, K is uniquely determined, and the minimum of K is 0 when M+N is 25, and the maximum 25 when M+N=0 (try some examples and convince yourself of the one-to-one correspondence). Therefore we must solve M + N + K = 2 5 over the non-negative integers and by stars and bars (or whatever) the answer is ( 2 2 5 ) = 3 5 1 .
25 choose 2 is not 351
I mistyped should be 27C2
25+3-1C25= 27C25= 351
We will prove that for m+n=k, there are k+1 pairs of nonnegative integers that satisfy the equation.
. . . . . ... . . .(k dots) Note that the number of ways to put a plus symbol between any two dots, behind the first dot or after the last dot is k+1.
Note that this is equal to the number of pairs of nonnegative solutions to m+n=k.
Therefore, the number of pairs (m, n) of solutions to m+n <= 25 is equal to 1+2+3+...+25+26=351.
If M=0, N can be 0,1,2...25--------26 values If M=1, N can be 0,1,2...24--------25 values etc. If M=25, N can be 0-------1 value No. of values that N can be is the answer to the question, so the answer is: 26*25/2=325
M + N ≤ 2 5
There is P ≥ 0 such that:
M + N + P = 2 5
So, the solution are:
C ( 2 5 + 3 − 1 , 3 − 1 ) = 3 5 1
I like the application of stars and bars for this problem. It makes the solution a lot simpler (it avoids the awkward explanation of "well when M = 0 then N can be 26 things and then when M = 1 then N can be 25 things...")
Log in to reply
Stars and bars is the typical approach to the problem, while your approach is little different, even though its lengthy.
Yes, Star bars aplication...
let M =25 then N can only be equal to 0 i.e. there is only 1 option for N
if M=24 then N can take two values 0 and 1 i.e there are two options for N
going on like this...
if M= 0 then N can take 26 values..
so the sum is 1+2+3+...26 =351
its same as i did !!
We note that if we consider M + N = 2 5 that there are 2 6 non-negative integer solutions to this. For M + N = 2 4 there are 2 5 integer solutions. Continuing this pattern we see that there are 2 6 + 2 5 + 2 4 + ⋯ + 1 = 3 5 1 solutions. This works since the solutions to the cases can not overlap.
Let's take a graphical approach. Label the horizontal axis M and the vertical axis N. The line connecting the points ( 2 5 , 0 ) and ( 0 , 2 5 ) , the M-axis and the N-axis enclose our solution set. Now we need to count the lattice points in this region. There are 2 6 points lying on the M-axis from ( 0 , 0 ) to ( 2 5 , 0 ) , 2 5 points lying on the line above that, and so forth until we get to 1 point lying on the line y = 2 5 . Thus, the number of points is equal to ∑ n = 1 2 6 n = ( 2 2 7 ) = 3 5 1 .
I solved using the standard approach(i.e by ball and stars or whatever way), but man, Michael your solution is really creative! Great approach buddy!! On second thoughts, as the answer is 2 7 C 2 , there must be a combinatorial explanation of this and in particular for n , the answer is n + 2 C 2 . If you find the explanation for this result, post it okay? I'll also be thinking about it.
Log in to reply
Note that ( 2 n + 2 ) = 2 ! × ( n + 2 − 2 ) ! ( n + 2 ) ! = 2 ( n + 2 ) × ( n + 1 ) which is the desired no. of solutions.
Log in to reply
I know this gives the number of solutions, but I'm asking for a combinatorial interpretation of n C 2 .
Log in to reply
@Piyal De – Well, let's give it a try by writing out what we want.
The combinatorial interpretation of ( 2 2 7 ) is picking 2 numbers out of the first 27. Let's call these pairs of numbers { a , b } with a < b .
How does this lead to creating a bijection with ordered pairs of non-negative integers such that M + N ≤ 2 5 ?
Awesome.......Really creative solution
The possible sums of M+N can be 0, 1, 2........25.
Possible values for (M,N) if M+N=0 is (0.0). Thus a total possibility of 1.
Possible values for (M,N) if M+N=1 are (1.0) and (0,1). Thus a total possibility of 2.
Similarly, possible values for (M,N) if M+N=k are (0.k), (1, k-1).......(c,k-c) (k,0) for 0<=c<=k. Thus a total possibility of k+1 for each value of k where 0<=k<=25.
Thus the total possible values for (M,N) is 1+2+.....+26=(26*27)/2=351.
Note that M + N can be 2 5 , 2 4 , 2 3 , 2 2 , . . . . . . . , 0 We get a total of 26 possible sums. Hence, one by one we find the no. of ordered pairs by the famous Stars and Bars Method .
First, when M + N = 2 5 , then the no. of ordered pairs is: ( 2 5 2 5 + 2 − 1 ) = ( 2 5 2 6 )
Then, when M + N = 2 4 , then the no. of ordered pairs is: ( 2 4 2 4 + 2 − 1 ) = ( 2 4 2 5 )
Continuing this way, the total no. of solutions or ordered pairs,satisfying the given inequality is:
= ( 2 5 2 6 ) + ( 2 4 2 5 ) + . . . . . . . . . . . . . . . + ( 0 1 ) = ( 2 6 + 2 5 + . . . . . . . . . . . . . . . + 1 )
= 2 2 6 × 2 7
= 1 3 × 2 7 = 3 5 1 .
Same method!
Python solution:
res = 0
for m in range(100):
for n in range(100):
if m + n <= 25:
res += 1
print res
bruto force xD
If M is 0, then N could be any integer between 0 and 25. M is 1, then N could be any integer between 0 and 24. M is 2, then N could be any integer between 0 and 23. . . . M is 25, then N is 0.
So, if M is 0, then there are 26 possible values for N, and if M is 25, then there is 1 possible value for N. Thus we do 26+25+24.......+1= 27x26/2 =351.
Why is this level 5?
For a given 0 ≤ M ≤ 2 5 , there are 2 6 − M possible values of N such that M + N ≤ 2 5 , since N can range from 0 to 2 5 − M .
Therefore, the answer is M = 0 ∑ 2 5 2 6 − M = 2 6 + 2 5 + ⋯ + 1 = 2 2 6 ⋅ 2 7 = 3 5 1
Generalization: The number of non-negative pairs of integers ( M , N ) such that M + N ≤ X is 2 ( X + 1 ) ( X + 2 ) .
Imagine this problem in XY-plane (M as X; N as Y), Now x+y<=25; X>=0 and Y>=0 will enclose the area formed by the x-axis, y-axis, and x+y=25 line(including the boundary). now clearly the intercept made by our equation x/25+y/25=1 are 25 on both x and y-axis. Every such integer points/coordinates lying within the area will satisfy our problem hence the solution to our problems is actually the number of such integer points. To calculate the no. of points consider the square formed by coordinates (0,0) (0,25) (25,0) (25,25), the line x+y=25 dissects the square in equal halves regions so do the no. of equally spaced integer coordinates considering the points on the diagonal line in both the regions. so, (26X26-26)/2 +26 = 351 "Total no. of points in the square= 26X26" "Points on the diagonal line i.e (x+y=25) =26"
Ervery solution ( A , B , C ) such that A + B + C = 2 5 is also a unique solution to A + B ≤ 2 5 .
The variable C is a dummy variable.
The problem is therefore equivalent with dividing 2 5 balls over 3 urns A , B , C : ( 2 5 2 5 + 3 − 1 ) = 3 5 1
For M + N = 25 , we can find 26 solutions with the help of the stars and bars method For M+ N = 24 we have 25 solution Till for M+N = 1 we have 1 solution Therefore we add 1 + 2 + 3.........24+ 25+26 and get the final answer as 351
We have 2 case in here. First, M + N = 25. So the solution is 26C1. Second, M + N < 25. The solution is 26C2. Sum of the solution is 26C1 + 26C2.
ordered pair (a,b)
so (0,0) , (1,0) , (0,1), (1,1) all are taken as ordered pair
now a+b <=25
for a=0 , b={0,1,2, ....25} total 26
for a=1 , b={0,1,2, ....24} total 25
for a=2 , b={0,1,2, ....23} total 24
.
.
.
.
for a=24 , b={0,1} total 2
for a=25 , b={0} total 1
therefore, total is 1+2+3+........+24+25+26
n(n+1)/2= 26 ( 26 + 1) / 2= 13 x 27 = 351
there are two urn M and N . let the sum of the ball in the both the urn is X . X can be 0 to 2 5 . therefore when X = 0 both the urn contain 0 balls. when X = 1 then M can be fill up by this way i.e. no ball or 1 ball . similarly for X = i M can be fill up by ( i + 1 ) C 1 way therefore in general s u m i = 0 2 5 ( i + 1 ) C 1 = 3 5 1
If M=25, there is one possible value of N, namely N=0. If M=24, there are two possible values of N, namely N=0,1. In total there are 1 + 2 + ... + 26 = 351 solutions.
To satisfy the inquality M + N ≤ 2 5 ,and M , N are non-negative integers, M and N are numbers from 0 to 2 5 (inclusive).
Constant the value of M .
If M = 0 , then N can be any number from 0 to 2 5 (inclusive).There are 2 6 possibilities for N , so the number of ordered pairs ( M , N ) = 2 6 .
If M = 1 , then N can be any number from 0 to 2 4 (inclusive).There are 2 5 possibilities for N , so the number of ordered pairs ( M , N ) = 2 5 .
If M = 2 , then N can be any number from 0 to 2 3 (inclusive). By the same way, there are 2 4 ordered pairs......And so on!
Note that If M increases by 1 , then the number of ordered pairs will decrease by 1 .
M can be 0 , 1 , 2 , 3 … 2 5 , so the number of ordered pairs each would be 2 6 , 2 5 , 2 4 , 2 3 , … 1 .So the total number of ordered pairs ( M , N )
= 2 6 + 2 5 + 2 4 + 2 3 + ⋯ + 2 + 1 = ( 2 6 + 1 ) 2 2 6 = 2 7 × 1 3 = 3 5 1
I used the same method.
Let's fix a value for M and proceed with N ... We have 2 5 + 1 = 2 6 choices for each of M and N ...
M = 0 ⟹ 0 ≤ N ≤ 2 5 ⟹ ( 2 5 + 1 ) = 2 6 pairs
M = 1 ⟹ 0 ≤ N ≤ 2 4 ⟹ ( 2 4 + 1 ) = 2 5 pairs
M = 2 ⟹ 0 ≤ N ≤ 2 3 ⟹ ( 2 3 + 1 ) = 2 4 pairs
⋅ ⋅ ⋅
⋅ ⋅ ⋅
M = 2 5 ⟹ 0 ≤ N ≤ 0 ⟹ ( 0 + 1 ) = 1 pairs
In total, we have...
n = 1 ∑ 2 6 n = 2 2 6 × 2 7 = 3 5 1 possible pairs
Problem Loading...
Note Loading...
Set Loading...
Let A = 2 5 − M − N . Then A , M , and N are non-negative integers that sum to 25 [i,e, A + M + N = 2 5 - Calvin]. This is equivalent to the number of ways to make A stars, then a bar, then M stars, a bar, and N stars, which is ( 2 2 7 ) = 3 5 1 .