0

This is a self-answer question, which revisits this recently deleted question.

$\underline{\text{The Original Question}}$

How many distinct solutions are there to the following problem:

  • $a + b + c = (2n+1) ~: ~n \in \Bbb{Z^+}.$
  • $a,b,c \in \Bbb{Z}.$
  • $1 \leq a,b,c \leq n.$

Clarification
Suppose that $~n = 5,~$ and consider the three solutions
represented by $~(a,b,c) \in \{(1,5,5), (5,1,5), (5,5,1)\}.$

These three solutions are not to be considered distinct, because (for example) you can generate each of the solutions $~(5,1,5)~$ and $~(5,5,1)~$ by simply permuting the components of the solution $~(1,5,5).$

So, suppose that you have Solution-1 and Solution-2 as solutions to the problem represented by the bullet points above. Then, Solution-1 and Solution-2, are to be considered distinct, if and only if Solution-2 does not represent a permutation of the components of Solution-1.


See my answer, which uses Stars and Bars theory, to obtain a closed form expression for the number of distinct solutions.

user2661923
  • 35,619
  • 3
  • 17
  • 39
  • Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on [meta], or in [chat]. Comments continuing discussion may be removed. – Xander Henderson Apr 24 '23 at 20:27

1 Answers1

1

No significant change. Simply corrected a broken link to one of the references.


How many distinct solutions are there to the following problem:

  • $a + b + c = (2n+1) ~: ~n \in \Bbb{Z^+}.$
  • $a,b,c \in \Bbb{Z}.$
  • $1 \leq a,b,c \leq n.$

For Stars and Bars theory, see Link-1 and Link-2.

For any set $~M~$ with a finite number of elements, let $~|M|~$ denote the number of elements in the set $~M.$

Let $~D~$ denote the set of all solutions to the problem, under the assumption that when Solution-2 is a permutation of Solution-1, that these two solutions are to be regarded as distinct elements of $~D.~$

Let $~E~$ denote the subset of $~D~$ where exactly two of the three components are equal. Note that the set $~E~$ excludes the element of $~D~$ where all three components are equal (if any).

Let $~F~$ denote the subset of $~D~$ where all three components are equal (if any).

Then the number of distinct solutions, where permuted solutions are not to be regarded as distinct is:

$$\frac{|D| - |E| - |F|}{3!} + \frac{|E|}{3} + |F|. \tag1 $$

The expression in (1) above is explained as follows:

  • $D ~\setminus ~(E \cup F) ~$ represents the set of solutions that contain exactly $~3~$ distinct components. Each distinct solution will appear $~3!~$ times in the set $~D ~\setminus ~(E \cup F).$

    For example, if $~n = 5,~$ then the set $~D~$ will contain each of the following elements, which all represent the same answer:

    $(1,2,8), ~(1,8,2), ~(2,1,8), ~(2,8,1), ~(8,1,2), ~(8,2,1).$

  • $E$ represents the set of solutions that contain exactly $~2~$ distinct components [i.e. when $~n = 5,~$ a solution like $~(5,5,1)~$].
    Each distinct solution will appear $~3~$ times in the set $~E.$

So, the entire problem reduces to computing a closed form expression for each of $~|D|, ~|E|, ~|F|.~$


$\underline{\text{Computation of} ~|D|}$

I will parallel the approach given in The Model.

So, the task here is to compute the number of solutions to:

  • $x_1 + x_2 + x_3 = (2n+1) ~: ~n \in \Bbb{Z^+}.$

  • $x_1, ~x_2, ~x_3 \in \Bbb{Z_{\geq 1}}.$

  • $x_1, ~x_2, ~x_3 \leq n.$

Basic Stars and Bars theory, as documented in Link-1 at the start of this answer, provides a formula, based on the assumption that the lower bound of the variables is $~0,~$ rather than $~1.$ So, the first thing to do is employ a change of variables, to adjust the lower bounds.

For $~i \in \{1,2,3\},~$ let $~y_i = x_i - 1.$

Then $~|D|~$ will equal the number of solutions to:

  • $y_1 + y_2 + y_3 = (2n+1) - 3 = (2n - 2).$

  • $y_1, ~y_2, ~y_3 \in \Bbb{Z_{\geq 0}}.$

  • $y_1, ~y_2, ~y_3 \leq (n - 1).$

Following The Model:

  • Let $~S~$ denote the set of all solutions, where the upper bound constraint [i.e. $~y_i \leq (n-1)~$ ] is ignored.

  • For $~i \in \{1,2,3\}, ~$ let $~S_i~$ denote the subset of $~S~$ where $~y_i \geq n.$

Then

$$|D| = |S| - |S_1 \cup S_2 \cup S_3|.$$

So,

  • Let $~T_0~$ denote $~|S|.$

  • Let $~T_1~$ denote $~|S_1| + |S_2| + |S_3|.$

  • Let $~T_2~$ denote $~|S_1 \cap S_2| + |S_1 \cap S_3| + |S_2 \cap S_3|.$

  • Let $~T_3~$ denote $~|S_1 \cap S_2 \cap S_3|.$

Then,

$$|D| = T_0 - T_1 + T_2 - T_3.$$

You can examine The Model for a description of the Math involved.

