# Can two perfect squares average to a third perfect square? [duplicate]

My question is does there exist a triple of integers, $a<b<c$ such that $b^2 = \frac{a^2+c^2}{2}$

I suspect that the answer to this is no but I have not been able to prove it yet. I realize this is very similar to the idea of Pythagorean triples but I am not versed enough in this subject to try and modify the theory for this case. One simple observation is that in order to have any hope of this working is that $a$ and $c$ must be of the same parity. Furthermore if such a triple exists we can build an infinite sequence since $(2b)^2 = \frac{(2a)^2+(2c)^2}{2}$ if and only if $b^2 = \frac{a^2+c^2}{2}$

Any help on determining this to be either true or false would be much appreciated. I am hoping it does end up being impossible, so if someone does find a desired triple I would next move up to cubes instead of squares

Edit: Thank you for the comments, I have foolishly overlooked a simple example and see that there are many solutions to this based on the theory of diophantine equations. However this is unfortunate for me because i was hoping NOT to be able to solve this. This question arose while studying a certain type of graph labeling. What I desire is to be able to create a sequence, $S$, of arbitrary length (since each member of the sequence is to be a label of a vertex in the graph) such that for every $x \in S$, $|x-s_i| \neq |x-s_j|$ for $i \neq j$. I was naively hoping that the sequence of squares was sufficient to satisfy this condition.

Further edit, I have found that the sequence $2^n$ works but it would be nice if I could find a polynomial sequence.

## marked as duplicate by mathlove, Joel Reyes Noche, Najib Idrissi, Travis, Jonas MeyerMay 30 '15 at 17:38

• (1 + 49) / 2 = 25 – Will Jagy May 28 '15 at 22:18
• @WillJagy I'd say that qualifies as an answer. – AlexR May 28 '15 at 22:22
• Now the next step is to determine if there is an infinite number of such triplets, or just a finite number – Tryss May 28 '15 at 22:24
• There are plenty of 3AP (arithmetic progressions of three elements) made of squares. However, there is no 4AP of squares. This is more or less equivalent to the case $n=4$ of the Fermat Last Theorem. – Jack D'Aurizio May 28 '15 at 22:35
• I think it gets even better, since you can have an actually arbitrary dense sequence of such integers, as demonstrated here : ncbi.nlm.nih.gov/pmc/articles/PMC1078964 – C4stor May 29 '15 at 14:38

$$\frac{1 + 49}{2} = 25$$

There are infinitely many solutions to $x^2 + y^2 = 2 z^2.$ I am pretty sure that version has been asked on MSE before, and formulas giving all integer answers were given. Give me a few minutes, I will find that or do it over.

here is a recent discussion Diophantine Equations : Solving $a^2+ b^2=2c^2$

• could you please add the link from MSE? could not find it. – jermenkoo May 29 '15 at 13:30

Parametric solution: $$a = |x^2 - 2 x y - y^2|, \ b = x^2 + y^2,\ c = x^2 + 2 x y - y^2$$

• $a\lt b\lt c{}$? – Barry Cipra May 28 '15 at 22:59
• $a < b < c$ if $0 < y < x$. – Robert Israel May 28 '15 at 23:37

If $b^2=|x+iy|^2$, then $2b^2=|(1+i)(x+iy)|^2$, so all you need to get rolling are Pythagorean triples (written here as $b^2=x^2+y^2$).

• Barry, I did not initially put it together, but we get infinitely many solutions to any $x^2 + y^2 = n z^2$ as long as $n = u^2 + v^2$ and $a^2 + b^2 = c^2$ is Pythagorean, take $(ua \pm vb)^2 + (ub \mp va)^2 = n c^2.$ – Will Jagy May 29 '15 at 0:10

This is an off-the-wall answer/consequence but I think it's interesting.

Consider the equation $$x^2 + y^2 = 2z^2$$ this can be rewritten as $$(x + z)(x - z) = (z + y)(z - y).$$

