Find a minimal set whose elements determine explicitly all integer solutions to $x + y + z = 2n$

127 Views Asked by At

Is there a way to exactly parameterise all the solutions to the equation $x + y + z = 2n$, for $z$ less than or equal to $y$, less than or equal to $x$, for positive integers $x,y,z$?

For example, for $n=4$ it is not hard to find explicitly the solutions: $(6,1,1), (5,2,1), (4,3,1), (4,2,2), (3,3,2)$. It seems like a promising strategy is to increment down $x= 2n -2$ in steps of $1$, but as n gets large, this seems like a daunting branching task.

I am aware that the number of solutions is the closest integer to $n^{2}/3$, but I am looking for a sequence that explicitly generates all of these triplets. Moreover, I want this sequence to be 'minimal', i.e. to contain no repeats: is this problem solvable?

I have a way to enumerate these triplets by considering $(2n-2i+2,i+j-1,i-j+1)$ and letting j vary from 1 to i and i vary from 1 to n, however, these produce many repetitions (which makes sense, as we have $n(n+1)/2$ elements as opposed to the nearest integer to $n^{2}/3$).

It is not good enough for me to simply delete the repetitions- I need the number of elements in this generating sequence to be precisely equal to the number of distinct solutions- so the minimal set of solutions.

4

There are 4 best solutions below

3
On

First notice that for $n=1$ you have that $x+y+z>2$ and thus that there are no solutions. So assume $n>1$.

Just fix $x$ to be the smallest positive integer $1$. Notice that $z=2n-x-y$ and thus you can let $y=1$ and see if it fits, then $y=2$, etc. until you cannot satisfy $z\geq y\geq x>0$ anymore. If you had all triples with $x=1$, then move to $x=2$ and do the same procedure again. And so on, until $x$ becomes too large to even find a value for $y$ and then the procedure stops.

Above gives an algorithm to find all triples satisfying $x+y+z=2n$.

5
On

The equation $x+y=n$ for $x,y\ge 1$ has the solutions $\{(x,n-x)|x=1,...,n-1\}$. Once you have this, to solve $x+y+z=n$ you solve the pair

$$x+y'=n$$ $$y+z=y'$$

Each solution to the top equation $x,y'$ determines a value for $y'$ in the second. Then using each value obtained for $y'$ gives a separate equation for $y,z$ to be solved. This idea is called recursion.

To get your equation, replace $n$ with $2n$.

Using this idea, the parametrisation becomes

$$(x,y,z)=(x,y,2n-x-y)$$

where you take all integers $x>0$ and $y>0$ satisfying $n-x/2\le y\le x$.

1
On

You can use generating functions

Let us change the question to an equivalent
$y +(y+a) +(y+a+b) = 3y+2a+b = 2n$ over the integers with $y\geq 1,a,b, \geq 0$

Generating functions of $3y,\; 2a,\; b\;$ are respectively $\frac{x^3}{1-x^3},\;\; \frac{1}{1-x^2},\;\; \frac{1}{1-x}$

Finally, find the coefficient of $x^{2n}\;$ in the expansion of $\frac{x^3}{1-x^3}\cdot\frac{1}{1-x^2}\cdot \frac{1}{1-x}$


ADDED

For example, for $2n=12$, the coefficient is seen as $12$, and confirmed, viz
$11\small{X},$$\;\;129,\;\;138,\;\;147,\;\;156,\;\;228,\;\;237,\;\;246,\;\;255,\;\;336,\;\;345,\;\;444$

0
On

For any $x,n\in \mathbb N$, let $A(x,n)$ denote the list of valid triples summing to $2n$ whose first coordinate is $x$, sorted in increasing order of their second coordinate. We can give an explicit description for $A(x,n)$: $$ A(x,n):= [(x, y, 2n-x-y) \quad\text{ for }\quad \lceil n-x/2\rceil \le y \le \min(2n-x-1,x)] $$ For example, take $x=15$ and $n=13$. Since $\lceil 13-15/2\rceil=6$, $y$ will start at $6$, and since $\min(2\cdot 13-15-1,13)=\min(10,13)=10$, $y$ will end at $10$. The result is $$ A(15,13)=[(15,6,5),(15,7,4),(15,8,3),(15,9,2),(15,10,1)] $$ Then the following list enumerates all valid triples exactly once: $$ A(\lceil 2n/3\rceil,n)\oplus A(\lceil 2n/3\rceil + 1,n)\oplus \dots \oplus A(2n-2,n) $$ That is, we take all of the lists $A(x,n)$ for $x$ between $\lceil 2n/3\rceil$ and $2n-2$, inclusive, and concatenate them altogether.

To see that this works, note that all of the triples within $A(x,n)$ are distinct, since they all have different $y$-coordinates. Furthermore, for any $x\neq x'$, all of the triples in $A(x,n)$ are distinct from all of $A(x',n)$, since the $x$-coordinates differ.