# To Cooperate or Not?

I got this puzzle from IBM website. They have many more mind boggling puzzles out there. Actually they post it on monthly basis and the one given below is the latest puzzle on their site for August 2011.

### Tricky Triangle Riddle

A mathematician wanted to teach his children the value of cooperation, so he told them the following:

“I chose a secret triangle for which the lengths of its sides are all integers.

To you my dear son Charlie, I am giving the triangle’s perimeter. And to you, my beloved daughter Ariella, I am giving its area.

Since you are both such talented mathematicians, I’m sure that together you can find the lengths of the triangle’s sides.”

Instead of working together, Charlie and Ariella had the following conversation after their father gave each of them the information he promised.

**Charlie:** “Alas, I cannot deduce the lengths of the sides from my knowledge of the perimeter.”

**Ariella:** “I do not know the perimeter, but I cannot deduce the lengths of the sides from just knowing the area. Maybe our father is right and we should cooperate after all.”

**Charlie:** “Oh no, no need. Now I know the edges.”

**Ariella:** “Well, now I know them as well.”

Can you find the lengths of the triangle’s sides and explain the dialog above?

*Source: IBM*

Really glad to see the discussion going on here. Thanks all of you to make it more lively place

SOLUTION -

The three solutions are (4,4,3); (4,4,4); and (4,4,6).

Here’s the explanation based on the dialog for the first example:

Charlie knows the perimeter 11, but he cannot know the length of the sides, since (5,5,1); (5,4,2); and (5,3,3) are legitimate triangles, all having the same perimeter 11.

Ariella know the area 3/4*sqrt(55), but cannot distinguish between (4,4,3) and (7,6,2).

Charlie checks all four possibilities stated above and sees that in all cases, except (4,4,3), the area determines the triangle’s sides uniquely.

Therefore, he can deduce that the triangle has to be (4,4,3).

Ariella reasons that if the triangle’s sides were (7,6,2) Charlie would not have been able to find the sides since not only (7,6,2) but also (7,5,3) could have led to the same dialog. Therefore she can deduce the sides.

Note that (2,2,3) and (1,4,4) are common mistakes. It explains the first three statements, but not the last one — that Ariella cannot tell because Charlie could have known in both cases.

Here is my take.

Given a certain perimeter, Charlie is not able to figure out right away what the triangle is, so there must

be multiple valid triangles with that perimeter. Here is a list off triangles based on perimeter. I’ve

normalized them so that the numbers are in order from smallest to largest without loss of generality.

3 – (1,1,1)

4 – none

5 – (1,2,2)

6 – (2,2,2)

7* – (1,3,3), (2,2,3)

8 – (2,3,3)

9* – (1,4,4), (2,3,4), (3,3,3)

…

The ones with a * contain possible solutions because there are more than 1 triangle with those perimeters.

Now the trickier part – how can you decide on the area?

Here is an uncommon formula for the area of a triangle:

area=sqrt(s(s-a)(s-b)(s-c))

Where:

s := the semi-perimeter, or half the triangle’s perimeter = (a+b+c)/2

a,b,c := the side lengths

Generalizing this a bit further, we get:

area = sqrt( p/2 * (p/2 – a) * (p/2 – b) * (p/2 – c) )

= sqrt( p * (p-2a) * (p-2b) * (p-2c) / 16)

= sqrt( p * (p-2a) * (p-2b) * (p-2c) ) / 4

Lets define X = p * (p-2a) * (p-2b) * (p-2c)

Notice that X is made up of 4 factors.

When Ariella hears the area of the triangle, she could multiply it by 4 and square it to get X.

In the event that X has a unique 4-factorization, then Ariella would immediately know the perimeter (the

largest factor) and the three other sides (subtract from p and divide by 2 for each of the other 3 factors).

Thus, any triangle with a unique 4-factorization of X can be ignored since Ariella would have answered that

she knew the triangle right away.

So, the area of our candidate triangles from above are:

7 perimeter

(1,3,3) -> sqrt(7*5*1*1)/4 = sqrt(35)/4 unique – all 4 numbers are prime so there is no other way to factorize

(2,2,3) -> sqrt(7*3*3*1)/4 = sqrt(63)/4 not unique because 9*7*1*1 is also a 4-factorization

9 perimeter

(1,4,4) -> sqrt(9,7,1,1)/4 = sqrt(63)/4 not unique because 7*3*3*1 is also a 4-factorization

(2,3,4) -> sqrt(9,5,3,1)/4 = sqrt(135)/4 technically 15*9*1*1 and 27*5*1*1 are other 4-factorizations, but neither yeild a valid triangle with perimeter being the largest factor.

(3,3,3) -> sqrt(9,3,3,3)/4 = sqrt(243)/4 9*9*3*1, 27*3*3*1, and 27*9*1*1 all yeild triangles with perimeters that don’t match the largest factor, so this one is unique as well.

So there are only 2 possible solutions with a perimeter 9 or less. Lets see if they work.

