Do there exist pairs of distinct real numbers whose arithmetic, geometric and harmonic means are all integers?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
64
down vote

favorite
18












I self-realized an interesting property today that all numbers $(a,b)$ belonging to the infinite set $$(a,b): a=(2l+1)^2, b=(2k+1)^2; l,k in N; l,kgeq1$$ have their AM and GM both integers.



Now I wonder if there exist distinct real numbers $(a,b)$ such that their arithmetic mean, geometric mean and harmonic mean (AM, GM, HM) all three are integers. Also, I wonder if a stronger result for $(a,b)$ both being integers exists.



I tried proving it, but I did not find it easy. For the AM, it is easy to assume a real $a$ and an AM $m_1$ such that the second real $b$ equals $2m_1-a$. For the GM, we get a condition that $m_2=sqrt(2m_1-a)a$. If $m_2$ is an integer, then… what? I am not sure exactly how we can restrict the possible values of $a$ and $m_1$ in this manner.







share|cite|improve this question


















  • 12




    Fun fact: this was a problem on the 2017 Virginia Tech math competition (problem 5 there)
    – Carmeister
    Apr 16 at 18:55














up vote
64
down vote

favorite
18












I self-realized an interesting property today that all numbers $(a,b)$ belonging to the infinite set $$(a,b): a=(2l+1)^2, b=(2k+1)^2; l,k in N; l,kgeq1$$ have their AM and GM both integers.



Now I wonder if there exist distinct real numbers $(a,b)$ such that their arithmetic mean, geometric mean and harmonic mean (AM, GM, HM) all three are integers. Also, I wonder if a stronger result for $(a,b)$ both being integers exists.



I tried proving it, but I did not find it easy. For the AM, it is easy to assume a real $a$ and an AM $m_1$ such that the second real $b$ equals $2m_1-a$. For the GM, we get a condition that $m_2=sqrt(2m_1-a)a$. If $m_2$ is an integer, then… what? I am not sure exactly how we can restrict the possible values of $a$ and $m_1$ in this manner.







share|cite|improve this question


















  • 12




    Fun fact: this was a problem on the 2017 Virginia Tech math competition (problem 5 there)
    – Carmeister
    Apr 16 at 18:55












up vote
64
down vote

favorite
18









up vote
64
down vote

favorite
18






18





I self-realized an interesting property today that all numbers $(a,b)$ belonging to the infinite set $$(a,b): a=(2l+1)^2, b=(2k+1)^2; l,k in N; l,kgeq1$$ have their AM and GM both integers.



Now I wonder if there exist distinct real numbers $(a,b)$ such that their arithmetic mean, geometric mean and harmonic mean (AM, GM, HM) all three are integers. Also, I wonder if a stronger result for $(a,b)$ both being integers exists.



I tried proving it, but I did not find it easy. For the AM, it is easy to assume a real $a$ and an AM $m_1$ such that the second real $b$ equals $2m_1-a$. For the GM, we get a condition that $m_2=sqrt(2m_1-a)a$. If $m_2$ is an integer, then… what? I am not sure exactly how we can restrict the possible values of $a$ and $m_1$ in this manner.







share|cite|improve this question














I self-realized an interesting property today that all numbers $(a,b)$ belonging to the infinite set $$(a,b): a=(2l+1)^2, b=(2k+1)^2; l,k in N; l,kgeq1$$ have their AM and GM both integers.



Now I wonder if there exist distinct real numbers $(a,b)$ such that their arithmetic mean, geometric mean and harmonic mean (AM, GM, HM) all three are integers. Also, I wonder if a stronger result for $(a,b)$ both being integers exists.



I tried proving it, but I did not find it easy. For the AM, it is easy to assume a real $a$ and an AM $m_1$ such that the second real $b$ equals $2m_1-a$. For the GM, we get a condition that $m_2=sqrt(2m_1-a)a$. If $m_2$ is an integer, then… what? I am not sure exactly how we can restrict the possible values of $a$ and $m_1$ in this manner.









share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited May 12 at 11:21

























asked Apr 16 at 10:32









Gaurang Tandon

3,38122147




3,38122147







  • 12




    Fun fact: this was a problem on the 2017 Virginia Tech math competition (problem 5 there)
    – Carmeister
    Apr 16 at 18:55












  • 12




    Fun fact: this was a problem on the 2017 Virginia Tech math competition (problem 5 there)
    – Carmeister
    Apr 16 at 18:55







12




12




Fun fact: this was a problem on the 2017 Virginia Tech math competition (problem 5 there)
– Carmeister
Apr 16 at 18:55




Fun fact: this was a problem on the 2017 Virginia Tech math competition (problem 5 there)
– Carmeister
Apr 16 at 18:55










7 Answers
7






active

oldest

votes

















up vote
24
down vote



accepted
+200










Here's how you can work out the answer from scratch, without needing any clever leaps of insight of the form "let's try a solution like this!".



It does require a few "tricks of the trade", which I will point out as they come up. But those are general-purpose tricks rather than specific insights into this problem. Aside from that, we'll just do the easiest thing available at each step :-).




When I first answered this, I misinterpreted the question as requiring our numbers to be integers. It seems like an interesting question either way, so here first of all is my original answer, followed by a version that (as the OP intended) doesn't make that assumption.



When our numbers are required to be integers



So, suppose our two numbers are $a,b$. Their geometric mean is $sqrtab$; that's an integer, so $ab$ is a square. So [TRICK 1] we must have $a=pq^2$ and $b=pr^2$ for some integers $p,q,r$.



That takes care of the geometric mean. The arithmetic mean just needs $a,b$ to have the same parity, which is going to be easy. So what about the harmonic mean? That's $frac2aba+b$. It has to be an integer, so let's give it a name, $h$ say. So $2ab=h(a+b)$ or, in terms of the new variables we introduced above, $2p^2q^2r^2=ph(q^2+r^2)$. Let's lose a factor of $p$: $2pq^2r^2=h(q^2+r^2)$. And, remember, this equation is the only thing we need other than making sure $a,b$ are both odd or both even.



The next thing to notice is that the LHS is a multiple of both $q^2$ and $r^2$. Wouldn't it be nice if that factor of $q^2+r^2$ on the right weren't getting in the way? Aha! [TRICK 2] We can get rid of it, because we can assume that $q$ and $r$ are coprime. Why? Because all we need is $a=pq^2$ and $b=pr^2$, and if $q,r$ have a common factor we can move its square into $p$.



So, we have $q,r$ coprime. Now $q^2mathrel|2pq^2r^2=h(q^2+r^2)$. Since clearly $q^2mathrel|hq^2$ this yields $q^2mathrel|hr^2$ and now since $q,r$ have no common factor we must have $q^2mathrel|h$. Similarly $r^2mathrel|h$. Even better, since $q,r$ have no common factor these two give us $q^2r^2mathrel|h$.



Just as with the original HM, we have one thing dividing another so let's name the quotient. Say $h=tq^2r^2$. What happens to the equation we were looking at? It becomes $2pq^2r^2=tq^2r^2(q^2+r^2)$ or, dividing out the junk, $2p=t(q^2+r^2)$.



But now we're done, because we can just (again, aside from a little bit of caution about parity) take $q,r,t$ to be anything we like and define $p$ by this equation! We will then get $p=t(q^2+r^2)/2$ and then $a=pq^2$ and $b=pr^2$.



Let's figure out those parity constraints. If $q,r$ have the same parity (i.e., are both odd or both even) then $q^2+r^2$ is even, so $p$ is automatically an integer, and $a,b$ automatically have the same parity, so everything is good. If $q,r$ have opposite parity then we will need $p$ to be not only an integer but an even integer, and since $q^2+r^2$ will be odd this requires $t$ to be a multiple of 4.




Putting the bits together, the following procedure (1) always yields $a,b$ with AM,GM,HM all integers and (2) produces every possible such $a,b$:




Choose positive integers $q,r,t$. If $q,r$ are of opposite parity, $t$ must be a multiple of 4; otherwise $t$ is unrestricted. Now write $p=t(q^2+r^2)/2$ and then $a=pq^2$ and $b=pr^2$. (This gives $aneq b$ provided $qneq r$.)





Let's look at a couple of simple examples, trying to make our numbers small. First, with $q,r$ of the same parity. Let's try $q=1,r=3$. Then $t$ can be anything; let's set it to 1. We get $p=5$ and then $a,b=5,45$. The AM is 25, the GM is 15, and the HM is 9.



Next, with $p,q$ of opposite parity. Let's try $q=1,r=2$. Then $t$ has to be a multiple of 4; let's make it 4. We get $p=10$ and then $a,b=10,40$. The AM is 25, the GM is 20, and the HM is 16.




When our numbers are not required to be integers



As I confessed above, all of that assumes that you specifically want your numbers $a,b$ to be integers. What if you are happy for them to be any real numbers at all? How much extra freedom does that give you? Perhaps less than you might think; let's see. Once again, so far as possible I'm just going to do easy things and see where they lead.



First of all, their AM is an integer. Call it $n$; so our numbers are $a=n+d$ and $b=n-d$ for some (not necessarily integral) $d$. Now the GM $sqrtab$ is an integer too, so its square $ab$ certainly is, so $(n+d)(n-d)=n^2-d^2$ is an integer. So $d$ is the square root of an integer; let's say it's $sqrtm$. Finally, the HM is $frac2aba+b=fracabn=fracn^2-mn$, so $m$ is an integer multiple of $n$, say $kn$.



So far, we have figured out that we have $a,b=npmsqrtkn$ for some integers $n,k$. The only thing we haven't used yet is the fact that the GM itself (and not only its square) is an integer; that is, that $n^2-kn=n(n-k)$ is a square; the conditions we've established above are enough to make the AM and HM squares, and the GM the square root of an integer. So, the only further condition is that $n(n-k)$ be a square. Well, by TRICK 1 above this is the same as having $n=pq^2$ and $n-k=pr^2$ for integers $p,q,r$.



So here's the general solution when $a,b$ don't have to be integers:




Choose positive integers $p,q,r$ with $r<q$. Write $n=pq^2$ and $k=p(q^2-r^2)$. Set $a,b=npmsqrtkn$.




Let's once again look at a simple example where the integers involved are small and $a,b$ aren't themselves integers. First, take $p=1,q=2,r=1$. Then $n=4$ and $k=3$ so our numbers are $4pmsqrt12$. The AM is 4; the GM is 2; the HM is 1.






share|cite|improve this answer


















  • 3




    This is amazing! I am definitely putting a +200 bounty on this question once it gets off the HNQ list! This intuition you derive is amazingly simple and fluid. Also, this is the most generalized of all the answers till now. The result you yield is roughly the same as that of Peter's answer, but he didn't delineate the two cases for the parities of $p$ and $q$, so his results are limited. Thanks again!
    – Gaurang Tandon
    Apr 17 at 12:03







  • 2




    How does Trick 1 follow? Take $a = 2sqrt2$ and $b = sqrt2$ so that $ab = 4$ which is square, but neither numbers are of the form $pq^2$ or $pr^2$ for integers $p,q,r$. [These won't work out because you can derive rationality and integer constraints from AM and HM being integers, but you seem to assume that $a$ and $b$ are integers without any discussion or statement]
    – Zain Patel
    Apr 18 at 3:06







  • 2




    @ZainPatel I think that's the point -- Gareth is assuming that $a$ and $b$ are integers. If you want to go through the analysis for the general case, go ahead!
    – Charles
    Apr 18 at 4:06






  • 2




    The question explicitly states that $a$ and $b$ are real numbers. The answer definitely answers the question, and does so in a great way (+1), however the claim that it generates all solutions is wrong.
    – celtschk
    Apr 18 at 7:01






  • 1




    Nice, it seems to be fixed now :-) @celtschk have a look, I think this is perfect now!
    – Gaurang Tandon
    Apr 21 at 4:49

















up vote
86
down vote













Expanding on Christian Blatter's answer.



There are a few key points.



  • The arithmetic mean of two rational numbers is always rational.

  • The harmonic mean of two non-zero rational numbers is always rational.

  • The geometric mean of two squared positive integers is always an integer.

  • For all three types of mean if we multiply every input by a positive real value we also multiply the result by that same value.

