## Kids ages

Posted by Chris on January 17, 2014 – 11:55 pm

I have four children. Their ages (a whole number of years) are between 2 and 16 inclusive. No two have the same age. Last year, the square of the age of the oldest was the same as the sum of the squares of the ages of the other three. Next year the sum of the squares of the oldest and the youngest will be the same as the sum of the squares of the ages of the other two.

What are the possible ages of my children?

January 18th, 2014 at 11:10 am

Nice problem, I like it If 16 is included, then we have 2 possibilities. If not – only one.

January 18th, 2014 at 5:33 pm

Just for you Slavy, what age is need to get three solutions.

The first part of the original question was whether or not the info given gave a unique solution.

Needless to say it’s dead easy to do on a computer.

January 18th, 2014 at 5:59 pm

If I’m not mistaken 31

January 18th, 2014 at 6:40 pm

You’re not mistaken.

Does mod 8 pretty well crack this one?

January 19th, 2014 at 5:24 am

You may not use any modulo arithmetic, but I did use mod 8 (actually mod 4) in the first step of the proof. There are several tricks involved in the problem, that’s why I like it If you don’t know how to start and need some hints – the age of the youngest is uniquely determined from the statements in the problem. Find it and if you still don’t know how to proceed – let me know

January 20th, 2014 at 9:39 am

I interpret the silence as people are stuck with the problem, so let me start with the first hint: Prove that the youngest is of odd age!

January 20th, 2014 at 9:54 am

I just read this problem this morning. I was about to write out what I know…

2 ≤ a < b < c < d ≤ 16

(a-1)^2 + (b-1)^2 + (c-1)^2 = (d-1)^2

(a+1)^2 + (d+1)^2 = (b+1)^2 + (c+1)^2

a, b, c, d must either be: all odd, all even, or two of each.

January 20th, 2014 at 11:56 am

To start finding an acceptable range of each value:

From my second equation, the term (a-1) must be less than the square root of one-third of (d-1)^2: (a-1) ≤ sqrt[(d-1)^2 / 3]

and if d=16 (maximum), then (a-1) ≤ sqrt[15^2 / 3]

=> a ≤ 9.66

So a is an integer from 2 to 9 (inclusive).

From that same equation we see that (d-1)^2 must be at least the sum of the squares of (a-1), (b-1), and (c-1) where a=2, b=3, and c=4. That gives us that d muse be at least 3.74, so d must be at least 4.

However, we already know that d must be at least 5, since no 2 ages are the same (minimum: a=2, b=3, c=4, d=5).

So d is an integer from 5 to 16 (inclusive).

That doesn’t get me much closer to the answer, but if someone were to do this brute-force, then there is no need to look past a=9.

January 20th, 2014 at 11:57 am

Hi DP. They can’t be all even, because the first equality fails mod 4 (or mod 8 whatever you prefer).

January 20th, 2014 at 12:01 pm

Also with more intelligent approach (namely playing with the two equations and combining them in a smart way) you’ll get a<6.

January 20th, 2014 at 12:48 pm

By the way, I never gave my answers – only some analysis. I came up with 2 solutions to the problem, as slavy has already pointed out.

The two possibilities are: (3,6,15,16) -or- (3,7,10,12).

January 20th, 2014 at 8:09 pm

Hi. Slavy. I’ve been playing games instead of doing maths. I know from your comment (a < 6 and that a is odd – so a is 3 or 5) and your statement about combining the equations, that we both made the same move.

Subtracting the two equations => 4d = 4c + 4b – 2(a^2 + 1)

So it’s immediately apparent (mod 4) that a^2 + 1 is even, so a is odd.

Dividing by 4 and rearranging => b + c = d + (a^2 + 1)/2

Using d > c > b > a suggests b = a +1 +B, c = a +2 +B +C, d = a +3 +B +C + D,

where B,C,D are all ≥ 0.

So 2a + 3 + 2B + C = a + 3 + B + C + D + (a^2 + 1)/2

=> a + B = D + (a^2 + 1)/2 => B = D + (a – 1)^2 /2

a = 3 => B = D + 2, so B & ge; 2 => b ≥ 6, c ≥ 7, d ≥ 8. No problem so far.

a = 5 => B = D + 8 => B ≥ 8 => b ≥ 14 and c ≥ 15, d ≥16.

That’s at the limit for d. Substituting a = 3, b = 14, c = 15, d = 16 doesn’t satisfy the equations. I don’t like that last step, it wasn’t clever and gives me no insight as to why allowing the eldest to be 31 does make a = 5 be allowed. Then we get a = 5, b = 21, c = 23, d = 31 (found with a computer).