Lets say that the triangle was (2,2,3).

Step 1. Charlie would be told 7 as the perimeter and would see that there are two valid triangles of

perimeter 7 – (1,3,3) and (2,2,3). Charlie would say he doesn’t know the triangle.

Step 2. Ariella would be told an area of sqrt(63)/4 and she too would see that there are two valid triangles

that satisfy that area – (2,2,3) and (1,4,4). Ariella would say she doesn’t know the triangle.

Step 3. Charlie would know that if the triangle was (1,3,3), Ariella would have see the unique 4-

factorization and known the triangle immediately. Since she did not, he can eliminate it. This leaves only

one triangle for Charlie – (2,2,3). Charlie says he knows what the triangle is.

Now lets say that the triangle was (1,4,4).

Step 1. Charlie would be told 9 as the perimeter and would see that there are 3 valid triangles – (1,4,4),

(2,3,4), and (3,3,3). Charlie would say he doesn’t know the triangle.

Step 2. Ariella would be told the area is sqrt(63)/4 and she too would see that there is more than one

possible triangle with that area – (2,2,3) and (1,4,4). Ariella would say she doesn’t know the triangle.

Step 3. Similar to the previous one, Charlie would know that (2,3,4) and (3,3,3) have unique 4-

factorizations, so if Ariella had been told either of those two areas, she would have known the triangle

immediately. Thus, those 2 triangles can be elimiated. Charlie says he knows what the triangle is.

Now, in both cases above, Ariella has the exact same information – the area is sqrt(63)/4 and Charlie

answered “no” in step 1 and “yes” in step 3. Thus, Ariella still does not have enough information to

determine which triange it is.

Thus, neither (2,2,3) nor (1,4,4) can be the solution, and we must look to triangles with bigger perimeters.

The formatting was all off, so here it is again with (slightly) better formatting.

Here is my take.

Given a certain perimeter, Charlie is not able to figure out right away what the triangle is, so there must be multiple valid triangles with that perimeter. Here is a list off triangles based on perimeter. I’ve normalized them so that the numbers are in order from smallest to largest without loss of generality.

3 – (1,1,1)

4 – none

5 – (1,2,2)

6 – (2,2,2)

7* – (1,3,3), (2,2,3)

8 – (2,3,3)

9* – (1,4,4), (2,3,4), (3,3,3)

…

The ones with a * contain possible solutions because there are more than 1 triangle with those perimeters.

Now the trickier part – how can you decide on the area?

Here is an uncommon formula for the area of a triangle:

area=sqrt(s(s-a)(s-b)(s-c))

Where:

s := the semi-perimeter, or half the triangle’s perimeter = (a+b+c)/2

a,b,c := the side lengths

Generalizing this a bit further, we get:

area = sqrt( p/2 * (p/2 – a) * (p/2 – b) * (p/2 – c) )

= sqrt( p * (p-2a) * (p-2b) * (p-2c) / 16)

= sqrt( p * (p-2a) * (p-2b) * (p-2c) ) / 4

Lets define X = p * (p-2a) * (p-2b) * (p-2c)

Notice that X is made up of 4 factors.

When Ariella hears the area of the triangle, she could multiply it by 4 and square it to get X.

In the event that X has a unique 4-factorization, then Ariella would immediately know the perimeter (the largest factor) and the three other sides (subtract from p and divide by 2 for each of the other 3 factors).

Thus, any triangle with a unique 4-factorization of X can be ignored since Ariella would have answered that she knew the triangle right away.

So, the area of our candidate triangles from above are:

7 perimeter

(1,3,3) -> sqrt(7*5*1*1)/4 = sqrt(35)/4 unique – all 4 numbers are prime so there is no other way to factorize

(2,2,3) -> sqrt(7*3*3*1)/4 = sqrt(63)/4 not unique because 9*7*1*1 is also a 4-factorization

9 perimeter

(1,4,4) -> sqrt(9,7,1,1)/4 = sqrt(63)/4 not unique because 7*3*3*1 is also a 4-factorization

(2,3,4) -> sqrt(9,5,3,1)/4 = sqrt(135)/4 technically 15*9*1*1 and 27*5*1*1 are other 4-factorizations, but neither yeild a valid triangle with perimeter being the largest factor.

(3,3,3) -> sqrt(9,3,3,3)/4 = sqrt(243)/4 9*9*3*1, 27*3*3*1, and 27*9*1*1 all yeild triangles with perimeters that don’t match the largest factor, so this one is unique as well.

So there are only 2 possible solutions with a perimeter 9 or less. Lets see if they work.

Lets say that the triangle was (2,2,3).

Step 1. Charlie would be told 7 as the perimeter and would see that there are two valid triangles of perimeter 7 – (1,3,3) and (2,2,3). Charlie would say he doesn’t know the triangle.

Step 2. Ariella would be told an area of sqrt(63)/4 and she too would see that there are two valid triangles that satisfy that area – (2,2,3) and (1,4,4). Ariella would say she doesn’t know the triangle.