These key points lead to a strategy for finding numbers whose am, gm and hm are all integers.



  • pick a pair of integers whose GM is an integer.

  • calculate the AM and HM

  • multiply through by the denominators of the AM and HM.

Now to work this through, pick any two distinct positive integers $x$ and $y$.



$$mathrmGM(x^2,y^2) = xy$$
$$mathrmAM(x^2,y^2) = fracx^2+y^22$$
$$mathrmHM(x^2,y^2) = frac2x^2y^2x^2+y^2$$



Let $t = 2(x^2 + y^2)$ Let $a=tx^2$ Let $b=ty^2$. Since only addition, multiplication and squaring of positive integers is involved it is clear that $t$, $a$ and $b$ are all positive integers. It is also clear that a and b are distinct.



$$mathrmGM(a,b) = txy$$
$$mathrmAM(a,b) = tfracx^2+y^22 = (x^2+y^2)^2$$
$$mathrmHM(a,b) = tfrac2x^2y^2x^2+y^2 = 4x^2y^2$$



Again since all these values can be calculated merely by adding, multiplying and squaring positive integers they are all positive integers.



Lets plug in some numbers, for example $x=1$ and $y=2$



$$t = 10$$
$$a = 10$$
$$b = 40$$
$$mathrmGM(10,40) = 20$$
$$mathrmAM(10,40) = 25$$
$$mathrmHM(10,40) = 16$$




Indeed we can extend this techiquie to find an arbitary size list of integers the AM, GM, and HM of any subset of which are integers. Just start with integers of the form $x^n!$ so the GMs are all integers. Then work out the AMs and HMs and multiply through.






share|cite|improve this answer


















  • 3




    Bravo, +1, but the answer would be even better if you make the expressions for $a$ and for $b$ in terms of only $x$ and $y$ and highlight them, and also make the formula for $mathrmGM(a,b)$ in terms of only $x$ and $y$.
    – Rory Daulton
    Apr 17 at 0:04


















up vote
40
down vote













Take $1$ and any square $>1$. Multiply both of them with the smallest common denominator of their AM and HM.






share|cite|improve this answer


















  • 13




    I worked it out for curiosity: The smallest example this yields is $(10, 40)$, with AM $25$, GM $20$, and HM $16$.
    – Rahul
    Apr 16 at 11:02


















up vote
28
down vote













For any $$
(a, b) = (km^2(m^2 + n^2), kn^2(m^2 + n^2)),
$$
where $k, m, n in mathbbN_+$ and $2 mid a - b$, there is$$
fraca + b2 in mathbbZ, quad sqrtab = kmn(m^2 + n^2) in mathbbZ, quad frac2aba + b = 2km^2 n^2 in mathbbZ.
$$






share|cite|improve this answer
















  • 11




    For the lazy, the smallest nontrivial pair is (40,10).
    – svavil
    Apr 16 at 16:41






  • 3




    However, $(45,5)$ gives the smallest (AM,GM,HM) of $(25,15,9)$.
    – robjohn♦
    Apr 25 at 5:25

















up vote
17
down vote













Commonly, an easy way to solve problems like these is to turn it around:




Pick three integers. Are there real numbers such that GM, AM, and HM are those three integers?




and you simply solve for the two real numbers.



This probably doesn't work here, because you have three equations in two unknowns. But you could pick two of the integers to be, for example, the GM and AM. From there you can solve for the numbers and then compute the HM, and the question is how to make the HM an integer too.



Working through the definitions and assuming $mathrmAM(x,y) neq 0$ you can ultimately determine



$$ x,y = mathrmAM(x,y) pm sqrtmathrmAM(x,y)^2 - mathrmGM(x,y)^2 $$
$$ mathrmHM(x,y) = fracmathrmGM(x,y)^2mathrmAM(x,y) $$



It's now easy to determine all solutions to the original problem. They are obtained by selecting integers $g$ and $a$ satisfying:



  • $|a| > |g|$

  • $a$ divides $g^2$

  • $a neq 0$

and then you can set



  • $x,y = a pm sqrta^2 - g^2$

  • $mathrmAM(x,y) = a$

  • $mathrmGM(x,y) = g$

  • $mathrmHM(x,y) = fracg^2a$

To further solve the problem of asking for $x,y$ to be integers, you need to arrange to have $a^2 - g^2$ be a perfect square. This is a bit more complicated, and related to pythagorean triples.




To work out the integer case, we need to better understand solutions to the $a mid g^2$ condition.



I will boldly assert that, by chasing through the divisibility conditions and using the fact $a neq 0$, the general case comes from:



  • Select integers $u,v,w$ such that $gcd(v,w) = 1$, $v > 0$, and $u neq 0$

  • Set $a = uv^2$

  • Set $g = uvw$

The radicand $a^2 - g^2$ we need to be a perfect square then simplifies:



$$ a^2 - g^2 = u^2 v^2 (v^2 - w^2) $$



This has a square root if and only if $|v|$ and $|w|$ are two components of a primitive pythagorean triple, with $|v|$ the hypotenuse.



The $|a| > |g|$ condition simplifies to requiring $|v| neq |w|$. Given the other constraints, this simplifies to $v > 1$.






share|cite|improve this answer


















  • 5




    I think that is the best answer, as it is the only answer that systematically derives a complete solution, and moreover it explains it nicely. Moreover it is based on a general principle that can be used to solve other problems, so its usefulness goes beyond answering the specific question.
    – celtschk
    Apr 18 at 7:08







  • 2




    Great answer. This also shows that all soloutions are either integer or irrational.
    – Peter Green
    Apr 18 at 9:27










  • Case $a=g$ leads to the integer $x, y.$
    – Yuri Negometyanov
    Apr 22 at 3:36










  • a = g leads to x=y which violates the question requirements of distinct integers.
    – Peter Green
    Apr 23 at 19:18

















up vote
5
down vote













Integer Case



If we start out with
$$
a=fracx+y2,quad g=sqrtxy,quad h=frac2xyx+ytag1
$$
we have that
$$
ah=g^2tag2
$$
Furthermore, note that
$$
a^2-g^2=left(fracx-y2right)^2=d^2tag3
$$
that is,
$$
a^2=g^2+d^2tag4
$$
So this is related to Pythagorean Triples.



Furthermore, if $amid g^2$, then $h=fracg^2a$ is an integer.



Given any Pythagorean Triple, $k^2+m^2=n^2$ with $(n,m)=1$ (this answer shows how to generate all primitive Pythagorean Triples), we need to multiply by $n$ to ensure that $amid g^2$. That is, let
$$
a=n^2,quad d=mn,quad g=kntag5
$$
then
$$
h=k^2,quad x=n(n+m),quad y=n(n-m)tag6
$$
and $(6)$ gives all $x,yinmathbbZ$ where $fracx+y2,sqrtxy,frac2xyx+yinmathbbZ$ and $left(fracx+y2,frac2xyx+yright)=1$.




Examples



The smallest Pythagorean Triple is $(3,4,5)$. This gives two pairs:



$(5(5+3),5(5-3))=(40,10)$ whose (AM, GM, HM) are $(25,20,16)$.



$(5(5+4),5(5-4))=(45,5)$ whose (AM, GM, HM) are $(25,15,9)$.




Real Case



If we let $x,yinmathbbR$, then the important restriction is $(2)$ above. That is, $ah=g^2$. That is, if we have
$$
a=prod_k p_k^e_ktag7
$$
Then if we have $glt a$ so that
$$
left.prod_k p_k^leftlceil e_k/2rightrceil,middle|,gright.tag8
$$
where $lceil xrceil$ is the ceiling function, the least integer not less than $x$.



Then $amid g^2$ and $h=fracg^2a$ is an integer. Note that to have $ane g$, we need some $e_kge2$. For such $a$ and $g$, we have
$$
x=a+sqrta^2-g^2,quad y=a-sqrta^2-g^2tag9
$$




Examples



Extending the example above, let's consider $a=25$. In that case, we are looking for $glt25$ so that $5mid g$. $g=20$ and $g=15$ are given above; however, there are two other cases:



$g=10$: which gives $x=25+5sqrt21$ and $y=25-5sqrt21$ and $h=4$.



$g=5$: which gives $x=25+10sqrt6$ and $y=25-10sqrt6$ and $h=1$.



We can even have non-square $a$. For example, $a=12$. In this case we are looking for $glt12$ so that $6mid g$. That is,



$g=6$: which gives $x=12+6sqrt3$ and $y=12-6sqrt3$ and $h=3$.