Let $A = x + z, \quad B = x - z, \quad D = z + y, \quad C = z - y.$

Also let $P = AB = CD.$

Note that

\begin{align} (\xi + A)(\xi - B) &= \xi^2 + 2z\xi - P\tag{1}\\ (\xi + C)(\xi + D) &= \xi^2 + 2z\xi + P\tag{2}\\ \end{align}

This implies that each of the four polynomials $\xi^2 \pm 2z\xi \pm P$ is factorable over the set of integers.

Further, if $A, B, C,$ and $D$ that solve $(1)$ and $(2)$ can be found, then

$$x = \frac 1 2 (A + B), \quad y = \frac 1 2(D - C), \quad z = \frac 1 2(A - B) = \frac 1 2(C + D)$$

Actually, $x, y,$ and $z$ as show above will usually come out to be multiples of $\frac 1 2.$ If that is the case, then you have to use $2x, 2y,$ and $2z$.

I have a heuristic for remembering how to find values of $A, B, C,$ and $D.$ Choose any two relatively prime, opposite-parity numbers $n > m$ and fill in the following table.

\begin{array}{|c|c|c} \hline n & n+m & A = n(n+m) \\ \hline n-m & m & B = m(n-m) \\ \hline C = n(n-m) & D = m(n+m) & \end{array}

It follows that $$x = \dfrac{n^2 - m^2}{2} + mn, \quad y = \dfrac{n^2 - m^2}{2} - mn, \quad z = \dfrac{n^2 + m^2}{2}$$

To show what this is like with some numbers, let n = 3 and m = 2. We get

\begin{array}{|c|c|c} \hline 3 & 5 & A = 15 \\ \hline 1 & 2 & B = 2 \\ \hline C = 3 & D = 10 & \end{array}

We see that \begin{align} (\xi + 15)(\xi - 2) &= \xi^2 + 13\xi - 30\\ (\xi + 3)(\xi + 10) &= \xi^2 + 13\xi + 30\\ \end{align}

And, doubling our answers, $2x = 17, \quad 2y = 7, \quad 2z = 13$

And we see that $x^2 + y^2 = z^2$

Suppose $0<a<b<c$ is a pythagorean triple, i.e., $a^2+b^2=c^2$. Then, $2c^2$ is also a sum of two squares: $$2c^2 = 2(a^2+b^2) = (1^2+1^2)(a^2+b^2) = (b+a)^2+(b-a)^2.$$ Thus, the pythagorean triple $(a,b,c)$ produces a solution $(b-a,b+a,c)$ of $x^2+y^2=2z^2$. For instance, $(3,4,5)$ produces $(1,7,5)$, or $1+7^2=2\cdot 5^2$.
Conversely, if $(e,f,g)$ is a solution of $x^2+y^2=2z^2$ with $e<f$, then $g^2$ is also a sum of two squares, namely $$g^2 = \left(\frac{f+e}{2}\right)^2 + \left(\frac{f-e}{2}\right)^2.$$ Hence $(e,f,g)$ produces a pythagorean triple $((f-e)/2,(f+e)/2,g)$. (Note that $f^2+e^2$ is even, and so $f\equiv e \bmod 2$, and therefore $f+e$ and $f-e$ are even too.)
It follows that there is a bijection between pythagorean triples and solutions of $x^2+y^2=2z^2$: $$(a,b,c) \mapsto (b-a,b+a,c).$$
Since every pythagorean triple can be written as: $$(\lambda(n^2-m^2),\lambda 2mn,\lambda(n^2+m^2))$$ for some $n>m>0$ and some $\lambda\geq 1$, we have that every solution of $x^2+y^2=2z^2$ is of the form $$(\lambda(2mn-(n^2-m^2)), \lambda(n^2-m^2+2mn),\lambda(n^2+m^2))$$ for some $\lambda\geq 1$ and some $0<m<n$.