Find the number of all non-negative solutions to the equation under the condition that
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.
Generalization: Find the number of all non-negative solutions to the equation x + y + z = n under the condition that x ≤ y ≤ z .
Lemma: The number of all non-negative solutions to the equation x + y = under the condition that x ≤ y is ⌊ 2 n ⌋ + 1
Fix x = k . We have y = n − k and k ≤ n − k ⟹ k ≤ 2 n . If n is even or odd, the valid k values are 0 , 1 , 2 , . . . , ⌊ 2 n ⌋ . Thus, we have proven the lemma.
Disregarding the condition, with simple stars and bars, the answer is simply ( 2 n + 2 ) . Note that there are four cases: x < y < z , x = y < z , x < y = z , x = y = z . Denote the number of ways to find each by ε 1 , ε 2 , ε 3 , ε 4 , respectively. We have that ( 2 n + 2 ) = 6 ε 1 + 3 ε 2 + 3 ε 3 + ε 4 . It suffices to find ∑ 1 ≤ k ≤ 4 ε k . It is obvious that ε 4 = 1 if and only if 3 ∣ n and zero otherwise. Thus, we can write ε 4 as ⌊ 3 n ⌋ − ⌊ 3 n − 1 ⌋ .
We will now try to find ε 2 + ε 3 + ε 4 . Note that this value is just the number of solutions to 2 u + v = n . Letting s = u , t = u + v , we have s + t = n . By the Lemma , we have that the number of ways to do this is ⌊ 2 n ⌋ + 1 . Thus we have ε 2 + ε 3 ε 1 ε 1 + ε 2 + ε 3 + ε 4 = ⌊ 2 n ⌋ + 1 − ⌊ 3 n ⌋ + ⌊ 3 n − 1 ⌋ = 1 2 ( n + 1 ) ( n + 2 ) − 2 1 ⌊ 2 n ⌋ + 3 1 ⌊ 3 n ⌋ − 3 1 ⌊ 3 n − 1 ⌋ − 2 1 = 1 2 ( n + 1 ) ( n + 2 ) + 2 1 ⌊ 2 n ⌋ + 3 1 ⌊ 3 n ⌋ − 3 1 ⌊ 3 n − 1 ⌋ + 2 1 Plugging in 2 0 1 6 gives us our final answer.