So a = 3. I won’t say “if a solution exists” because I already know there are two of them, and DP has posted them.

That’s as far as I’ve got. I now have to scratch my head about the next move (and also on how to improve that last cheat).

January 20th, 2014 at 9:48 pm

Here’s the mod 4 and mod 8 trickery.

Let n = 2m, then n^2 = 4m^2 = 0 (mod 4).

Let n = 2m + 1, then n^2 = 4m^2 + 4m + 1 = 1 (mod 4).

So n^2 = 0 (mod 4) if n is even, and n^2 = 1 (mod 4) if n is odd.

If 2 or 3 of x, y, z are odd, then x^2 + y^2 + z^2 = 2 or 3 (mod 4) and so cannot be a square. So, if w^2 = x^2 + y^2 + z^2, then, at most, 1 of x,y,z can be odd.

We have (d-1)^2 = (c-1)^2 + (b-1)^2 + (a-1)^2. So, at most, one of a,b,c can be even and then d is even.

w^2 + z^2 = x^2 + y^2 doesn’t yield anything interesting (mod 4). It does yield some extra info mod 8.

For reference. n^2 = 1 (mod 8 ) if n is odd. n^2 = 4 (mod 8 ) if n is divisible by 2, but not 4, n^2 = 0 (mod 8 ) if n is divisible by 4.

Proof: n = 4m => n^2 = 16m^2 = 0 (mod 8 )

n = 2(2m+1) => n^2 = 16m^2 + 8m + 4 = 4 (mod 8 )

n = 2m + 1 => n^2 = 4m^2 + 4m + 1 = 4m(m+1) + 1. Now either m or m+1 is even so 4m(m+1) is divisible by 8 => n^2 = 1 (mod 8 )

January 20th, 2014 at 9:54 pm

Off topic, see http://en.wikipedia.org/wiki/Lagrange’s_four-square_theorem as is http://en.wikipedia.org/wiki/Fermat%27s_theorem_on_sums_of_two_squares .

January 21st, 2014 at 12:00 pm

HI Chris. Yes, that’s what I have in mind. I personally prefer to write the equation in the form 2(d-c)=2b-(a^2+1). The LHS is positive, thus so is the RHS, meaning that a^2+1 < 2b. b is lest or equal to 14, so a is less or equal to 5 (and odd). If we assume it's 5, then b should be 14, and c=15, d=16. Direct check shows this cannot happen. Thus a=3, and d= b+c-5. Now, you just need to find a simplified enough Diophantine equation for b and c to solve. Let me know what your choice is

January 21st, 2014 at 3:16 pm

Hi Slavy. Aaargh, I wish I’d seen that “shortcut”. I knew I was goofing up when I introduced B,C and D.

Here are all the solutions when for the indicated age of the youngest

3 6 15 16

3 7 10 12

5 14 93 94

5 15 53 55

5 17 33 37

5 18 29 34

5 21 23 31

7 26 331 332

7 27 178 180

7 28 127 130

7 31 76 82

7 34 59 68

7 42 43 60

9 42 873 874

9 43 457 459

9 45 249 253

9 49 145 153

9 54 105 118

9 57 93 109

9 67 73 99

11 62 1911 1912

11 63 986 988

11 66 431 436

11 71 246 256

11 86 135 160

11 98 111 148

There are 22 cases for 13, here’s a few

13 86 3685 3686 (that’s the biggest)

13 121 185 221

13 125 175 215

13 130 165 210

13 133 160 208

13 135 157 207

(d-1)^2 = (c-1)^2 + (b-1)^2 + (a-1)^2

(d+1)^2= (c+1)^2 + (b+1)^2 – (a+1)^2

Here’s a couple of identities.

(x+1)^2 + (x-1)^2 = 2(x^2 +1) and (x+1)^2 – (x-1)^2 = 4x

Subtracting the original equations =>

4d = 4c + 4b – 2(a^2 + 1) => d = c + b – (a^2 + 1)/2 and a is odd. I’ve already dealt with that, so I’ll move on.

Summing the original equations =>

2(d^2 + 1) = 2(c^2 + 1) + 2(b^2 + 1) – 4a => d^2 = c^2 + b^2 – (2a – 1)

a is odd, so let a = 2q + 1 => 2a – 1 = 4q + 1. Substitute and re-arrange =>

d^2 + (4q + 1) = c^2 + b^2