share|cite|improve this answer





























    up vote
    0
    down vote













    Let $a+b=2n$ and $ab=m^2$ (so that the arithmetic and geometric means are the arbitray integers $n$ and $m$).



    The harmonic mean is $$dfrac2aba+b=fracm^2n,$$ so, yes, you can certainly obtain three integers.






    share|cite|improve this answer




















    • Please explain the downvote or undo it.
      – Yves Daoust
      Apr 21 at 10:37






    • 1




      I downvoted this post, because I fail to see how this adds anything new to what has already been covered by Hurkyl's answer.
      – Gaurang Tandon
      Apr 22 at 2:56






    • 1




      @GaurangTandon: thanks for the feedback.
      – Yves Daoust
      Apr 22 at 15:35










    • Well, I upvoted :)
      – user477343
      Aug 17 at 3:12










    Your Answer




    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "69"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2739592%2fdo-there-exist-pairs-of-distinct-real-numbers-whose-arithmetic-geometric-and-ha%23new-answer', 'question_page');

    );

    Post as a guest






























    7 Answers
    7






    active

    oldest

    votes








    7 Answers
    7






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    24
    down vote



    accepted
    +200










    Here's how you can work out the answer from scratch, without needing any clever leaps of insight of the form "let's try a solution like this!".



    It does require a few "tricks of the trade", which I will point out as they come up. But those are general-purpose tricks rather than specific insights into this problem. Aside from that, we'll just do the easiest thing available at each step :-).




    When I first answered this, I misinterpreted the question as requiring our numbers to be integers. It seems like an interesting question either way, so here first of all is my original answer, followed by a version that (as the OP intended) doesn't make that assumption.



    When our numbers are required to be integers



    So, suppose our two numbers are $a,b$. Their geometric mean is $sqrtab$; that's an integer, so $ab$ is a square. So [TRICK 1] we must have $a=pq^2$ and $b=pr^2$ for some integers $p,q,r$.



    That takes care of the geometric mean. The arithmetic mean just needs $a,b$ to have the same parity, which is going to be easy. So what about the harmonic mean? That's $frac2aba+b$. It has to be an integer, so let's give it a name, $h$ say. So $2ab=h(a+b)$ or, in terms of the new variables we introduced above, $2p^2q^2r^2=ph(q^2+r^2)$. Let's lose a factor of $p$: $2pq^2r^2=h(q^2+r^2)$. And, remember, this equation is the only thing we need other than making sure $a,b$ are both odd or both even.



    The next thing to notice is that the LHS is a multiple of both $q^2$ and $r^2$. Wouldn't it be nice if that factor of $q^2+r^2$ on the right weren't getting in the way? Aha! [TRICK 2] We can get rid of it, because we can assume that $q$ and $r$ are coprime. Why? Because all we need is $a=pq^2$ and $b=pr^2$, and if $q,r$ have a common factor we can move its square into $p$.



    So, we have $q,r$ coprime. Now $q^2mathrel|2pq^2r^2=h(q^2+r^2)$. Since clearly $q^2mathrel|hq^2$ this yields $q^2mathrel|hr^2$ and now since $q,r$ have no common factor we must have $q^2mathrel|h$. Similarly $r^2mathrel|h$. Even better, since $q,r$ have no common factor these two give us $q^2r^2mathrel|h$.



    Just as with the original HM, we have one thing dividing another so let's name the quotient. Say $h=tq^2r^2$. What happens to the equation we were looking at? It becomes $2pq^2r^2=tq^2r^2(q^2+r^2)$ or, dividing out the junk, $2p=t(q^2+r^2)$.



    But now we're done, because we can just (again, aside from a little bit of caution about parity) take $q,r,t$ to be anything we like and define $p$ by this equation! We will then get $p=t(q^2+r^2)/2$ and then $a=pq^2$ and $b=pr^2$.



    Let's figure out those parity constraints. If $q,r$ have the same parity (i.e., are both odd or both even) then $q^2+r^2$ is even, so $p$ is automatically an integer, and $a,b$ automatically have the same parity, so everything is good. If $q,r$ have opposite parity then we will need $p$ to be not only an integer but an even integer, and since $q^2+r^2$ will be odd this requires $t$ to be a multiple of 4.




    Putting the bits together, the following procedure (1) always yields $a,b$ with AM,GM,HM all integers and (2) produces every possible such $a,b$:




    Choose positive integers $q,r,t$. If $q,r$ are of opposite parity, $t$ must be a multiple of 4; otherwise $t$ is unrestricted. Now write $p=t(q^2+r^2)/2$ and then $a=pq^2$ and $b=pr^2$. (This gives $aneq b$ provided $qneq r$.)





    Let's look at a couple of simple examples, trying to make our numbers small. First, with $q,r$ of the same parity. Let's try $q=1,r=3$. Then $t$ can be anything; let's set it to 1. We get $p=5$ and then $a,b=5,45$. The AM is 25, the GM is 15, and the HM is 9.



    Next, with $p,q$ of opposite parity. Let's try $q=1,r=2$. Then $t$ has to be a multiple of 4; let's make it 4. We get $p=10$ and then $a,b=10,40$. The AM is 25, the GM is 20, and the HM is 16.




    When our numbers are not required to be integers



    As I confessed above, all of that assumes that you specifically want your numbers $a,b$ to be integers. What if you are happy for them to be any real numbers at all? How much extra freedom does that give you? Perhaps less than you might think; let's see. Once again, so far as possible I'm just going to do easy things and see where they lead.



    First of all, their AM is an integer. Call it $n$; so our numbers are $a=n+d$ and $b=n-d$ for some (not necessarily integral) $d$. Now the GM $sqrtab$ is an integer too, so its square $ab$ certainly is, so $(n+d)(n-d)=n^2-d^2$ is an integer. So $d$ is the square root of an integer; let's say it's $sqrtm$. Finally, the HM is $frac2aba+b=fracabn=fracn^2-mn$, so $m$ is an integer multiple of $n$, say $kn$.



    So far, we have figured out that we have $a,b=npmsqrtkn$ for some integers $n,k$. The only thing we haven't used yet is the fact that the GM itself (and not only its square) is an integer; that is, that $n^2-kn=n(n-k)$ is a square; the conditions we've established above are enough to make the AM and HM squares, and the GM the square root of an integer. So, the only further condition is that $n(n-k)$ be a square. Well, by TRICK 1 above this is the same as having $n=pq^2$ and $n-k=pr^2$ for integers $p,q,r$.



    So here's the general solution when $a,b$ don't have to be integers:




    Choose positive integers $p,q,r$ with $r<q$. Write $n=pq^2$ and $k=p(q^2-r^2)$. Set $a,b=npmsqrtkn$.




    Let's once again look at a simple example where the integers involved are small and $a,b$ aren't themselves integers. First, take $p=1,q=2,r=1$. Then $n=4$ and $k=3$ so our numbers are $4pmsqrt12$. The AM is 4; the GM is 2; the HM is 1.






    share|cite|improve this answer


















    • 3




      This is amazing! I am definitely putting a +200 bounty on this question once it gets off the HNQ list! This intuition you derive is amazingly simple and fluid. Also, this is the most generalized of all the answers till now. The result you yield is roughly the same as that of Peter's answer, but he didn't delineate the two cases for the parities of $p$ and $q$, so his results are limited. Thanks again!
      – Gaurang Tandon
      Apr 17 at 12:03







    • 2




      How does Trick 1 follow? Take $a = 2sqrt2$ and $b = sqrt2$ so that $ab = 4$ which is square, but neither numbers are of the form $pq^2$ or $pr^2$ for integers $p,q,r$. [These won't work out because you can derive rationality and integer constraints from AM and HM being integers, but you seem to assume that $a$ and $b$ are integers without any discussion or statement]
      – Zain Patel
      Apr 18 at 3:06







    • 2




      @ZainPatel I think that's the point -- Gareth is assuming that $a$ and $b$ are integers. If you want to go through the analysis for the general case, go ahead!
      – Charles
      Apr 18 at 4:06






    • 2




      The question explicitly states that $a$ and $b$ are real numbers. The answer definitely answers the question, and does so in a great way (+1), however the claim that it generates all solutions is wrong.
      – celtschk
      Apr 18 at 7:01






    • 1




      Nice, it seems to be fixed now :-) @celtschk have a look, I think this is perfect now!
      – Gaurang Tandon
      Apr 21 at 4:49














    up vote
    24
    down vote



    accepted
    +200










    Here's how you can work out the answer from scratch, without needing any clever leaps of insight of the form "let's try a solution like this!".



    It does require a few "tricks of the trade", which I will point out as they come up. But those are general-purpose tricks rather than specific insights into this problem. Aside from that, we'll just do the easiest thing available at each step :-).




    When I first answered this, I misinterpreted the question as requiring our numbers to be integers. It seems like an interesting question either way, so here first of all is my original answer, followed by a version that (as the OP intended) doesn't make that assumption.



    When our numbers are required to be integers



    So, suppose our two numbers are $a,b$. Their geometric mean is $sqrtab$; that's an integer, so $ab$ is a square. So [TRICK 1] we must have $a=pq^2$ and $b=pr^2$ for some integers $p,q,r$.



    That takes care of the geometric mean. The arithmetic mean just needs $a,b$ to have the same parity, which is going to be easy. So what about the harmonic mean? That's $frac2aba+b$. It has to be an integer, so let's give it a name, $h$ say. So $2ab=h(a+b)$ or, in terms of the new variables we introduced above, $2p^2q^2r^2=ph(q^2+r^2)$. Let's lose a factor of $p$: $2pq^2r^2=h(q^2+r^2)$. And, remember, this equation is the only thing we need other than making sure $a,b$ are both odd or both even.



    The next thing to notice is that the LHS is a multiple of both $q^2$ and $r^2$. Wouldn't it be nice if that factor of $q^2+r^2$ on the right weren't getting in the way? Aha! [TRICK 2] We can get rid of it, because we can assume that $q$ and $r$ are coprime. Why? Because all we need is $a=pq^2$ and $b=pr^2$, and if $q,r$ have a common factor we can move its square into $p$.



    So, we have $q,r$ coprime. Now $q^2mathrel|2pq^2r^2=h(q^2+r^2)$. Since clearly $q^2mathrel|hq^2$ this yields $q^2mathrel|hr^2$ and now since $q,r$ have no common factor we must have $q^2mathrel|h$. Similarly $r^2mathrel|h$. Even better, since $q,r$ have no common factor these two give us $q^2r^2mathrel|h$.



    Just as with the original HM, we have one thing dividing another so let's name the quotient. Say $h=tq^2r^2$. What happens to the equation we were looking at? It becomes $2pq^2r^2=tq^2r^2(q^2+r^2)$ or, dividing out the junk, $2p=t(q^2+r^2)$.



    But now we're done, because we can just (again, aside from a little bit of caution about parity) take $q,r,t$ to be anything we like and define $p$ by this equation! We will then get $p=t(q^2+r^2)/2$ and then $a=pq^2$ and $b=pr^2$.



    Let's figure out those parity constraints. If $q,r$ have the same parity (i.e., are both odd or both even) then $q^2+r^2$ is even, so $p$ is automatically an integer, and $a,b$ automatically have the same parity, so everything is good. If $q,r$ have opposite parity then we will need $p$ to be not only an integer but an even integer, and since $q^2+r^2$ will be odd this requires $t$ to be a multiple of 4.




    Putting the bits together, the following procedure (1) always yields $a,b$ with AM,GM,HM all integers and (2) produces every possible such $a,b$:




    Choose positive integers $q,r,t$. If $q,r$ are of opposite parity, $t$ must be a multiple of 4; otherwise $t$ is unrestricted. Now write $p=t(q^2+r^2)/2$ and then $a=pq^2$ and $b=pr^2$. (This gives $aneq b$ provided $qneq r$.)





    Let's look at a couple of simple examples, trying to make our numbers small. First, with $q,r$ of the same parity. Let's try $q=1,r=3$. Then $t$ can be anything; let's set it to 1. We get $p=5$ and then $a,b=5,45$. The AM is 25, the GM is 15, and the HM is 9.



    Next, with $p,q$ of opposite parity. Let's try $q=1,r=2$. Then $t$ has to be a multiple of 4; let's make it 4. We get $p=10$ and then $a,b=10,40$. The AM is 25, the GM is 20, and the HM is 16.




    When our numbers are not required to be integers



    As I confessed above, all of that assumes that you specifically want your numbers $a,b$ to be integers. What if you are happy for them to be any real numbers at all? How much extra freedom does that give you? Perhaps less than you might think; let's see. Once again, so far as possible I'm just going to do easy things and see where they lead.



    First of all, their AM is an integer. Call it $n$; so our numbers are $a=n+d$ and $b=n-d$ for some (not necessarily integral) $d$. Now the GM $sqrtab$ is an integer too, so its square $ab$ certainly is, so $(n+d)(n-d)=n^2-d^2$ is an integer. So $d$ is the square root of an integer; let's say it's $sqrtm$. Finally, the HM is $frac2aba+b=fracabn=fracn^2-mn$, so $m$ is an integer multiple of $n$, say $kn$.



    So far, we have figured out that we have $a,b=npmsqrtkn$ for some integers $n,k$. The only thing we haven't used yet is the fact that the GM itself (and not only its square) is an integer; that is, that $n^2-kn=n(n-k)$ is a square; the conditions we've established above are enough to make the AM and HM squares, and the GM the square root of an integer. So, the only further condition is that $n(n-k)$ be a square. Well, by TRICK 1 above this is the same as having $n=pq^2$ and $n-k=pr^2$ for integers $p,q,r$.



    So here's the general solution when $a,b$ don't have to be integers:




    Choose positive integers $p,q,r$ with $r<q$. Write $n=pq^2$ and $k=p(q^2-r^2)$. Set $a,b=npmsqrtkn$.




    Let's once again look at a simple example where the integers involved are small and $a,b$ aren't themselves integers. First, take $p=1,q=2,r=1$. Then $n=4$ and $k=3$ so our numbers are $4pmsqrt12$. The AM is 4; the GM is 2; the HM is 1.






    share|cite|improve this answer


















    • 3




      This is amazing! I am definitely putting a +200 bounty on this question once it gets off the HNQ list! This intuition you derive is amazingly simple and fluid. Also, this is the most generalized of all the answers till now. The result you yield is roughly the same as that of Peter's answer, but he didn't delineate the two cases for the parities of $p$ and $q$, so his results are limited. Thanks again!
      – Gaurang Tandon
      Apr 17 at 12:03







    • 2




      How does Trick 1 follow? Take $a = 2sqrt2$ and $b = sqrt2$ so that $ab = 4$ which is square, but neither numbers are of the form $pq^2$ or $pr^2$ for integers $p,q,r$. [These won't work out because you can derive rationality and integer constraints from AM and HM being integers, but you seem to assume that $a$ and $b$ are integers without any discussion or statement]
      – Zain Patel
      Apr 18 at 3:06







    • 2




      @ZainPatel I think that's the point -- Gareth is assuming that $a$ and $b$ are integers. If you want to go through the analysis for the general case, go ahead!
      – Charles
      Apr 18 at 4:06






    • 2




      The question explicitly states that $a$ and $b$ are real numbers. The answer definitely answers the question, and does so in a great way (+1), however the claim that it generates all solutions is wrong.
      – celtschk
      Apr 18 at 7:01






    • 1




      Nice, it seems to be fixed now :-) @celtschk have a look, I think this is perfect now!
      – Gaurang Tandon
      Apr 21 at 4:49












    up vote
    24
    down vote



    accepted
    +200







    up vote
    24
    down vote



    accepted
    +200




    +200




    Here's how you can work out the answer from scratch, without needing any clever leaps of insight of the form "let's try a solution like this!".



    It does require a few "tricks of the trade", which I will point out as they come up. But those are general-purpose tricks rather than specific insights into this problem. Aside from that, we'll just do the easiest thing available at each step :-).




    When I first answered this, I misinterpreted the question as requiring our numbers to be integers. It seems like an interesting question either way, so here first of all is my original answer, followed by a version that (as the OP intended) doesn't make that assumption.



    When our numbers are required to be integers



    So, suppose our two numbers are $a,b$. Their geometric mean is $sqrtab$; that's an integer, so $ab$ is a square. So [TRICK 1] we must have $a=pq^2$ and $b=pr^2$ for some integers $p,q,r$.



    That takes care of the geometric mean. The arithmetic mean just needs $a,b$ to have the same parity, which is going to be easy. So what about the harmonic mean? That's $frac2aba+b$. It has to be an integer, so let's give it a name, $h$ say. So $2ab=h(a+b)$ or, in terms of the new variables we introduced above, $2p^2q^2r^2=ph(q^2+r^2)$. Let's lose a factor of $p$: $2pq^2r^2=h(q^2+r^2)$. And, remember, this equation is the only thing we need other than making sure $a,b$ are both odd or both even.



    The next thing to notice is that the LHS is a multiple of both $q^2$ and $r^2$. Wouldn't it be nice if that factor of $q^2+r^2$ on the right weren't getting in the way? Aha! [TRICK 2] We can get rid of it, because we can assume that $q$ and $r$ are coprime. Why? Because all we need is $a=pq^2$ and $b=pr^2$, and if $q,r$ have a common factor we can move its square into $p$.



    So, we have $q,r$ coprime. Now $q^2mathrel|2pq^2r^2=h(q^2+r^2)$. Since clearly $q^2mathrel|hq^2$ this yields $q^2mathrel|hr^2$ and now since $q,r$ have no common factor we must have $q^2mathrel|h$. Similarly $r^2mathrel|h$. Even better, since $q,r$ have no common factor these two give us $q^2r^2mathrel|h$.



    Just as with the original HM, we have one thing dividing another so let's name the quotient. Say $h=tq^2r^2$. What happens to the equation we were looking at? It becomes $2pq^2r^2=tq^2r^2(q^2+r^2)$ or, dividing out the junk, $2p=t(q^2+r^2)$.



    But now we're done, because we can just (again, aside from a little bit of caution about parity) take $q,r,t$ to be anything we like and define $p$ by this equation! We will then get $p=t(q^2+r^2)/2$ and then $a=pq^2$ and $b=pr^2$.



    Let's figure out those parity constraints. If $q,r$ have the same parity (i.e., are both odd or both even) then $q^2+r^2$ is even, so $p$ is automatically an integer, and $a,b$ automatically have the same parity, so everything is good. If $q,r$ have opposite parity then we will need $p$ to be not only an integer but an even integer, and since $q^2+r^2$ will be odd this requires $t$ to be a multiple of 4.




    Putting the bits together, the following procedure (1) always yields $a,b$ with AM,GM,HM all integers and (2) produces every possible such $a,b$:




    Choose positive integers $q,r,t$. If $q,r$ are of opposite parity, $t$ must be a multiple of 4; otherwise $t$ is unrestricted. Now write $p=t(q^2+r^2)/2$ and then $a=pq^2$ and $b=pr^2$. (This gives $aneq b$ provided $qneq r$.)





    Let's look at a couple of simple examples, trying to make our numbers small. First, with $q,r$ of the same parity. Let's try $q=1,r=3$. Then $t$ can be anything; let's set it to 1. We get $p=5$ and then $a,b=5,45$. The AM is 25, the GM is 15, and the HM is 9.



    Next, with $p,q$ of opposite parity. Let's try $q=1,r=2$. Then $t$ has to be a multiple of 4; let's make it 4. We get $p=10$ and then $a,b=10,40$. The AM is 25, the GM is 20, and the HM is 16.




    When our numbers are not required to be integers



    As I confessed above, all of that assumes that you specifically want your numbers $a,b$ to be integers. What if you are happy for them to be any real numbers at all? How much extra freedom does that give you? Perhaps less than you might think; let's see. Once again, so far as possible I'm just going to do easy things and see where they lead.



    First of all, their AM is an integer. Call it $n$; so our numbers are $a=n+d$ and $b=n-d$ for some (not necessarily integral) $d$. Now the GM $sqrtab$ is an integer too, so its square $ab$ certainly is, so $(n+d)(n-d)=n^2-d^2$ is an integer. So $d$ is the square root of an integer; let's say it's $sqrtm$. Finally, the HM is $frac2aba+b=fracabn=fracn^2-mn$, so $m$ is an integer multiple of $n$, say $kn$.



    So far, we have figured out that we have $a,b=npmsqrtkn$ for some integers $n,k$. The only thing we haven't used yet is the fact that the GM itself (and not only its square) is an integer; that is, that $n^2-kn=n(n-k)$ is a square; the conditions we've established above are enough to make the AM and HM squares, and the GM the square root of an integer. So, the only further condition is that $n(n-k)$ be a square. Well, by TRICK 1 above this is the same as having $n=pq^2$ and $n-k=pr^2$ for integers $p,q,r$.



    So here's the general solution when $a,b$ don't have to be integers:




    Choose positive integers $p,q,r$ with $r<q$. Write $n=pq^2$ and $k=p(q^2-r^2)$. Set $a,b=npmsqrtkn$.




    Let's once again look at a simple example where the integers involved are small and $a,b$ aren't themselves integers. First, take $p=1,q=2,r=1$. Then $n=4$ and $k=3$ so our numbers are $4pmsqrt12$. The AM is 4; the GM is 2; the HM is 1.






    share|cite|improve this answer














    Here's how you can work out the answer from scratch, without needing any clever leaps of insight of the form "let's try a solution like this!".



    It does require a few "tricks of the trade", which I will point out as they come up. But those are general-purpose tricks rather than specific insights into this problem. Aside from that, we'll just do the easiest thing available at each step :-).




    When I first answered this, I misinterpreted the question as requiring our numbers to be integers. It seems like an interesting question either way, so here first of all is my original answer, followed by a version that (as the OP intended) doesn't make that assumption.



    When our numbers are required to be integers



    So, suppose our two numbers are $a,b$. Their geometric mean is $sqrtab$; that's an integer, so $ab$ is a square. So [TRICK 1] we must have $a=pq^2$ and $b=pr^2$ for some integers $p,q,r$.



    That takes care of the geometric mean. The arithmetic mean just needs $a,b$ to have the same parity, which is going to be easy. So what about the harmonic mean? That's $frac2aba+b$. It has to be an integer, so let's give it a name, $h$ say. So $2ab=h(a+b)$ or, in terms of the new variables we introduced above, $2p^2q^2r^2=ph(q^2+r^2)$. Let's lose a factor of $p$: $2pq^2r^2=h(q^2+r^2)$. And, remember, this equation is the only thing we need other than making sure $a,b$ are both odd or both even.



    The next thing to notice is that the LHS is a multiple of both $q^2$ and $r^2$. Wouldn't it be nice if that factor of $q^2+r^2$ on the right weren't getting in the way? Aha! [TRICK 2] We can get rid of it, because we can assume that $q$ and $r$ are coprime. Why? Because all we need is $a=pq^2$ and $b=pr^2$, and if $q,r$ have a common factor we can move its square into $p$.



    So, we have $q,r$ coprime. Now $q^2mathrel|2pq^2r^2=h(q^2+r^2)$. Since clearly $q^2mathrel|hq^2$ this yields $q^2mathrel|hr^2$ and now since $q,r$ have no common factor we must have $q^2mathrel|h$. Similarly $r^2mathrel|h$. Even better, since $q,r$ have no common factor these two give us $q^2r^2mathrel|h$.



    Just as with the original HM, we have one thing dividing another so let's name the quotient. Say $h=tq^2r^2$. What happens to the equation we were looking at? It becomes $2pq^2r^2=tq^2r^2(q^2+r^2)$ or, dividing out the junk, $2p=t(q^2+r^2)$.



    But now we're done, because we can just (again, aside from a little bit of caution about parity) take $q,r,t$ to be anything we like and define $p$ by this equation! We will then get $p=t(q^2+r^2)/2$ and then $a=pq^2$ and $b=pr^2$.



    Let's figure out those parity constraints. If $q,r$ have the same parity (i.e., are both odd or both even) then $q^2+r^2$ is even, so $p$ is automatically an integer, and $a,b$ automatically have the same parity, so everything is good. If $q,r$ have opposite parity then we will need $p$ to be not only an integer but an even integer, and since $q^2+r^2$ will be odd this requires $t$ to be a multiple of 4.




    Putting the bits together, the following procedure (1) always yields $a,b$ with AM,GM,HM all integers and (2) produces every possible such $a,b$:




    Choose positive integers $q,r,t$. If $q,r$ are of opposite parity, $t$ must be a multiple of 4; otherwise $t$ is unrestricted. Now write $p=t(q^2+r^2)/2$ and then $a=pq^2$ and $b=pr^2$. (This gives $aneq b$ provided $qneq r$.)





    Let's look at a couple of simple examples, trying to make our numbers small. First, with $q,r$ of the same parity. Let's try $q=1,r=3$. Then $t$ can be anything; let's set it to 1. We get $p=5$ and then $a,b=5,45$. The AM is 25, the GM is 15, and the HM is 9.



    Next, with $p,q$ of opposite parity. Let's try $q=1,r=2$. Then $t$ has to be a multiple of 4; let's make it 4. We get $p=10$ and then $a,b=10,40$. The AM is 25, the GM is 20, and the HM is 16.




    When our numbers are not required to be integers



    As I confessed above, all of that assumes that you specifically want your numbers $a,b$ to be integers. What if you are happy for them to be any real numbers at all? How much extra freedom does that give you? Perhaps less than you might think; let's see. Once again, so far as possible I'm just going to do easy things and see where they lead.



    First of all, their AM is an integer. Call it $n$; so our numbers are $a=n+d$ and $b=n-d$ for some (not necessarily integral) $d$. Now the GM $sqrtab$ is an integer too, so its square $ab$ certainly is, so $(n+d)(n-d)=n^2-d^2$ is an integer. So $d$ is the square root of an integer; let's say it's $sqrtm$. Finally, the HM is $frac2aba+b=fracabn=fracn^2-mn$, so $m$ is an integer multiple of $n$, say $kn$.



    So far, we have figured out that we have $a,b=npmsqrtkn$ for some integers $n,k$. The only thing we haven't used yet is the fact that the GM itself (and not only its square) is an integer; that is, that $n^2-kn=n(n-k)$ is a square; the conditions we've established above are enough to make the AM and HM squares, and the GM the square root of an integer. So, the only further condition is that $n(n-k)$ be a square. Well, by TRICK 1 above this is the same as having $n=pq^2$ and $n-k=pr^2$ for integers $p,q,r$.



    So here's the general solution when $a,b$ don't have to be integers:




    Choose positive integers $p,q,r$ with $r<q$. Write $n=pq^2$ and $k=p(q^2-r^2)$. Set $a,b=npmsqrtkn$.




    Let's once again look at a simple example where the integers involved are small and $a,b$ aren't themselves integers. First, take $p=1,q=2,r=1$. Then $n=4$ and $k=3$ so our numbers are $4pmsqrt12$. The AM is 4; the GM is 2; the HM is 1.







    share|cite|improve this answer














    share|cite|improve this answer



    share|cite|improve this answer








    edited Apr 22 at 14:36

























    answered Apr 17 at 11:19









    Gareth McCaughan

    3,2441013




    3,2441013







    • 3




      This is amazing! I am definitely putting a +200 bounty on this question once it gets off the HNQ list! This intuition you derive is amazingly simple and fluid. Also, this is the most generalized of all the answers till now. The result you yield is roughly the same as that of Peter's answer, but he didn't delineate the two cases for the parities of $p$ and $q$, so his results are limited. Thanks again!
      – Gaurang Tandon
      Apr 17 at 12:03







    • 2




      How does Trick 1 follow? Take $a = 2sqrt2$ and $b = sqrt2$ so that $ab = 4$ which is square, but neither numbers are of the form $pq^2$ or $pr^2$ for integers $p,q,r$. [These won't work out because you can derive rationality and integer constraints from AM and HM being integers, but you seem to assume that $a$ and $b$ are integers without any discussion or statement]
      – Zain Patel
      Apr 18 at 3:06







    • 2




      @ZainPatel I think that's the point -- Gareth is assuming that $a$ and $b$ are integers. If you want to go through the analysis for the general case, go ahead!
      – Charles
      Apr 18 at 4:06






    • 2




      The question explicitly states that $a$ and $b$ are real numbers. The answer definitely answers the question, and does so in a great way (+1), however the claim that it generates all solutions is wrong.
      – celtschk
      Apr 18 at 7:01






    • 1




      Nice, it seems to be fixed now :-) @celtschk have a look, I think this is perfect now!
      – Gaurang Tandon
      Apr 21 at 4:49












    • 3




      This is amazing! I am definitely putting a +200 bounty on this question once it gets off the HNQ list! This intuition you derive is amazingly simple and fluid. Also, this is the most generalized of all the answers till now. The result you yield is roughly the same as that of Peter's answer, but he didn't delineate the two cases for the parities of $p$ and $q$, so his results are limited. Thanks again!
      – Gaurang Tandon
      Apr 17 at 12:03







    • 2




      How does Trick 1 follow? Take $a = 2sqrt2$ and $b = sqrt2$ so that $ab = 4$ which is square, but neither numbers are of the form $pq^2$ or $pr^2$ for integers $p,q,r$. [These won't work out because you can derive rationality and integer constraints from AM and HM being integers, but you seem to assume that $a$ and $b$ are integers without any discussion or statement]
      – Zain Patel
      Apr 18 at 3:06







    • 2




      @ZainPatel I think that's the point -- Gareth is assuming that $a$ and $b$ are integers. If you want to go through the analysis for the general case, go ahead!
      – Charles
      Apr 18 at 4:06






    • 2




      The question explicitly states that $a$ and $b$ are real numbers. The answer definitely answers the question, and does so in a great way (+1), however the claim that it generates all solutions is wrong.
      – celtschk
      Apr 18 at 7:01






    • 1




      Nice, it seems to be fixed now :-) @celtschk have a look, I think this is perfect now!
      – Gaurang Tandon
      Apr 21 at 4:49







    3




    3




    This is amazing! I am definitely putting a +200 bounty on this question once it gets off the HNQ list! This intuition you derive is amazingly simple and fluid. Also, this is the most generalized of all the answers till now. The result you yield is roughly the same as that of Peter's answer, but he didn't delineate the two cases for the parities of $p$ and $q$, so his results are limited. Thanks again!
    – Gaurang Tandon
    Apr 17 at 12:03





    This is amazing! I am definitely putting a +200 bounty on this question once it gets off the HNQ list! This intuition you derive is amazingly simple and fluid. Also, this is the most generalized of all the answers till now. The result you yield is roughly the same as that of Peter's answer, but he didn't delineate the two cases for the parities of $p$ and $q$, so his results are limited. Thanks again!
    – Gaurang Tandon
    Apr 17 at 12:03





    2




    2




    How does Trick 1 follow? Take $a = 2sqrt2$ and $b = sqrt2$ so that $ab = 4$ which is square, but neither numbers are of the form $pq^2$ or $pr^2$ for integers $p,q,r$. [These won't work out because you can derive rationality and integer constraints from AM and HM being integers, but you seem to assume that $a$ and $b$ are integers without any discussion or statement]
    – Zain Patel
    Apr 18 at 3:06





    How does Trick 1 follow? Take $a = 2sqrt2$ and $b = sqrt2$ so that $ab = 4$ which is square, but neither numbers are of the form $pq^2$ or $pr^2$ for integers $p,q,r$. [These won't work out because you can derive rationality and integer constraints from AM and HM being integers, but you seem to assume that $a$ and $b$ are integers without any discussion or statement]
    – Zain Patel
    Apr 18 at 3:06





    2




    2




    @ZainPatel I think that's the point -- Gareth is assuming that $a$ and $b$ are integers. If you want to go through the analysis for the general case, go ahead!
    – Charles
    Apr 18 at 4:06




    @ZainPatel I think that's the point -- Gareth is assuming that $a$ and $b$ are integers. If you want to go through the analysis for the general case, go ahead!
    – Charles
    Apr 18 at 4:06




    2




    2




    The question explicitly states that $a$ and $b$ are real numbers. The answer definitely answers the question, and does so in a great way (+1), however the claim that it generates all solutions is wrong.
    – celtschk
    Apr 18 at 7:01




    The question explicitly states that $a$ and $b$ are real numbers. The answer definitely answers the question, and does so in a great way (+1), however the claim that it generates all solutions is wrong.
    – celtschk
    Apr 18 at 7:01




    1




    1




    Nice, it seems to be fixed now :-) @celtschk have a look, I think this is perfect now!
    – Gaurang Tandon
    Apr 21 at 4:49




    Nice, it seems to be fixed now :-) @celtschk have a look, I think this is perfect now!
    – Gaurang Tandon
    Apr 21 at 4:49










    up vote
    86
    down vote













    Expanding on Christian Blatter's answer.



    There are a few key points.



    • The arithmetic mean of two rational numbers is always rational.

    • The harmonic mean of two non-zero rational numbers is always rational.

    • The geometric mean of two squared positive integers is always an integer.

    • For all three types of mean if we multiply every input by a positive real value we also multiply the result by that same value.

    These key points lead to a strategy for finding numbers whose am, gm and hm are all integers.



    • pick a pair of integers whose GM is an integer.

    • calculate the AM and HM

    • multiply through by the denominators of the AM and HM.

    Now to work this through, pick any two distinct positive integers $x$ and $y$.



    $$mathrmGM(x^2,y^2) = xy$$
    $$mathrmAM(x^2,y^2) = fracx^2+y^22$$
    $$mathrmHM(x^2,y^2) = frac2x^2y^2x^2+y^2$$



    Let $t = 2(x^2 + y^2)$ Let $a=tx^2$ Let $b=ty^2$. Since only addition, multiplication and squaring of positive integers is involved it is clear that $t$, $a$ and $b$ are all positive integers. It is also clear that a and b are distinct.



    $$mathrmGM(a,b) = txy$$
    $$mathrmAM(a,b) = tfracx^2+y^22 = (x^2+y^2)^2$$
    $$mathrmHM(a,b) = tfrac2x^2y^2x^2+y^2 = 4x^2y^2$$



    Again since all these values can be calculated merely by adding, multiplying and squaring positive integers they are all positive integers.



    Lets plug in some numbers, for example $x=1$ and $y=2$



    $$t = 10$$
    $$a = 10$$
    $$b = 40$$
    $$mathrmGM(10,40) = 20$$
    $$mathrmAM(10,40) = 25$$
    $$mathrmHM(10,40) = 16$$




    Indeed we can extend this techiquie to find an arbitary size list of integers the AM, GM, and HM of any subset of which are integers. Just start with integers of the form $x^n!$ so the GMs are all integers. Then work out the AMs and HMs and multiply through.






    share|cite|improve this answer


















    • 3




      Bravo, +1, but the answer would be even better if you make the expressions for $a$ and for $b$ in terms of only $x$ and $y$ and highlight them, and also make the formula for $mathrmGM(a,b)$ in terms of only $x$ and $y$.
      – Rory Daulton
      Apr 17 at 0:04















    up vote
    86
    down vote













    Expanding on Christian Blatter's answer.



    There are a few key points.



    • The arithmetic mean of two rational numbers is always rational.

    • The harmonic mean of two non-zero rational numbers is always rational.

    • The geometric mean of two squared positive integers is always an integer.

    • For all three types of mean if we multiply every input by a positive real value we also multiply the result by that same value.

    These key points lead to a strategy for finding numbers whose am, gm and hm are all integers.



    • pick a pair of integers whose GM is an integer.

    • calculate the AM and HM

    • multiply through by the denominators of the AM and HM.

    Now to work this through, pick any two distinct positive integers $x$ and $y$.



    $$mathrmGM(x^2,y^2) = xy$$
    $$mathrmAM(x^2,y^2) = fracx^2+y^22$$
    $$mathrmHM(x^2,y^2) = frac2x^2y^2x^2+y^2$$



    Let $t = 2(x^2 + y^2)$ Let $a=tx^2$ Let $b=ty^2$. Since only addition, multiplication and squaring of positive integers is involved it is clear that $t$, $a$ and $b$ are all positive integers. It is also clear that a and b are distinct.



    $$mathrmGM(a,b) = txy$$
    $$mathrmAM(a,b) = tfracx^2+y^22 = (x^2+y^2)^2$$
    $$mathrmHM(a,b) = tfrac2x^2y^2x^2+y^2 = 4x^2y^2$$



    Again since all these values can be calculated merely by adding, multiplying and squaring positive integers they are all positive integers.



    Lets plug in some numbers, for example $x=1$ and $y=2$



    $$t = 10$$
    $$a = 10$$
    $$b = 40$$
    $$mathrmGM(10,40) = 20$$
    $$mathrmAM(10,40) = 25$$
    $$mathrmHM(10,40) = 16$$




    Indeed we can extend this techiquie to find an arbitary size list of integers the AM, GM, and HM of any subset of which are integers. Just start with integers of the form $x^n!$ so the GMs are all integers. Then work out the AMs and HMs and multiply through.






    share|cite|improve this answer


















    • 3




      Bravo, +1, but the answer would be even better if you make the expressions for $a$ and for $b$ in terms of only $x$ and $y$ and highlight them, and also make the formula for $mathrmGM(a,b)$ in terms of only $x$ and $y$.
      – Rory Daulton
      Apr 17 at 0:04













    up vote
    86
    down vote










    up vote
    86
    down vote









    Expanding on Christian Blatter's answer.



    There are a few key points.



    • The arithmetic mean of two rational numbers is always rational.

    • The harmonic mean of two non-zero rational numbers is always rational.

    • The geometric mean of two squared positive integers is always an integer.

    • For all three types of mean if we multiply every input by a positive real value we also multiply the result by that same value.

    These key points lead to a strategy for finding numbers whose am, gm and hm are all integers.



    • pick a pair of integers whose GM is an integer.

    • calculate the AM and HM

    • multiply through by the denominators of the AM and HM.

    Now to work this through, pick any two distinct positive integers $x$ and $y$.



    $$mathrmGM(x^2,y^2) = xy$$
    $$mathrmAM(x^2,y^2) = fracx^2+y^22$$
    $$mathrmHM(x^2,y^2) = frac2x^2y^2x^2+y^2$$



    Let $t = 2(x^2 + y^2)$ Let $a=tx^2$ Let $b=ty^2$. Since only addition, multiplication and squaring of positive integers is involved it is clear that $t$, $a$ and $b$ are all positive integers. It is also clear that a and b are distinct.



    $$mathrmGM(a,b) = txy$$
    $$mathrmAM(a,b) = tfracx^2+y^22 = (x^2+y^2)^2$$
    $$mathrmHM(a,b) = tfrac2x^2y^2x^2+y^2 = 4x^2y^2$$



    Again since all these values can be calculated merely by adding, multiplying and squaring positive integers they are all positive integers.



    Lets plug in some numbers, for example $x=1$ and $y=2$



    $$t = 10$$
    $$a = 10$$
    $$b = 40$$
    $$mathrmGM(10,40) = 20$$
    $$mathrmAM(10,40) = 25$$
    $$mathrmHM(10,40) = 16$$




    Indeed we can extend this techiquie to find an arbitary size list of integers the AM, GM, and HM of any subset of which are integers. Just start with integers of the form $x^n!$ so the GMs are all integers. Then work out the AMs and HMs and multiply through.






    share|cite|improve this answer














    Expanding on Christian Blatter's answer.



    There are a few key points.



    • The arithmetic mean of two rational numbers is always rational.

    • The harmonic mean of two non-zero rational numbers is always rational.

    • The geometric mean of two squared positive integers is always an integer.

    • For all three types of mean if we multiply every input by a positive real value we also multiply the result by that same value.

    These key points lead to a strategy for finding numbers whose am, gm and hm are all integers.



    • pick a pair of integers whose GM is an integer.

    • calculate the AM and HM

    • multiply through by the denominators of the AM and HM.

    Now to work this through, pick any two distinct positive integers $x$ and $y$.



    $$mathrmGM(x^2,y^2) = xy$$
    $$mathrmAM(x^2,y^2) = fracx^2+y^22$$
    $$mathrmHM(x^2,y^2) = frac2x^2y^2x^2+y^2$$



    Let $t = 2(x^2 + y^2)$ Let $a=tx^2$ Let $b=ty^2$. Since only addition, multiplication and squaring of positive integers is involved it is clear that $t$, $a$ and $b$ are all positive integers. It is also clear that a and b are distinct.



    $$mathrmGM(a,b) = txy$$
    $$mathrmAM(a,b) = tfracx^2+y^22 = (x^2+y^2)^2$$
    $$mathrmHM(a,b) = tfrac2x^2y^2x^2+y^2 = 4x^2y^2$$



    Again since all these values can be calculated merely by adding, multiplying and squaring positive integers they are all positive integers.



    Lets plug in some numbers, for example $x=1$ and $y=2$



    $$t = 10$$
    $$a = 10$$
    $$b = 40$$
    $$mathrmGM(10,40) = 20$$
    $$mathrmAM(10,40) = 25$$
    $$mathrmHM(10,40) = 16$$




    Indeed we can extend this techiquie to find an arbitary size list of integers the AM, GM, and HM of any subset of which are integers. Just start with integers of the form $x^n!$ so the GMs are all integers. Then work out the AMs and HMs and multiply through.







    share|cite|improve this answer














    share|cite|improve this answer



    share|cite|improve this answer








    edited Apr 26 at 23:42

























    answered Apr 16 at 16:52









    Peter Green

    1,1371410




    1,1371410







    • 3




      Bravo, +1, but the answer would be even better if you make the expressions for $a$ and for $b$ in terms of only $x$ and $y$ and highlight them, and also make the formula for $mathrmGM(a,b)$ in terms of only $x$ and $y$.
      – Rory Daulton
      Apr 17 at 0:04













    • 3




      Bravo, +1, but the answer would be even better if you make the expressions for $a$ and for $b$ in terms of only $x$ and $y$ and highlight them, and also make the formula for $mathrmGM(a,b)$ in terms of only $x$ and $y$.
      – Rory Daulton
      Apr 17 at 0:04








    3




    3




    Bravo, +1, but the answer would be even better if you make the expressions for $a$ and for $b$ in terms of only $x$ and $y$ and highlight them, and also make the formula for $mathrmGM(a,b)$ in terms of only $x$ and $y$.
    – Rory Daulton
    Apr 17 at 0:04





    Bravo, +1, but the answer would be even better if you make the expressions for $a$ and for $b$ in terms of only $x$ and $y$ and highlight them, and also make the formula for $mathrmGM(a,b)$ in terms of only $x$ and $y$.
    – Rory Daulton
    Apr 17 at 0:04











    up vote
    40
    down vote













    Take $1$ and any square $>1$. Multiply both of them with the smallest common denominator of their AM and HM.






    share|cite|improve this answer


















    • 13




      I worked it out for curiosity: The smallest example this yields is $(10, 40)$, with AM $25$, GM $20$, and HM $16$.
      – Rahul
      Apr 16 at 11:02















    up vote
    40
    down vote













    Take $1$ and any square $>1$. Multiply both of them with the smallest common denominator of their AM and HM.






    share|cite|improve this answer


















    • 13




      I worked it out for curiosity: The smallest example this yields is $(10, 40)$, with AM $25$, GM $20$, and HM $16$.
      – Rahul
      Apr 16 at 11:02













    up vote
    40
    down vote










    up vote
    40
    down vote









    Take $1$ and any square $>1$. Multiply both of them with the smallest common denominator of their AM and HM.






    share|cite|improve this answer














    Take $1$ and any square $>1$. Multiply both of them with the smallest common denominator of their AM and HM.







    share|cite|improve this answer














    share|cite|improve this answer



    share|cite|improve this answer








    edited Apr 16 at 12:15

























    answered Apr 16 at 10:51









    Christian Blatter

    165k7109309




    165k7109309







    • 13




      I worked it out for curiosity: The smallest example this yields is $(10, 40)$, with AM $25$, GM $20$, and HM $16$.
      – Rahul
      Apr 16 at 11:02













    • 13




      I worked it out for curiosity: The smallest example this yields is $(10, 40)$, with AM $25$, GM $20$, and HM $16$.
      – Rahul
      Apr 16 at 11:02








    13




    13




    I worked it out for curiosity: The smallest example this yields is $(10, 40)$, with AM $25$, GM $20$, and HM $16$.
    – Rahul
    Apr 16 at 11:02





    I worked it out for curiosity: The smallest example this yields is $(10, 40)$, with AM $25$, GM $20$, and HM $16$.
    – Rahul
    Apr 16 at 11:02











    up vote
    28
    down vote













    For any $$
    (a, b) = (km^2(m^2 + n^2), kn^2(m^2 + n^2)),
    $$
    where $k, m, n in mathbbN_+$ and $2 mid a - b$, there is$$
    fraca + b2 in mathbbZ, quad sqrtab = kmn(m^2 + n^2) in mathbbZ, quad frac2aba + b = 2km^2 n^2 in mathbbZ.
    $$






    share|cite|improve this answer
















    • 11




      For the lazy, the smallest nontrivial pair is (40,10).
      – svavil
      Apr 16 at 16:41






    • 3




      However, $(45,5)$ gives the smallest (AM,GM,HM) of $(25,15,9)$.
      – robjohn♦
      Apr 25 at 5:25














    up vote
    28
    down vote













    For any $$
    (a, b) = (km^2(m^2 + n^2), kn^2(m^2 + n^2)),
    $$
    where $k, m, n in mathbbN_+$ and $2 mid a - b$, there is$$
    fraca + b2 in mathbbZ, quad sqrtab = kmn(m^2 + n^2) in mathbbZ, quad frac2aba + b = 2km^2 n^2 in mathbbZ.
    $$






    share|cite|improve this answer
















    • 11




      For the lazy, the smallest nontrivial pair is (40,10).
      – svavil
      Apr 16 at 16:41






    • 3




      However, $(45,5)$ gives the smallest (AM,GM,HM) of $(25,15,9)$.
      – robjohn♦
      Apr 25 at 5:25












    up vote
    28
    down vote










    up vote
    28
    down vote









    For any $$
    (a, b) = (km^2(m^2 + n^2), kn^2(m^2 + n^2)),
    $$
    where $k, m, n in mathbbN_+$ and $2 mid a - b$, there is$$
    fraca + b2 in mathbbZ, quad sqrtab = kmn(m^2 + n^2) in mathbbZ, quad frac2aba + b = 2km^2 n^2 in mathbbZ.
    $$






    share|cite|improve this answer












    For any $$
    (a, b) = (km^2(m^2 + n^2), kn^2(m^2 + n^2)),
    $$
    where $k, m, n in mathbbN_+$ and $2 mid a - b$, there is$$
    fraca + b2 in mathbbZ, quad sqrtab = kmn(m^2 + n^2) in mathbbZ, quad frac2aba + b = 2km^2 n^2 in mathbbZ.
    $$







    share|cite|improve this answer












    share|cite|improve this answer



    share|cite|improve this answer










    answered Apr 16 at 10:51









    Alex Francisco

    15.7k92047




    15.7k92047







    • 11




      For the lazy, the smallest nontrivial pair is (40,10).
      – svavil
      Apr 16 at 16:41






    • 3




      However, $(45,5)$ gives the smallest (AM,GM,HM) of $(25,15,9)$.
      – robjohn♦
      Apr 25 at 5:25












    • 11




      For the lazy, the smallest nontrivial pair is (40,10).
      – svavil
      Apr 16 at 16:41






    • 3




      However, $(45,5)$ gives the smallest (AM,GM,HM) of $(25,15,9)$.
      – robjohn♦
      Apr 25 at 5:25







    11




    11




    For the lazy, the smallest nontrivial pair is (40,10).
    – svavil
    Apr 16 at 16:41




    For the lazy, the smallest nontrivial pair is (40,10).
    – svavil
    Apr 16 at 16:41




    3




    3




    However, $(45,5)$ gives the smallest (AM,GM,HM) of $(25,15,9)$.
    – robjohn♦
    Apr 25 at 5:25




    However, $(45,5)$ gives the smallest (AM,GM,HM) of $(25,15,9)$.
    – robjohn♦
    Apr 25 at 5:25










    up vote
    17
    down vote













    Commonly, an easy way to solve problems like these is to turn it around:




    Pick three integers. Are there real numbers such that GM, AM, and HM are those three integers?




    and you simply solve for the two real numbers.



    This probably doesn't work here, because you have three equations in two unknowns. But you could pick two of the integers to be, for example, the GM and AM. From there you can solve for the numbers and then compute the HM, and the question is how to make the HM an integer too.



    Working through the definitions and assuming $mathrmAM(x,y) neq 0$ you can ultimately determine



    $$ x,y = mathrmAM(x,y) pm sqrtmathrmAM(x,y)^2 - mathrmGM(x,y)^2 $$
    $$ mathrmHM(x,y) = fracmathrmGM(x,y)^2mathrmAM(x,y) $$



    It's now easy to determine all solutions to the original problem. They are obtained by selecting integers $g$ and $a$ satisfying:



    • $|a| > |g|$

    • $a$ divides $g^2$

    • $a neq 0$

    and then you can set



    • $x,y = a pm sqrta^2 - g^2$

    • $mathrmAM(x,y) = a$

    • $mathrmGM(x,y) = g$

    • $mathrmHM(x,y) = fracg^2a$

    To further solve the problem of asking for $x,y$ to be integers, you need to arrange to have $a^2 - g^2$ be a perfect square. This is a bit more complicated, and related to pythagorean triples.




    To work out the integer case, we need to better understand solutions to the $a mid g^2$ condition.



    I will boldly assert that, by chasing through the divisibility conditions and using the fact $a neq 0$, the general case comes from:



    • Select integers $u,v,w$ such that $gcd(v,w) = 1$, $v > 0$, and $u neq 0$

    • Set $a = uv^2$

    • Set $g = uvw$

    The radicand $a^2 - g^2$ we need to be a perfect square then simplifies:



    $$ a^2 - g^2 = u^2 v^2 (v^2 - w^2) $$



    This has a square root if and only if $|v|$ and $|w|$ are two components of a primitive pythagorean triple, with $|v|$ the hypotenuse.



    The $|a| > |g|$ condition simplifies to requiring $|v| neq |w|$. Given the other constraints, this simplifies to $v > 1$.






    share|cite|improve this answer


















    • 5




      I think that is the best answer, as it is the only answer that systematically derives a complete solution, and moreover it explains it nicely. Moreover it is based on a general principle that can be used to solve other problems, so its usefulness goes beyond answering the specific question.
      – celtschk
      Apr 18 at 7:08







    • 2




      Great answer. This also shows that all soloutions are either integer or irrational.
      – Peter Green
      Apr 18 at 9:27










    • Case $a=g$ leads to the integer $x, y.$
      – Yuri Negometyanov
      Apr 22 at 3:36










    • a = g leads to x=y which violates the question requirements of distinct integers.
      – Peter Green
      Apr 23 at 19:18














    up vote
    17
    down vote













    Commonly, an easy way to solve problems like these is to turn it around:




    Pick three integers. Are there real numbers such that GM, AM, and HM are those three integers?




    and you simply solve for the two real numbers.



    This probably doesn't work here, because you have three equations in two unknowns. But you could pick two of the integers to be, for example, the GM and AM. From there you can solve for the numbers and then compute the HM, and the question is how to make the HM an integer too.



    Working through the definitions and assuming $mathrmAM(x,y) neq 0$ you can ultimately determine



    $$ x,y = mathrmAM(x,y) pm sqrtmathrmAM(x,y)^2 - mathrmGM(x,y)^2 $$
    $$ mathrmHM(x,y) = fracmathrmGM(x,y)^2mathrmAM(x,y) $$



    It's now easy to determine all solutions to the original problem. They are obtained by selecting integers $g$ and $a$ satisfying:



    • $|a| > |g|$

    • $a$ divides $g^2$

    • $a neq 0$

    and then you can set



    • $x,y = a pm sqrta^2 - g^2$

    • $mathrmAM(x,y) = a$

    • $mathrmGM(x,y) = g$

    • $mathrmHM(x,y) = fracg^2a$

    To further solve the problem of asking for $x,y$ to be integers, you need to arrange to have $a^2 - g^2$ be a perfect square. This is a bit more complicated, and related to pythagorean triples.




    To work out the integer case, we need to better understand solutions to the $a mid g^2$ condition.



    I will boldly assert that, by chasing through the divisibility conditions and using the fact $a neq 0$, the general case comes from:



    • Select integers $u,v,w$ such that $gcd(v,w) = 1$, $v > 0$, and $u neq 0$

    • Set $a = uv^2$

    • Set $g = uvw$

    The radicand $a^2 - g^2$ we need to be a perfect square then simplifies:



    $$ a^2 - g^2 = u^2 v^2 (v^2 - w^2) $$



    This has a square root if and only if $|v|$ and $|w|$ are two components of a primitive pythagorean triple, with $|v|$ the hypotenuse.



    The $|a| > |g|$ condition simplifies to requiring $|v| neq |w|$. Given the other constraints, this simplifies to $v > 1$.






    share|cite|improve this answer


















    • 5




      I think that is the best answer, as it is the only answer that systematically derives a complete solution, and moreover it explains it nicely. Moreover it is based on a general principle that can be used to solve other problems, so its usefulness goes beyond answering the specific question.
      – celtschk
      Apr 18 at 7:08







    • 2




      Great answer. This also shows that all soloutions are either integer or irrational.
      – Peter Green
      Apr 18 at 9:27










    • Case $a=g$ leads to the integer $x, y.$
      – Yuri Negometyanov
      Apr 22 at 3:36










    • a = g leads to x=y which violates the question requirements of distinct integers.
      – Peter Green
      Apr 23 at 19:18












    up vote
    17
    down vote










    up vote
    17
    down vote









    Commonly, an easy way to solve problems like these is to turn it around:




    Pick three integers. Are there real numbers such that GM, AM, and HM are those three integers?




    and you simply solve for the two real numbers.



    This probably doesn't work here, because you have three equations in two unknowns. But you could pick two of the integers to be, for example, the GM and AM. From there you can solve for the numbers and then compute the HM, and the question is how to make the HM an integer too.



    Working through the definitions and assuming $mathrmAM(x,y) neq 0$ you can ultimately determine



    $$ x,y = mathrmAM(x,y) pm sqrtmathrmAM(x,y)^2 - mathrmGM(x,y)^2 $$
    $$ mathrmHM(x,y) = fracmathrmGM(x,y)^2mathrmAM(x,y) $$



    It's now easy to determine all solutions to the original problem. They are obtained by selecting integers $g$ and $a$ satisfying:



    • $|a| > |g|$

    • $a$ divides $g^2$

    • $a neq 0$

    and then you can set



    • $x,y = a pm sqrta^2 - g^2$

    • $mathrmAM(x,y) = a$

    • $mathrmGM(x,y) = g$

    • $mathrmHM(x,y) = fracg^2a$

    To further solve the problem of asking for $x,y$ to be integers, you need to arrange to have $a^2 - g^2$ be a perfect square. This is a bit more complicated, and related to pythagorean triples.




    To work out the integer case, we need to better understand solutions to the $a mid g^2$ condition.



    I will boldly assert that, by chasing through the divisibility conditions and using the fact $a neq 0$, the general case comes from:



    • Select integers $u,v,w$ such that $gcd(v,w) = 1$, $v > 0$, and $u neq 0$

    • Set $a = uv^2$

    • Set $g = uvw$

    The radicand $a^2 - g^2$ we need to be a perfect square then simplifies:



    $$ a^2 - g^2 = u^2 v^2 (v^2 - w^2) $$



    This has a square root if and only if $|v|$ and $|w|$ are two components of a primitive pythagorean triple, with $|v|$ the hypotenuse.



    The $|a| > |g|$ condition simplifies to requiring $|v| neq |w|$. Given the other constraints, this simplifies to $v > 1$.






    share|cite|improve this answer














    Commonly, an easy way to solve problems like these is to turn it around:




    Pick three integers. Are there real numbers such that GM, AM, and HM are those three integers?




    and you simply solve for the two real numbers.



    This probably doesn't work here, because you have three equations in two unknowns. But you could pick two of the integers to be, for example, the GM and AM. From there you can solve for the numbers and then compute the HM, and the question is how to make the HM an integer too.



    Working through the definitions and assuming $mathrmAM(x,y) neq 0$ you can ultimately determine



    $$ x,y = mathrmAM(x,y) pm sqrtmathrmAM(x,y)^2 - mathrmGM(x,y)^2 $$
    $$ mathrmHM(x,y) = fracmathrmGM(x,y)^2mathrmAM(x,y) $$



    It's now easy to determine all solutions to the original problem. They are obtained by selecting integers $g$ and $a$ satisfying:



    • $|a| > |g|$

    • $a$ divides $g^2$

    • $a neq 0$

    and then you can set



    • $x,y = a pm sqrta^2 - g^2$

    • $mathrmAM(x,y) = a$

    • $mathrmGM(x,y) = g$

    • $mathrmHM(x,y) = fracg^2a$

    To further solve the problem of asking for $x,y$ to be integers, you need to arrange to have $a^2 - g^2$ be a perfect square. This is a bit more complicated, and related to pythagorean triples.




    To work out the integer case, we need to better understand solutions to the $a mid g^2$ condition.



    I will boldly assert that, by chasing through the divisibility conditions and using the fact $a neq 0$, the general case comes from:



    • Select integers $u,v,w$ such that $gcd(v,w) = 1$, $v > 0$, and $u neq 0$

    • Set $a = uv^2$

    • Set $g = uvw$

    The radicand $a^2 - g^2$ we need to be a perfect square then simplifies:



    $$ a^2 - g^2 = u^2 v^2 (v^2 - w^2) $$



    This has a square root if and only if $|v|$ and $|w|$ are two components of a primitive pythagorean triple, with $|v|$ the hypotenuse.



    The $|a| > |g|$ condition simplifies to requiring $|v| neq |w|$. Given the other constraints, this simplifies to $v > 1$.







    share|cite|improve this answer














    share|cite|improve this answer



    share|cite|improve this answer








    edited Aug 17 at 3:48

























    answered Apr 17 at 18:14









    Hurkyl

    108k9113254




    108k9113254







    • 5




      I think that is the best answer, as it is the only answer that systematically derives a complete solution, and moreover it explains it nicely. Moreover it is based on a general principle that can be used to solve other problems, so its usefulness goes beyond answering the specific question.
      – celtschk
      Apr 18 at 7:08







    • 2




      Great answer. This also shows that all soloutions are either integer or irrational.
      – Peter Green
      Apr 18 at 9:27










    • Case $a=g$ leads to the integer $x, y.$
      – Yuri Negometyanov
      Apr 22 at 3:36










    • a = g leads to x=y which violates the question requirements of distinct integers.
      – Peter Green
      Apr 23 at 19:18












    • 5




      I think that is the best answer, as it is the only answer that systematically derives a complete solution, and moreover it explains it nicely. Moreover it is based on a general principle that can be used to solve other problems, so its usefulness goes beyond answering the specific question.
      – celtschk
      Apr 18 at 7:08







    • 2




      Great answer. This also shows that all soloutions are either integer or irrational.
      – Peter Green
      Apr 18 at 9:27










    • Case $a=g$ leads to the integer $x, y.$
      – Yuri Negometyanov
      Apr 22 at 3:36










    • a = g leads to x=y which violates the question requirements of distinct integers.
      – Peter Green
      Apr 23 at 19:18







    5




    5




    I think that is the best answer, as it is the only answer that systematically derives a complete solution, and moreover it explains it nicely. Moreover it is based on a general principle that can be used to solve other problems, so its usefulness goes beyond answering the specific question.
    – celtschk
    Apr 18 at 7:08





    I think that is the best answer, as it is the only answer that systematically derives a complete solution, and moreover it explains it nicely. Moreover it is based on a general principle that can be used to solve other problems, so its usefulness goes beyond answering the specific question.
    – celtschk
    Apr 18 at 7:08





    2




    2




    Great answer. This also shows that all soloutions are either integer or irrational.
    – Peter Green
    Apr 18 at 9:27




    Great answer. This also shows that all soloutions are either integer or irrational.
    – Peter Green
    Apr 18 at 9:27












    Case $a=g$ leads to the integer $x, y.$
    – Yuri Negometyanov
    Apr 22 at 3:36




    Case $a=g$ leads to the integer $x, y.$
    – Yuri Negometyanov
    Apr 22 at 3:36












    a = g leads to x=y which violates the question requirements of distinct integers.
    – Peter Green
    Apr 23 at 19:18




    a = g leads to x=y which violates the question requirements of distinct integers.
    – Peter Green
    Apr 23 at 19:18










    up vote
    5
    down vote













    Integer Case



    If we start out with
    $$
    a=fracx+y2,quad g=sqrtxy,quad h=frac2xyx+ytag1
    $$
    we have that
    $$
    ah=g^2tag2
    $$
    Furthermore, note that
    $$
    a^2-g^2=left(fracx-y2right)^2=d^2tag3
    $$
    that is,
    $$
    a^2=g^2+d^2tag4
    $$
    So this is related to Pythagorean Triples.



    Furthermore, if $amid g^2$, then $h=fracg^2a$ is an integer.



    Given any Pythagorean Triple, $k^2+m^2=n^2$ with $(n,m)=1$ (this answer shows how to generate all primitive Pythagorean Triples), we need to multiply by $n$ to ensure that $amid g^2$. That is, let
    $$
    a=n^2,quad d=mn,quad g=kntag5
    $$
    then
    $$
    h=k^2,quad x=n(n+m),quad y=n(n-m)tag6
    $$
    and $(6)$ gives all $x,yinmathbbZ$ where $fracx+y2,sqrtxy,frac2xyx+yinmathbbZ$ and $left(fracx+y2,frac2xyx+yright)=1$.




    Examples



    The smallest Pythagorean Triple is $(3,4,5)$. This gives two pairs:



    $(5(5+3),5(5-3))=(40,10)$ whose (AM, GM, HM) are $(25,20,16)$.



    $(5(5+4),5(5-4))=(45,5)$ whose (AM, GM, HM) are $(25,15,9)$.




    Real Case



    If we let $x,yinmathbbR$, then the important restriction is $(2)$ above. That is, $ah=g^2$. That is, if we have
    $$
    a=prod_k p_k^e_ktag7
    $$
    Then if we have $glt a$ so that
    $$
    left.prod_k p_k^leftlceil e_k/2rightrceil,middle|,gright.tag8
    $$
    where $lceil xrceil$ is the ceiling function, the least integer not less than $x$.



    Then $amid g^2$ and $h=fracg^2a$ is an integer. Note that to have $ane g$, we need some $e_kge2$. For such $a$ and $g$, we have
    $$
    x=a+sqrta^2-g^2,quad y=a-sqrta^2-g^2tag9
    $$




    Examples



    Extending the example above, let's consider $a=25$. In that case, we are looking for $glt25$ so that $5mid g$. $g=20$ and $g=15$ are given above; however, there are two other cases:



    $g=10$: which gives $x=25+5sqrt21$ and $y=25-5sqrt21$ and $h=4$.



    $g=5$: which gives $x=25+10sqrt6$ and $y=25-10sqrt6$ and $h=1$.



    We can even have non-square $a$. For example, $a=12$. In this case we are looking for $glt12$ so that $6mid g$. That is,



    $g=6$: which gives $x=12+6sqrt3$ and $y=12-6sqrt3$ and $h=3$.








    share|cite|improve this answer


























      up vote
      5
      down vote













      Integer Case



      If we start out with
      $$
      a=fracx+y2,quad g=sqrtxy,quad h=frac2xyx+ytag1
      $$
      we have that
      $$
      ah=g^2tag2
      $$
      Furthermore, note that
      $$
      a^2-g^2=left(fracx-y2right)^2=d^2tag3
      $$
      that is,
      $$
      a^2=g^2+d^2tag4
      $$
      So this is related to Pythagorean Triples.



      Furthermore, if $amid g^2$, then $h=fracg^2a$ is an integer.



      Given any Pythagorean Triple, $k^2+m^2=n^2$ with $(n,m)=1$ (this answer shows how to generate all primitive Pythagorean Triples), we need to multiply by $n$ to ensure that $amid g^2$. That is, let
      $$
      a=n^2,quad d=mn,quad g=kntag5
      $$
      then
      $$
      h=k^2,quad x=n(n+m),quad y=n(n-m)tag6
      $$
      and $(6)$ gives all $x,yinmathbbZ$ where $fracx+y2,sqrtxy,frac2xyx+yinmathbbZ$ and $left(fracx+y2,frac2xyx+yright)=1$.




      Examples



      The smallest Pythagorean Triple is $(3,4,5)$. This gives two pairs:



      $(5(5+3),5(5-3))=(40,10)$ whose (AM, GM, HM) are $(25,20,16)$.



      $(5(5+4),5(5-4))=(45,5)$ whose (AM, GM, HM) are $(25,15,9)$.




      Real Case



      If we let $x,yinmathbbR$, then the important restriction is $(2)$ above. That is, $ah=g^2$. That is, if we have
      $$
      a=prod_k p_k^e_ktag7
      $$
      Then if we have $glt a$ so that
      $$
      left.prod_k p_k^leftlceil e_k/2rightrceil,middle|,gright.tag8
      $$
      where $lceil xrceil$ is the ceiling function, the least integer not less than $x$.



      Then $amid g^2$ and $h=fracg^2a$ is an integer. Note that to have $ane g$, we need some $e_kge2$. For such $a$ and $g$, we have
      $$
      x=a+sqrta^2-g^2,quad y=a-sqrta^2-g^2tag9
      $$




      Examples



      Extending the example above, let's consider $a=25$. In that case, we are looking for $glt25$ so that $5mid g$. $g=20$ and $g=15$ are given above; however, there are two other cases:



      $g=10$: which gives $x=25+5sqrt21$ and $y=25-5sqrt21$ and $h=4$.



      $g=5$: which gives $x=25+10sqrt6$ and $y=25-10sqrt6$ and $h=1$.



      We can even have non-square $a$. For example, $a=12$. In this case we are looking for $glt12$ so that $6mid g$. That is,



      $g=6$: which gives $x=12+6sqrt3$ and $y=12-6sqrt3$ and $h=3$.








      share|cite|improve this answer
























        up vote
        5
        down vote










        up vote
        5
        down vote









        Integer Case



        If we start out with
        $$
        a=fracx+y2,quad g=sqrtxy,quad h=frac2xyx+ytag1
        $$
        we have that
        $$
        ah=g^2tag2
        $$
        Furthermore, note that
        $$
        a^2-g^2=left(fracx-y2right)^2=d^2tag3
        $$
        that is,
        $$
        a^2=g^2+d^2tag4
        $$
        So this is related to Pythagorean Triples.



        Furthermore, if $amid g^2$, then $h=fracg^2a$ is an integer.



        Given any Pythagorean Triple, $k^2+m^2=n^2$ with $(n,m)=1$ (this answer shows how to generate all primitive Pythagorean Triples), we need to multiply by $n$ to ensure that $amid g^2$. That is, let
        $$
        a=n^2,quad d=mn,quad g=kntag5
        $$
        then
        $$
        h=k^2,quad x=n(n+m),quad y=n(n-m)tag6
        $$
        and $(6)$ gives all $x,yinmathbbZ$ where $fracx+y2,sqrtxy,frac2xyx+yinmathbbZ$ and $left(fracx+y2,frac2xyx+yright)=1$.




        Examples



        The smallest Pythagorean Triple is $(3,4,5)$. This gives two pairs:



        $(5(5+3),5(5-3))=(40,10)$ whose (AM, GM, HM) are $(25,20,16)$.



        $(5(5+4),5(5-4))=(45,5)$ whose (AM, GM, HM) are $(25,15,9)$.




        Real Case



        If we let $x,yinmathbbR$, then the important restriction is $(2)$ above. That is, $ah=g^2$. That is, if we have
        $$
        a=prod_k p_k^e_ktag7
        $$
        Then if we have $glt a$ so that
        $$
        left.prod_k p_k^leftlceil e_k/2rightrceil,middle|,gright.tag8
        $$
        where $lceil xrceil$ is the ceiling function, the least integer not less than $x$.



        Then $amid g^2$ and $h=fracg^2a$ is an integer. Note that to have $ane g$, we need some $e_kge2$. For such $a$ and $g$, we have
        $$
        x=a+sqrta^2-g^2,quad y=a-sqrta^2-g^2tag9
        $$




        Examples



        Extending the example above, let's consider $a=25$. In that case, we are looking for $glt25$ so that $5mid g$. $g=20$ and $g=15$ are given above; however, there are two other cases:



        $g=10$: which gives $x=25+5sqrt21$ and $y=25-5sqrt21$ and $h=4$.



        $g=5$: which gives $x=25+10sqrt6$ and $y=25-10sqrt6$ and $h=1$.



        We can even have non-square $a$. For example, $a=12$. In this case we are looking for $glt12$ so that $6mid g$. That is,



        $g=6$: which gives $x=12+6sqrt3$ and $y=12-6sqrt3$ and $h=3$.








        share|cite|improve this answer














        Integer Case



        If we start out with
        $$
        a=fracx+y2,quad g=sqrtxy,quad h=frac2xyx+ytag1
        $$
        we have that
        $$
        ah=g^2tag2
        $$
        Furthermore, note that
        $$
        a^2-g^2=left(fracx-y2right)^2=d^2tag3
        $$
        that is,
        $$
        a^2=g^2+d^2tag4
        $$
        So this is related to Pythagorean Triples.



        Furthermore, if $amid g^2$, then $h=fracg^2a$ is an integer.



        Given any Pythagorean Triple, $k^2+m^2=n^2$ with $(n,m)=1$ (this answer shows how to generate all primitive Pythagorean Triples), we need to multiply by $n$ to ensure that $amid g^2$. That is, let
        $$
        a=n^2,quad d=mn,quad g=kntag5
        $$
        then
        $$
        h=k^2,quad x=n(n+m),quad y=n(n-m)tag6
        $$
        and $(6)$ gives all $x,yinmathbbZ$ where $fracx+y2,sqrtxy,frac2xyx+yinmathbbZ$ and $left(fracx+y2,frac2xyx+yright)=1$.




        Examples



        The smallest Pythagorean Triple is $(3,4,5)$. This gives two pairs:



        $(5(5+3),5(5-3))=(40,10)$ whose (AM, GM, HM) are $(25,20,16)$.



        $(5(5+4),5(5-4))=(45,5)$ whose (AM, GM, HM) are $(25,15,9)$.




        Real Case



        If we let $x,yinmathbbR$, then the important restriction is $(2)$ above. That is, $ah=g^2$. That is, if we have
        $$
        a=prod_k p_k^e_ktag7
        $$
        Then if we have $glt a$ so that
        $$
        left.prod_k p_k^leftlceil e_k/2rightrceil,middle|,gright.tag8
        $$
        where $lceil xrceil$ is the ceiling function, the least integer not less than $x$.



        Then $amid g^2$ and $h=fracg^2a$ is an integer. Note that to have $ane g$, we need some $e_kge2$. For such $a$ and $g$, we have
        $$
        x=a+sqrta^2-g^2,quad y=a-sqrta^2-g^2tag9
        $$




        Examples



        Extending the example above, let's consider $a=25$. In that case, we are looking for $glt25$ so that $5mid g$. $g=20$ and $g=15$ are given above; however, there are two other cases:



        $g=10$: which gives $x=25+5sqrt21$ and $y=25-5sqrt21$ and $h=4$.



        $g=5$: which gives $x=25+10sqrt6$ and $y=25-10sqrt6$ and $h=1$.



        We can even have non-square $a$. For example, $a=12$. In this case we are looking for $glt12$ so that $6mid g$. That is,



        $g=6$: which gives $x=12+6sqrt3$ and $y=12-6sqrt3$ and $h=3$.









        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited Apr 27 at 13:29

























        answered Apr 22 at 5:33









        robjohn♦

        259k26297613




        259k26297613




















            up vote
            0
            down vote













            Let $a+b=2n$ and $ab=m^2$ (so that the arithmetic and geometric means are the arbitray integers $n$ and $m$).



            The harmonic mean is $$dfrac2aba+b=fracm^2n,$$ so, yes, you can certainly obtain three integers.






            share|cite|improve this answer




















            • Please explain the downvote or undo it.
              – Yves Daoust
              Apr 21 at 10:37






            • 1




              I downvoted this post, because I fail to see how this adds anything new to what has already been covered by Hurkyl's answer.
              – Gaurang Tandon
              Apr 22 at 2:56






            • 1




              @GaurangTandon: thanks for the feedback.
              – Yves Daoust
              Apr 22 at 15:35










            • Well, I upvoted :)
              – user477343
              Aug 17 at 3:12














            up vote
            0
            down vote













            Let $a+b=2n$ and $ab=m^2$ (so that the arithmetic and geometric means are the arbitray integers $n$ and $m$).



            The harmonic mean is $$dfrac2aba+b=fracm^2n,$$ so, yes, you can certainly obtain three integers.






            share|cite|improve this answer




















            • Please explain the downvote or undo it.
              – Yves Daoust
              Apr 21 at 10:37






            • 1




              I downvoted this post, because I fail to see how this adds anything new to what has already been covered by Hurkyl's answer.
              – Gaurang Tandon
              Apr 22 at 2:56






            • 1




              @GaurangTandon: thanks for the feedback.
              – Yves Daoust
              Apr 22 at 15:35










            • Well, I upvoted :)
              – user477343
              Aug 17 at 3:12












            up vote
            0
            down vote










            up vote
            0
            down vote









            Let $a+b=2n$ and $ab=m^2$ (so that the arithmetic and geometric means are the arbitray integers $n$ and $m$).



            The harmonic mean is $$dfrac2aba+b=fracm^2n,$$ so, yes, you can certainly obtain three integers.






            share|cite|improve this answer












            Let $a+b=2n$ and $ab=m^2$ (so that the arithmetic and geometric means are the arbitray integers $n$ and $m$).



            The harmonic mean is $$dfrac2aba+b=fracm^2n,$$ so, yes, you can certainly obtain three integers.







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Apr 19 at 20:03









            Yves Daoust

            112k665207




            112k665207











            • Please explain the downvote or undo it.
              – Yves Daoust
              Apr 21 at 10:37






            • 1




              I downvoted this post, because I fail to see how this adds anything new to what has already been covered by Hurkyl's answer.
              – Gaurang Tandon
              Apr 22 at 2:56






            • 1




              @GaurangTandon: thanks for the feedback.
              – Yves Daoust
              Apr 22 at 15:35










            • Well, I upvoted :)
              – user477343
              Aug 17 at 3:12
















            • Please explain the downvote or undo it.
              – Yves Daoust
              Apr 21 at 10:37






            • 1




              I downvoted this post, because I fail to see how this adds anything new to what has already been covered by Hurkyl's answer.
              – Gaurang Tandon
              Apr 22 at 2:56






            • 1




              @GaurangTandon: thanks for the feedback.
              – Yves Daoust
              Apr 22 at 15:35










            • Well, I upvoted :)
              – user477343
              Aug 17 at 3:12















            Please explain the downvote or undo it.
            – Yves Daoust
            Apr 21 at 10:37




            Please explain the downvote or undo it.
            – Yves Daoust
            Apr 21 at 10:37




            1




            1




            I downvoted this post, because I fail to see how this adds anything new to what has already been covered by Hurkyl's answer.
            – Gaurang Tandon
            Apr 22 at 2:56




            I downvoted this post, because I fail to see how this adds anything new to what has already been covered by Hurkyl's answer.
            – Gaurang Tandon
            Apr 22 at 2:56




            1




            1




            @GaurangTandon: thanks for the feedback.
            – Yves Daoust
            Apr 22 at 15:35




            @GaurangTandon: thanks for the feedback.
            – Yves Daoust
            Apr 22 at 15:35












            Well, I upvoted :)
            – user477343
            Aug 17 at 3:12




            Well, I upvoted :)
            – user477343
            Aug 17 at 3:12












             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2739592%2fdo-there-exist-pairs-of-distinct-real-numbers-whose-arithmetic-geometric-and-ha%23new-answer', 'question_page');

            );

            Post as a guest













































































            這個網誌中的熱門文章

            How to combine Bézier curves to a surface?

            Why am i infinitely getting the same tweet with the Twitter Search API?

            Carbon dioxide