ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 05 Feb 2021 19:17:42 +0100integer solutions to this system of equationshttps://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/Consider the following system of two equations:
$$
x + y + z = 24 n + 3
$$
$$
x y z = 576 n³ + 216 n^2 + 27 n - 25
$$
For what value of $n$ are there integer solutions $x$, $y$, $z$?
Can someone help me to write down a code for the above!Sun, 31 Jan 2021 15:18:02 +0100https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/Comment by Emmanuel Charpentier for <p>Consider the following system of two equations:
$$
x + y + z = 24 n + 3
$$
$$
x y z = 576 n³ + 216 n^2 + 27 n - 25
$$</p>
<p>For what value of $n$ are there integer solutions $x$, $y$, $z$?</p>
<p>Can someone help me to write down a code for the above!</p>
https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?comment=55519#post-id-55519Homework ?Sun, 31 Jan 2021 16:48:29 +0100https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?comment=55519#post-id-55519Comment by sonu1997 for <p>Consider the following system of two equations:
$$
x + y + z = 24 n + 3
$$
$$
x y z = 576 n³ + 216 n^2 + 27 n - 25
$$</p>
<p>For what value of $n$ are there integer solutions $x$, $y$, $z$?</p>
<p>Can someone help me to write down a code for the above!</p>
https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?comment=55528#post-id-55528No just trying to solve!Mon, 01 Feb 2021 04:55:10 +0100https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?comment=55528#post-id-55528Answer by Max Alekseyev for <p>Consider the following system of two equations:
$$
x + y + z = 24 n + 3
$$
$$
x y z = 576 n³ + 216 n^2 + 27 n - 25
$$</p>
<p>For what value of $n$ are there integer solutions $x$, $y$, $z$?</p>
<p>Can someone help me to write down a code for the above!</p>
https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?answer=55521#post-id-55521I assume that $x,y,z,n$ are nonnegative.
This system is equivalent to the equation: $(x+y+z)^3 = 24xzy + 627$. By AM-GM inequality, we have
$$27xyz \leq (x+y+z)^3 = 24xzy + 627,$$
implying that $xyz \leq 209$. That is, there are only a finite number of solutions, which are easy to find by brute-force.
----
**ADDED.** One can also apply AM-GM in the other direction:
$$(x+y+z)^3 = 24xzy + 627 \leq \frac{24}{27}(x+y+z)^3 + 627,$$
implying that $(x+y+z)^3 \leq 5643$ and thus $24n+3=x+y+z\leq 17$. This gives $n=0$ as the only possible option, however it would mean $xyz=-25$, a contradiction.Sun, 31 Jan 2021 20:04:31 +0100https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?answer=55521#post-id-55521Comment by Emmanuel Charpentier for <p>I assume that $x,y,z,n$ are nonnegative.</p>
<p>This system is equivalent to the equation: $(x+y+z)^3 = 24xzy + 627$. By AM-GM inequality, we have
$$27xyz \leq (x+y+z)^3 = 24xzy + 627,$$
implying that $xyz \leq 209$. That is, there are only a finite number of solutions, which are easy to find by brute-force.</p>
<hr>
<p><strong>ADDED.</strong> One can also apply AM-GM in the other direction:
$$(x+y+z)^3 = 24xzy + 627 \leq \frac{24}{27}(x+y+z)^3 + 627,$$
implying that $(x+y+z)^3 \leq 5643$ and thus $24n+3=x+y+z\leq 17$. This gives $n=0$ as the only possible option, however it would mean $xyz=-25$, a contradiction.</p>
https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?comment=55586#post-id-55586Very nice, *under the assumption* $x, y, z, n \in \mathbb{Z}^{*+}$.
What can be said for negative solutions ?Fri, 05 Feb 2021 08:21:40 +0100https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?comment=55586#post-id-55586Comment by Max Alekseyev for <p>I assume that $x,y,z,n$ are nonnegative.</p>
<p>This system is equivalent to the equation: $(x+y+z)^3 = 24xzy + 627$. By AM-GM inequality, we have
$$27xyz \leq (x+y+z)^3 = 24xzy + 627,$$
implying that $xyz \leq 209$. That is, there are only a finite number of solutions, which are easy to find by brute-force.</p>
<hr>
<p><strong>ADDED.</strong> One can also apply AM-GM in the other direction:
$$(x+y+z)^3 = 24xzy + 627 \leq \frac{24}{27}(x+y+z)^3 + 627,$$
implying that $(x+y+z)^3 \leq 5643$ and thus $24n+3=x+y+z\leq 17$. This gives $n=0$ as the only possible option, however it would mean $xyz=-25$, a contradiction.</p>
https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?comment=55589#post-id-55589It's much harder if negative values are allowed.Fri, 05 Feb 2021 19:17:42 +0100https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?comment=55589#post-id-55589Answer by Emmanuel Charpentier for <p>Consider the following system of two equations:
$$
x + y + z = 24 n + 3
$$
$$
x y z = 576 n³ + 216 n^2 + 27 n - 25
$$</p>
<p>For what value of $n$ are there integer solutions $x$, $y$, $z$?</p>
<p>Can someone help me to write down a code for the above!</p>
https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?answer=55579#post-id-55579[Max](https://ask.sagemath.org/users/26682/max-alekseyev/) gives us a shortcut allowing us to use brute force to check for (positive) roots of this system. But what is the solution ?
First, let's see how Max's shortcut can be derived in Sage :
sage: var("x, y, z, p")
(x, y, z, p)
Our initial equations are :
sage: E1=x+y+z==24*p+3
sage: E2=x*y*z==576*p^3+216*p^2+27*p-25
Let's solve E2, keeping only real roots, but with no consideration for their integrity
sage: E2.solve(p)
[p == -1/16*(8/9*x*y*z + 209/9)^(1/3)*(I*sqrt(3) + 1) - 1/8, p == -1/16*(8/9*x*y*z + 209/9)^(1/3)*(-I*sqrt(3) + 1) - 1/8, p == 1/24*(24*x*y*z + 627)^(1/3) - 1/8]
Substitute in E1 :
sage: E1.subs(E2.solve(p)[2])^3
(x + y + z)^3 == 24*x*y*z + 627
AM-GM inequality gives us :
sage: I1=(x+y+z)/3>=(x*y*z)^(1/3)
sage: ((I1*3)^3)
(x + y + z)^3 >= 27*x*y*z
Adding our constraints :
sage: (((I1*3)^3).subs(E1.subs(E2.solve(p)[2])^3))
24*x*y*z + 627 >= 27*x*y*z
which results in:
sage: I2=(((I1*3)^3).subs(E1.subs(E2.solve(p)[2])^3)).solve(x*y*z)
[[x*y*z - 209 == 0], [-x*y*z + 209 > 0]]
This upper limit allows us to program a "brute-force" search :
sage: %%time
....: L=[]
....: for a in (1..209):
....: for b in (1..209//a):
....: for c in (1..209//(a*b)):
....: D1={x:a, y:b, z:c}
....: S1=E1.subs(D1).solve_diophantine(solution_dict=True)
....: if len(S1)>0:
....: L2=[D1.update(s) for s in S1 if bool(E2.subs(D1).subs(S1))]
....: if len(L2)>0: L.append(L2)
....:
CPU times: user 34.3 s, sys: 16 ms, total: 34.4 s
Wall time: 34.4 s
But :
sage: L
[]
The original system doesn't seem to have solutions. A check seems in order...Thu, 04 Feb 2021 14:28:06 +0100https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?answer=55579#post-id-55579Comment by Max Alekseyev for <p><a href="https://ask.sagemath.org/users/26682/max-alekseyev/">Max</a> gives us a shortcut allowing us to use brute force to check for (positive) roots of this system. But what is the solution ?</p>
<p>First, let's see how Max's shortcut can be derived in Sage :</p>
<pre><code>sage: var("x, y, z, p")
(x, y, z, p)
</code></pre>
<p>Our initial equations are :</p>
<pre><code>sage: E1=x+y+z==24*p+3
sage: E2=x*y*z==576*p^3+216*p^2+27*p-25
</code></pre>
<p>Let's solve E2, keeping only real roots, but with no consideration for their integrity</p>
<pre><code>sage: E2.solve(p)
[p == -1/16*(8/9*x*y*z + 209/9)^(1/3)*(I*sqrt(3) + 1) - 1/8, p == -1/16*(8/9*x*y*z + 209/9)^(1/3)*(-I*sqrt(3) + 1) - 1/8, p == 1/24*(24*x*y*z + 627)^(1/3) - 1/8]
</code></pre>
<p>Substitute in E1 :</p>
<pre><code>sage: E1.subs(E2.solve(p)[2])^3
(x + y + z)^3 == 24*x*y*z + 627
</code></pre>
<p>AM-GM inequality gives us : </p>
<pre><code>sage: I1=(x+y+z)/3>=(x*y*z)^(1/3)
sage: ((I1*3)^3)
(x + y + z)^3 >= 27*x*y*z
</code></pre>
<p>Adding our constraints :</p>
<pre><code>sage: (((I1*3)^3).subs(E1.subs(E2.solve(p)[2])^3))
24*x*y*z + 627 >= 27*x*y*z
</code></pre>
<p>which results in:</p>
<pre><code>sage: I2=(((I1*3)^3).subs(E1.subs(E2.solve(p)[2])^3)).solve(x*y*z)
[[x*y*z - 209 == 0], [-x*y*z + 209 > 0]]
</code></pre>
<p>This upper limit allows us to program a "brute-force" search :</p>
<pre><code>sage: %%time
....: L=[]
....: for a in (1..209):
....: for b in (1..209//a):
....: for c in (1..209//(a*b)):
....: D1={x:a, y:b, z:c}
....: S1=E1.subs(D1).solve_diophantine(solution_dict=True)
....: if len(S1)>0:
....: L2=[D1.update(s) for s in S1 if bool(E2.subs(D1).subs(S1))]
....: if len(L2)>0: L.append(L2)
....:
CPU times: user 34.3 s, sys: 16 ms, total: 34.4 s
Wall time: 34.4 s
</code></pre>
<p>But :</p>
<pre><code>sage: L
[]
</code></pre>
<p>The original system doesn't seem to have solutions. A check seems in order...</p>
https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?comment=55580#post-id-55580Thanks to the symmetry, you can also assume that $a\geq b\geq c$ to save some time. But in fact, the solutions can be obtained without any brute-force, if we apply AM-GM in the other direction -- see update in my answer.Thu, 04 Feb 2021 19:30:02 +0100https://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/?comment=55580#post-id-55580