If q is even, then a = 5,9,13,17,… and d^2 + 1 = c^2 + b^2 (mod 8 ) => one of b or c is simply odd, the other and d are either both odd or are both even and differ by a multiple of 4. That’s why 5 won’t work – in a previous post I showed that 5,14,15,16 was a candidate. 14 and 16 are even, but don’t differ by a multiple of 4.

If q is odd, then a = 3,7,11,15,… and d^2 = c^2 + b^2 + 3 (mod 8 ) => one of b or c is simply odd, and the other is even and differs from d by an odd multiple of 2.

I don’t know how to go further. So Mr. Slavy, pretty please, can I have some hints.

January 21st, 2014 at 3:34 pm

Chris, you can delete this post.

Check your signs on eq #2. The b-term should be positive. The resulting math is correct with this modification.

January 21st, 2014 at 3:52 pm

Hi Slavy. Skip the hints for now, unless there is something totally different from any of the above. I realise that I haven’t fully explored d = b + c – 5.

January 21st, 2014 at 4:05 pm

Thanks DP. My proof-reading obviously isn’t up to scratch. I’ve fixed it.

January 21st, 2014 at 4:27 pm

I’ve also corrected the last two maths paragraphs.

I’ll delete this noise when I think they are fully superfluous.

I suspect that by combining d = b + c -5 with the parity rules, that a short list of candidate solutions can be made. But it may be that there are so many possibilities, that number crunching is still required, albeit more guided.

January 21st, 2014 at 5:37 pm

We have d = b + c – (a^2 + 1)/2 and also d^2 = c^2 + b^2 – (2a – 1). We know a = 3, so they become d = c + b – 5 and d^2 = c^2 + b^2 – 5. Substituting the first into the second => bc – 5(b+c) +15 = 0. So bc = 0 (mod 5). Yeehah.

I’ll be back…

January 21st, 2014 at 6:02 pm

…meanwhile: using a = 2q+1 is odd, the general Diophantine equation is

1 – b – c + bc + (4 – 2b – 2c)q(1 + q) + 4q^3 + 2q^4 = 0

January 21st, 2014 at 6:29 pm

Good job, Chris! This is the equation I used and I believe it’s the simplest one

January 21st, 2014 at 6:55 pm

Using a = 2q+1 is odd, the general version of the Diophantine equation is

1 – (b +c) + bc + 2(2 – (b + c))q(1 + q) + 4q^3 + 2q^4 = 0

q = 1 (a = 3) => 1 – b – c + bc + (4 – 2b – 2c)2 + 4 + 2 = 0

=> bc – 5(b +c) + 15 = 0 => bc = 0 (mod 5)

q = 2 (a = 5) => bc – 13( b + c) + 89 = 0 => bc = 2 (mod 13)

and bc = 13(b+c) (mod 89)

q = 3 (a = 7) => bc – 25(b+c) + 319 = 0

q = 4 (a = 9) => bc – 41(b+c) + 849 = 0

q = 5 (a = 11) => bc -61(b+c) + 1871 = 0

q = 6 (a = 13) => bc – 85(b+c) + 3625 = 0

etc.

These Diophantine equations require no arm-waving or further rules to augment them. The solution set is finite in all cases that I’ve tested. The only restraint is that we artificially constrain solutions to 16 ≥ d > c > b > a ≥ 2. If I removed all constraints, some negative ages creep in, and b and c are interchangeable. Of course a is automatically constrained due to the way we developed the equation (and that we choose q, rather than calculate it).

I have improved the table in post 16. I’ve left the upper age as infinity in that table.

January 21st, 2014 at 7:02 pm

Hi Slavy. Guess what, another Olympiad problem. Looks easy, but isn’t.

I only know that the Diophantine equation is all that is needed because, I plugged it into Mathemtica (which also did a lot of the donkey work). It was able to furnish all the solutions I’d found. The only extra ones were because I’d limited the maximum age in my computer program.

I now want to see if I can solve any of those equations. bc =0 (mod 5) isn’t really a solution, but it fitted the known data.

January 21st, 2014 at 7:52 pm

The Diophantine equation is probably better written as

bc – (b + c)(1 + 2q + 2q^2) + (1 + 4q + 4q^2 + 4q^3 + 2q^4) = 0

For completeness, a = 2q + 1 and d = b + c – (1 +2q + 2q^2)

January 21st, 2014 at 10:22 pm

I’ve made some progress on solving bc – 5(b + c) + 15 = 0. But I’m not done with it yet.