Step 3. Charlie would know that if the triangle was (1,3,3), Ariella would have see the unique 4-factorization and known the triangle immediately. Since she did not, he can eliminate it. This leaves only one triangle for Charlie – (2,2,3). Charlie says he knows what the triangle is.

Now lets say that the triangle was (1,4,4).

Step 1. Charlie would be told 9 as the perimeter and would see that there are 3 valid triangles – (1,4,4), (2,3,4), and (3,3,3). Charlie would say he doesn’t know the triangle.

Step 2. Ariella would be told the area is sqrt(63)/4 and she too would see that there is more than one possible triangle with that area – (2,2,3) and (1,4,4). Ariella would say she doesn’t know the triangle.

Step 3. Similar to the previous one, Charlie would know that (2,3,4) and (3,3,3) have unique 4-factorizations, so if Ariella had been told either of those two areas, she would have known the triangle immediately. Thus, those 2 triangles can be elimiated. Charlie says he knows what the triangle is.

Now, in both cases above, Ariella has the exact same information – the area is sqrt(63)/4 and Charlie

answered “no” in step 1 and “yes” in step 3. Thus, Ariella still does not have enough information to determine which triange it is.

Thus, neither (2,2,3) nor (1,4,4) can be the solution, and we must look to triangles with bigger perimeters.

how did u bring about and work on sooo many possibilities?

no solution

@sundar : 2,2,1 doesnot seem to be a solution to me since if it was then its area is unique and one sibling could directly infer from it and also its counterpart 1,1,3 is not possible coz sum of two sides of a trianle has to be greater than the third side . hence 5 perimeter has just one possible triangle and it cant be the solution .

yeah i didn’t think abt that… U’re right pankaj… Well then I’m wrong… I’ll work on it..

a good one… this puzzle is

Answer (a guess): Lengths of sides = (1,2,2) A=4 P=5

*If Ariella needed to know the lengths of the sides from just the area, it should be a single-digit prime

number. (eg: A=5 => 1,1,5) Or else, there is an ambiguity (A=4 =>(1,2,2)or(1,1,4))

*If Charlie needed to know the lengths of the sides from just the perimeter, it should be either 3(1,1,1) or 4(1,1,2)…

*Since Ariella couldn’t find the sides, Charlie came to know that the area isn’t a prime number, from which he cancels a possibility

and the other possibility remaining becomes the answer.

*From perimeter, only when P=5, there are two possibilities of integer lengths i.e. (1,2,2) and (1,1,3)

For the former, A=4, and for the latter, A=3. But he comes to know that A is not a single-digit prime no. from Ariella’s

dialogue. So, he finally concludes that the sides must be 1,2,2. with P=5.

*Ariella understands that he cancels one possibility and declares the other possibility as the Answer.

Only the perimeter 5 has such 2 possibilities as said earlier…

She finds the sides to be 1,2,2. with A=4.

If the triangle was (1,2,2), then the perimeter would be 5. The only triangle with a perimeter 5 using whole numbers is (1,2,2), so Charlie would have said right away that he knows the triangle.

The only other possibility is (1,1,3), but such a triangle can’t exist because one side would be longer than the other two combined.

(2,2,3) and ( 4,4,1) are two posssible triangles ….. both are isosceles …… plz let me knw if i am wrong …

(2,2,3) and ( 4,4,1) are two posssible triangles ….. both are isosceles …… plz let me knw if i am wrong …

Integers can be negative or positive so first condition to find answer is they are positive !

If triangle had to be a right angled, then sides are multiples of 3, 4 and 5.

These integers corresponds to sides of a triangle. I am sure you understand that sides of a triangle cannot be negative.

Suppose it is an isosceles triangle with a perimeter of 64.

Let’s start with the base.

base = 2, leg = 31, 31

base = 4, leg = 30, 30

base = 6, leg = 29, 29

base = 8, leg = 28, 28

base = 10, leg = 27, 27

base = 12, leg = 26, 26

base = 14, leg = 25, 25

base = 16, leg = 24, 24

base = 18, leg = 23, 23

base = 20, leg = 22, 22

base = 22, leg = 21, 21

base = 24, leg = 20, 20

base = 26, leg = 19, 19

base = 28, leg = 18, 18

base = 30, leg = 17, 17

There are 15 options.

This is not a complete solution but just loud thinking:

Say the perimeter is 24 units.

let x,y,z be the measures of the sides of the triangle. Then x+y+z = 24. By the symmetries of the triangle inequality,

x+y>z,

x+z> y,

y+z>x.

Using the the perimeter equation above and the 3 inequalities we arrive at

12>x, 12>y, 12>z.

By trial&error, the following are the possible combinations:

(8,8,8) (7,6,11)

(7,8,9) (9,6,9)

(6,10,8) (9,5,10)

(5,11,8) (9,4,11)

(7,10,7) (4,10,10)

(3,10,11) (2,11,11)

therefore there are 12 possible traingles with perimeter 24 and integer sides.