## Friday, June 15, 2012

### A Dinner Puzzle

Recently at a dinner party the hostess offered the following puzzle for anyone interested. Assume you have two numbers: a and b. Create a math sentence using these numbers and the +,-,/,*, square root and power signs so that this sentence will produce the largest of these numbers as the output.

The hostess told that this puzzle was offered to her a day before and she couldn't concentrate for a number of hours till she solved it. Needless to say, I also do not remember what was served at this dinner or the names of the guests. It took a whole evening and finally at 11:30pm the angel of solution descended upon me. Can you catch him as well?

Your answers are accepted any time until midnight Eastern Time on Sunday, on our Family Puzzle Marathon.

John Golden said...

This seems ambiguous. Assumptions: no info about the numbers, assume a and b are real, you can use each only once, root and power sign mean x^a or x^(1/a)... just unsure what the goal is. Probably I'm being too mathy, but it's hard to imagine an answer that would be good for all a and b. Even if they're counting numbers, maybe. Unless it's like an alphabetical answer? I look forward to other people's solutions this week.

Ryan said...

assuming a>b

a+ (a/b) * ( rt( (a+b)^2 ) ) - (a/b) * ( rt( (a+b)^2 ) )

Were we supposed to use each operator/variable once? I'm also assuming we can't use other numbers than a, b, and the 2 as a power/root, since the use of 0 would make things too easy. If we can't use 2 we could replace it with "a" in the root/power.

Jerome said...

I don't know if the problem is to choose the largest number (a or b) and then use an algorithm that will leave one of them using +-*/sqrt and power, or if the problem is to determine the largest number itself and let it pop out of the fire.

If it is the first, I suppose you could do it like this (although there should be many solutions)

sqrt( [a + b]^2 - 2*a*b - (a^2 + b^2))^n + ab
==============================================
b

where a is the largest number.

The other problem escaptes me right now.

Anonymous said...

Your puzzle does not indicate if you can use numbers or other letters indicating quantities. Assuming that a and b are both positive quantities, I would venture that ab to the ab power is the highest number.

Gurubandhu

Maria said...

To clarify a bit. All you need to do is come up with a sentence of a type: a+b-a*b-sqrt(a...b)..... that will produce as an output the largest of two numbers, a and b. If a>b then the output should be a, if a<b then the output should be b.
The answer is simple and elegant. It is easier to get to it if you draw two rectangles of different length, representing a and b, next to each other. How to manipulate them to find the largest?

if-then statements are not allowed in this sentence, only +,-,*,/,sqrt and ^2 signs.

good luck!

Jerome said...

I did this with the quadratic equation. There are numerous cases to consider. I will only consider the one: a>0 and b<0 The others would be done much the same way. In addition one or both a or b could be zero. Those two will be ignored.

let one of the roots of the quadratic be a and the other be - b

Therefore the quadratic looks like this.

x = [-(-a + b) +/- SQRT( (-(a - b)^2 + 4a*b))/2

We are only concerned about the right hand side.
[a - b + sqrt((a - b)^2 + 4ab)] / 2

[ a - b + sqrt(a + b)^2] / 2
[ a - b + (a + b)/2

2a / 2 = a

The larger number comes out as an a.

Jerome said...

I need to note that you could set this up with another variable such that you would not be working with negatives.

Ilya said...

I came up with an answer in a somewhat abstract way before I read your suggestion of a geometrical approach. What I found helpful is using the fact the combination of square and square root yields an absolute value of a number. With that, (a-b)+SQRT((a-b)*(a-b)) will be equal 0 if a <=b or (a-b)*2 if a > b. If we multiply that by 2 and then add b, we get exactly what is needed:
((a-b)+SQRT((a-b)*(a-b)))*2 + b, which, when a <= b, will be equal b, and when a > b, will be equal (a-b)+b = a.

Maria said...

OK, I think the puzzle may be a bit too engineering and abstract that our usual puzzles. But some of you have got it right.

Imagine two rectangles, one bigger than another. Their sum + their difference, together divided by 2 will give the length of the largest rectangle.
So, ((a+b) + |a-b|)/2 = largest of a and b

However, we do not have a module || operation, so the trick is to replace it with sqrt ((a+b)^2).

((a+b) + sqrt((a+b)^2))/2

Does it make sense now?
A puzzle point for Ilya, Jerome and Ryan who produced close answers.

Anonymous said...

((a+b) + sqrt((a+b)^2))/2
should equal a+b -- not the largest of a and b

sqrt((a+b)^2)) = sqrt((a+b)(a+b)) = a+b

((a+b) + (a+b))/2 = 2*(a+b)/2 = a+b

Am I missing something?

Thanks,
TracyZ

Maria said...

My mistake - it should be "a-b" instead of "a+b".

We are replacing a module || operation with sqrt ((a-b)^2).