I haven’t looked at bc – 13(b + c) + 89 = 0 at all. I’m amazed how easily Slavy takes all this stuff in his stride.

EDIT: 10 mins after posting this, I had a flash of inspiration. It uses a trick that’s been used here recently. I haven’t tested it out yet.

January 21st, 2014 at 11:13 pm

bc – 5(b+c) + 15 = 0 => (b – 5)(c – 5) = 10. Now 10 = 1 * 10 = 2 * 5. Noting that the expression is symmetric in b and c, WLOG either b – 5 = 1 and c – 5 = 10 or b – 5 = 2 and c – 5 = 5. In the first case b = 6 and c = 15, and in the second case b = 7 and c = 10.

If we also note that 10 = (-1)(-10) = (-2)(-5). In the first case we get b = 4 and c = -5. In the second case we get b = 3 and c = 0. These aren’t admissable for the kids ages. It is also clear that there are no other conceivable solutions. We also get that lot again but with b and c in reverse roles.

If q = 2 (=> a = 5) then we have bc – 13(b + c) + 89 = 0 =>

(b – 13)(c – 13) = 1*80 = 2*40 = 4*20 = 8*10 = 16*5. That’s 5 basic factor pair. Now double that because of the negative versions, and double again because we can write those factors in the reverse order, that’s 20 solutions. OTOH the equation is symmetric in b and c and we only allow positive integer solutions, we finally end up with 5 acceptable solutions. They require that the eldest is up to 94 years of age.

January 22nd, 2014 at 12:18 am

Now I’ve seen the solution and how easy it is, I see that everything Slavy said was spot on and I shouldn’t have wasted all that effort on parity-checking the equations.

Re-write the Diophantine equation in the very convenient form:

(b – (1 + 2q + 2q^2))(c – (1 + 2q + 2q^2)) = 2q^2 (2 + 2q + q^2)

a = 2q + 1 and d = b + c – (1 +2q + 2q^2) completes the scene.

In the following the ± are always both + or both -. In the worst csase we have

(b – k)(c – k) = 2p, p prime, then beause 2p = (±1)(±2p) = (±2)(±p) the solutions are of the form b = k ± 1, c = k ± 2p and b = k ± 2, c = k ± p and double that if take b and c to be distinct.

I enjoyed doing this problem. But that’s enough from me (for now).

Later: Just me being tedious,

Let k = 1 + 2q + 2q^2 and r = 2q^2(1 +2q + 2q^2), then the Diophantine equation is (b – k)(c – k) = r.

a = 2q + 1 and d = b + c – k completes the problem.

q may be negative.

January 22nd, 2014 at 12:30 am

Aaargh. I’ve made a boo-boo somewhere. The RHS of the equation has at least three factors. Ho, hum!

January 22nd, 2014 at 2:03 am

I’m glad to see you’ve made it Chris Last post from mi side, too: The fastest way to solve a Diophantine equation is to express one of the variables as a function of the other and to use that the solution should be integral. For a=3, we have c=(5b-15)/(b-5)=5+10/(b-5) and since c is larger, b can be only 6 or 7. For a=5 we have c=13+80/(b-13). Now, since d=b+c-10, the latter is smallest when b+c is minimal, which in turn happens when the two ages are as close to each other as possible. Thus b-13=8 and c-13=10 leading to d=31. The formulas are basically the same as the one Chris produced, just the “focus” is a little bit changed and this is mainly what I wanted to comment on

January 22nd, 2014 at 7:31 am

Thank you Slavy. I agree that your integer solution technique has got a definite edge to it (it’s definitely more natural). I’d forgotten to do the analysis for the maximum age, so thanks for adding it.

Those links in post 14 led me to consider Goldbach’s conjecture and also some sweet stuff to do with Gaussian integers.

Altogether this has been excellent experience.

January 22nd, 2014 at 1:05 pm

Last comment (or maybe not). The equations I gave in post 24 are more neatly written as

q = 1 => a = 3, (b – 5)(c – 5) = 10, d = b + c – 5

q = 2 => a = 5, (b – 13)( c -13) = 80, d = b + c – 13

q = 3 => a = 7, (b – 25)(c – 25) = 306, d = b + c – 25

q = 4 => a = 9, (b – 41)(c – 41) = 832, d = b + c – 41

q = 5 => a = 11, (b – 61)(c – 61) = 1850, d = b + c – 61

q = 6 => a = 13, (b – 85)(c – 85) = 3600, d = b + c – 85