You have that:

  • $~\displaystyle T_0 = \binom{2n}{2}.$

  • $~\displaystyle T_1 = 3 \times \binom{n}{2}.~$

  • $~T_2 = 0, ~T_3 = 0.~$

Therefore,

$$|D| = \binom{2n}{2} - \left[ ~3 \times \binom{n}{2} ~\right] = \frac{n^2 + n}{2}.$$


$\underline{\text{Computation of} ~|F|}$

The set $~F~$ represents the set of all solutions $~(a,b,c)~$ where $~a + b + c = (2n+1),~$ and $~a = b = c.~$

Define the variable $~\alpha_n~$ so that

  • If $~(2n+1)~$ is a multiple of $~3,~$ then $~\alpha_n = 1.$

  • If $~(2n+1)~$ is not a multiple of $~3,~$ then $~\alpha_n = 0.$

Then $$|F| = \alpha_n.$$


$\underline{\text{Computation of} ~|E|}$

Consider the number of solutions to:

  • $2x_1 + x_2 = (2n+1).$

  • $x_1, ~x_2, \in \Bbb{Z_{\geq 1}}.$

  • $x_1, ~x_2 \leq n.$

The above bullet pointed problem will have exactly one solution for each value of $~x_1~$ that is viable.

For $~x_1 \in \{1,2,\cdots,n\},~$ you have that $~x_2 = (2n+1) - 2x_1.$

You must have $~x_2 \in \{1,2,\cdots,n\}.~$

So, clearly an upper bound for $~x_1~$ is $~x_1 = n \implies x_2 = 1.~$

The constraint that $~(2n+1) - 2x_1 \leq n~$ will be true if and only if

$\dfrac{n+1}{2} \leq x_1.$

Therefore, letting $~\lceil r\rceil ~$ denote the smallest positive integer $~\geq r ~$ (i.e. the ceiling of $~r~$), you have that the lower bound for $~x_1~$ is $~\displaystyle \left\lceil ~\frac{n+1}{2} ~\right\rceil.$

Therefore, the number of solutions to the bullet pointed problem above is

$\displaystyle (n+1) - \left\lceil ~\frac{n+1}{2} ~\right\rceil.$

From this, you have to deduct $~\alpha_n~$ which represents the solution (if any) where $~x_1 = x_2.~$

Then,

$$|E| = 3 \times \left\{ ~(n+1) - \left\lceil ~\frac{n+1}{2} ~\right\rceil - \alpha_n ~\right\}. \tag2 $$

To illustrate the idea behind (2) above, assume that $~n = 4.~$
This implies that:

  • $\displaystyle \left\lceil ~\frac{n+1}{2} ~\right\rceil = 3.$

  • $~\alpha_n = 1.$

  • $|E| = 3 \times \{5 - 3 - 1\} = 3 \times 1 = 3.$

The viable solutions to $~2x_1 + x_2 = 9~$ are given by
$(x_1,x_2) \in \{~(3,3), (4,1) ~\}.~$

Then, in the set $~E~$ the solution $~(x_1,x_2) = (4,1)~$ will be represented by

$(a,b,c) \in \{~(4,4,1), ~(4,1,4), ~(1,4,4) ~\}.$

Further, the solution $~(x_1,x_2) = (3,3),~$ which represents
$(a,b,c) = (3,3,3)~$ is excluded from set $~E.$


$\underline{\text{Final Computation}}$

  • $\displaystyle |D| = \frac{n^2 + n}{2}.$

  • $3 ~| ~(2n+1) \implies \alpha_n = 1.$
    $3 ~\not| ~(2n+1) \implies \alpha_n = 0.$

  • $|F| = \alpha_n.$

  • $\displaystyle |E| = 3 \times \left\{ ~(n+1) - \left\lceil ~\frac{n+1}{2} ~\right\rceil - \alpha_n ~\right\}.$

So, the number of distinct solutions, where different permutations of the same solution are not considered distinct, is

$$\frac{|D| - |E| - |F|}{3!} + \frac{|E|}{3} + |F|. $$

user2661923
  • 35,619
  • 3
  • 17
  • 39
  • 1
    Thanks for resurrecting this question; I thought it was a shame that it didn't fare better. Interestingly, this seems to correspond to the number of integer partitions of $n+2$ with exactly 3 parts. (I have some ideas for a bijection, but have not worked it out.) This possibly equivalent partition question has a very nice solution, $\left{ (n+2)^2/12 \right}$ where braces denote nearest integer. This was in the problems section of the American Mathematical Monthly 47 (1940) pp664-665 in the context of counting essentially different integer side-length triangles with the same perimeter. – Brian Hopkins Apr 24 '23 at 04:33
  • 1
    @BrianHopkins The mapping $(a,b,c)\mapsto (a+1,b+1,c+1)$ is a bijection from "integer triangles with perimeter $2n+1$" to "integer triangles with perimeter $2n+4$". Then, you can apply this bijection. – Mike Earnest Apr 24 '23 at 16:07
  • @MikeEarnest Thanks much. The direct bijection is then $(a,b,c) \mapsto ((a+b-c+1)/2, (a-b+c+1)/2, (-a+b+c+1)/2)$. – Brian Hopkins Apr 25 '23 at 17:59