Find The Frog!

A biologist is searching for a rare frog in a remote region of Brilliantia. The local villagers claim a single frog lives in a series of four ponds.

They claim that the frog stays in a pond during the day, and moves to a neighboring pond every night. The biologist can only check one pond a day, and she does not impact the frog's movement at night.

Can the biologist devise a strategy that guarantees she eventually discovers the frog?

Yes No

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

30 solutions

Andy Hayes
Dec 12, 2017

Let an O \text{O} denote where the biologist checks, and let an X \text{X} denote a pond where the frog cannot be. In order to devise a strategy that will guarantee that she eventually discovers the frog, we will always assume the worst case. That is, she will never discover the frog in a pond until the frog must be in that pond.

At the beginning, the biologist has no idea where the frog is. The first day, she checks the inner-left pond (and doesn't find the frog).

O O O O \underline{\hphantom{O}} \ \underline{\text{O}} \ \underline{\hphantom{O}} \ \underline{\hphantom{O}}

She doesn't know where the frog is among the remaining 3 ponds. Now she checks the inner-right pond the next day (and doesn't find the frog).

X O O O \underline{\text{X}} \ \underline{\hphantom{O}} \ \underline{\text{O}} \ \underline{\hphantom{O}}

The frog cannot be in the leftmost pond (it wasn't in the inner-left pond the previous day). She checks the same inner-right pond again (and doesn't find the frog).

O X O X \underline{\hphantom{O}} \ \underline{\text{X}} \ \underline{\text{O}} \ \underline{\text{X}}

Now she knows that the frog cannot be in the inner left pond (it wasn't in the leftmost pond or the inner right pond the day before), and she also knows that it isn't in the rightmost pond (it wasn't in the inner-right pond the day before). The frog is in the leftmost pond! Unfortunately, she can't check until the next day. She knows the frog will move to the inner-left pond, so that's where she checks.

X O X X \underline{\text{X}} \ \underline{\color{#20A900}\text{O}} \ \underline{\text{X}} \ \underline{\text{X}}

And she finds the frog!

Addendum: Of course, the biologist could always get lucky and discover the frog before this day, but this strategy ensures that she discovers the frog on the fourth day even in the worst case.

Moderator note:

One possible extension is simply to ask: what if there were more ponds? (Let's say, 10.) Would there still be a strategy that would always find the frog?

Does this not assume that the frog cannot move into the pond which the biologist has checked? For brevity, I would number the ponds from 1 to 4, left to right. Now, after checking pond 2 twice you can be sure that the frog is not in pond 1 but that evening is there anything to stop it moving to pond 2 from pond 3? As I read it, the biologist would not know if the frog has arrived in this pond overnight. The biologist may now check pond 3 but cannot guarantee that the frog has not "slipped the net". At any given stage, then, the biologist would have to either recheck the current pond or move to the next door one but there is always the chance that this is the wrong choice.

Any thoughts on this, anyone?

John Sergeant - 3 years, 5 months ago

Log in to reply

Yes, it's possible that the frog moves into pond 2 after the biologist checks pond 2. You can see from the diagram that pond 2 is open when the biologist is checking pond 3 for the first time.

X O O O \underline{\text{X}} \ \underline{\hphantom{O}} \ \underline{\text{O}} \ \underline{\hphantom{O}}

However, the next day, because the biologist knows the frog wasn't in pond 1, and also knows the frog wasn't in pond 3, the biologist knows that the frog cannot be in pond 2.

O X O X \underline{\hphantom{O}} \ \underline{\text{X}} \ \underline{\text{O}} \ \underline{\text{X}}

Andy Hayes - 3 years, 5 months ago

I have the same questions. It seems like the frog can dodge you every night.

Let's say you check 2 one day and the frog isn't there so you wait one more day at two to verify he wasn't at 1. If he still hasn't shown up he must be in 3 or 4, but Guaranteeing you find him is still tough. He was not in 1 or 2 for days one and two so you have two options, step over to 3 to try and catch him in that loop or hope he eventually comes to 2. Problem is neither way guarantees you'll find him since he can jump to 2 the night before you go to 3 and he can cycle between 3 and 4 if you wait for him.

It's frustrating when this site has shortsighted solutions or don't explain the nuances of the problem clearly.

Luke Fairbanks - 3 years, 5 months ago

Log in to reply

Luke, please see my reply to John below. Even if the frog does everything it can to dodge you, you gain enough information from your checks to pinpoint its location.

Andy Hayes - 3 years, 5 months ago

In this explanation, ? represents ponds that the frog could be in, and N represents ponds the frog can't be in. The ponds are numbered 1 through 4 from left to right. Unless there is only one ?, we will assume the biologist doesn't find the frog to account for all scenarios.

Originally, the biologist doesn't know the location of the frog, so the situation is ????

The biologist can then search pond 2, resulting in the new situation ?N??

Night passes, and the frog jumps to an adjacent pond, so any pond adjacent to a "?" becomes a "?", and all others become N; this results in the situation N???

The biologist can then search pond 3 for the frog, resulting in N?N?.

Night passes and the frog jumps; resulting in ?N?N

The biologist can then search pond 3, resulting in ?NNN

Night passes and the frog jumps, resulting in N?NN

The biologist can then search pond 2, and must find the frog, as it cannot be anywhere else.

This is really the same solution as Andy's; it's just explained differently.

Jacob Huebner - 3 years, 5 months ago

Checking the the center-left pond the second time is redundant. It gives no new info, as you can already deduce that the frog cannot be in the leftmost pond the next day, as you'd know it wasn't in the only adjacent pond the previous day

Jacob Huebner - 3 years, 5 months ago

Log in to reply

Ah, true. I'll amend my solution.

Andy Hayes - 3 years, 5 months ago

IT'S IMPOSSIBLE TO KNOW !!!!! If you have 3 ponds you can stay at the middle one and you can see the frog in max 2 days. but with 4 ponds, if you check any pond during the day and the frog change position at night, it may jump at night to the previously checked pond !!!!!! like this: Day 1: _ O _ _ Day 2: _ O _ _ Now you can be sure that the frog is not Here : X X _ _ If you change your inspection position to the next pond like that: _ _ O _ maybe the frog at night jumps to the previously checked one _ X O _ So It's Impossible to know the solution with these conditions. Sorry!!!!! i think its better for you to take more logic courses :p

Alain Raad - 3 years, 5 months ago

Log in to reply

So, which step of the solution is wrong?

Rui Xin - 3 years, 5 months ago

The key is that the frog moves to a NEIGHBORING pond each day. Therefore you can eliminate options based on where you pick.

Alex Li - 3 years, 5 months ago

i think its better for you to take more logic courses :p

Heh. Well I guess somebody should. :D

Peter Byers - 3 years, 5 months ago

No, Andy's solution is definitely good. Look at my tree diagram a couple solutions down to see all possible cases and you will discover your logical missteps and Andy's logical soundness.

Keith V - 3 years, 5 months ago

This kind of close-mindedness is the worst kind -.- It promotes the idea, that only one solution could be good, anybody else's logic is flawed. The reality, in contrast to this, that most logic problems have multiple ways of approach, and any one of them, that arrives to a correct conclusion through correct reasoning, is correct. Your reasoning is way off though: on day 2 you know the frog is not in position 1, so no reason to check there, but you could check positions 3 or 4 instead of 2, both are cases that you didn't analyse. You also didn't analyse the case where you check the first or last pond instead of one of the middle ones. You checked a single case, reasoned through it, and concluded that others are wrong and you are wrong. Maybe you should take more (any) logic courses.

József Inczefi - 3 years, 5 months ago

I realized that they can easily cross paths without seeing each other.

I tried to find a strategy but since the frog moves at night and the Biologist checks ponds at daytime it wasn‘t possible for me to find a 100% strategy.

Al En - 3 years, 5 months ago

I thought a agreed with you. But realised the answer. 22332. Frog starts in pond 4 worst case. And assuming the frog can pass you at night.

Emilio Bonfante - 3 years, 5 months ago

In the worst case scenario, when she checks to the inner-right pond, the frog was there the last day, but moved to the inner-left pond during the night. She must then check the same pond the following day, while, considering the worst case, the frog moves to the leftmost pond. If in the next day she check the inner-left pond, she will find the frog. So, there really is a strategy that guarantees she will discover the frog.

In short, the path she must follow (disregarding the symmetric case) to find the frog regardless its path is:

Day 1
_ O _ _
Day 2
_ _ O _
Day 3
_ _ O _
Day 4
_ O _ _

Patrícia Kurita - 3 years, 5 months ago

Addressing the Challenge Master's note, yes it seems to be applicable to N number of ponds. The algorithm that seems to do the job is to: 1. Never check the edges (pond 1 and N). Start with pond 2. 2. Every day shift by one pond to the right until reaching pond N-1. This will result in an alternating pattern of possible and impossible positions of the frog. 3. If the ponds are of an even number, check pond N-1 a second time (like in the solution above), to avoid checking the last pond. If the ponds are of an odd number, jump to next step. 4. Start once again with pond 2, and keep checking until the frog is found at pond N-1. 4 alt. Alternatively, for an even number of ponds, after having checked pond N-1 twice, start checking them in reverse order (N-2, N-3, ...) until the frog is found in pond 2 (with one steps less).

Кирил Панайотович - 3 years, 5 months ago

Log in to reply

You can find if from the edge by moving progressively every second day, but it takes longer (max 2N -2 days)

Donald Zacherl - 3 years, 5 months ago

Your method for N is even also works for N is odd, e.g. N is 5. _ O _ _ _ /
X _ O _ _ /
_ X _ O _ /
X _ X O X / _ X O X X / X O X X X /

Duncan Schaafsma - 3 years, 5 months ago

Since the problem does not give us any information regarding whether or not the frog can travel between the same two ponds two times, this solution does not work, because we cannot guarantee that they will move only one way until it hits an edge.

James Pritchard - 3 years, 5 months ago

She can check the same pond everyday. After a maximum of five days, she will find the frog.

sri ganesh - 3 years, 5 months ago

Log in to reply

What makes you say that? If the biologist checks the second from the left pond every day and the frog just jumps between the 2 rightmost ponds, the biologist would never find the frog.

Jacob Huebner - 3 years, 5 months ago

No. The frog does not have to visit every pond.

Donald Zacherl - 3 years, 5 months ago

The maximum number of days to find the frog is four, although she may find it on the first day.

Donald Zacherl - 3 years, 5 months ago

Stay at a pond for 4 day you eventually get the frog. 😁

Karan Rawat - 3 years, 5 months ago

Log in to reply

Nope. The frog can move between 2 ponds forever

Yash Salunke - 3 years, 5 months ago

I over-abstracted the problem by assuming that the first and last pond were "neighboring", as in modulo 4. In that case, I guess the answer would be "no".

Nick Pan - 3 years, 5 months ago

If there were 10 ponds I believe finding a strategy would be impossible. There is no way for you to determine where the dog could be positioned in the centre between the inner-right and inner-left ponds. Therefore if you were to simply assume that the frog is an even number of ponds away from you and we’re to take procedures to trap it as such it may not work. The frog could actually be an odd number of ponds away from you and end up crossing you. And if you were to try again assuming it is an odd number away it could’ve moved in that time to be an even number away and cross you yet again.

Aishi Jain - 3 years, 3 months ago

It is always possible to find the frog for N ponds.

The basic idea is to do a sweep, i.e. checking the neighbouring pond in the same direction (say left to right) every day, thus snowplowing the remaining possible positions to one side, until there are none left.

However, this sweep will only work half of the time: when the frog is in sync with us parity-wise. The frog always changes parity (odd/even pond). Our sweep does too. So if we are in anti-phase, the sweep will never find the frog, and the frog can even cross our moving barrier. But if we are in phase, we will always find it. Furthermore, we can safely skip the outermost ponds in the first and last step, since the sweep can't find frogs that are in anti-phase with our sweep anyway (and thus on the other color of the checkerboard pattern).

All what is left to do now, is a SECOND sweep, that has the opposite phasing (parity versus timing) of the first one, so we can catch frogs of that phasing too. We can realize this by doing the same sweep BACKWARDS IMMEDIATELY (if you'd restart in the same direction, a wasted temporization move would be required for N even).

Conclusion: a winning algorithm is to check the ponds in this order:

2, 3, 4, ..., N-3, N-2, N-1,

N-1, N-2, N-3, ..., 4, 3, 2.

The frog will be located in at most 2N-3 steps. One more to catch it. There is no shorter algorithm.

Manuel Ruiz - 2 years, 12 months ago
Vlad Vasilescu
Dec 18, 2017

The lazy solution would be to check the same pond every day until the frog eventually arrives there .

Moderator note:

This is mentioned in the comments, but just to be clear why this doesn't work: suppose you are checking pond #2. Then the frog could just keep jumping from 3 to 4 and back again, and you would never find the frog. We want an algorithm that works no matter what the frog's strategy is.

Well the frog could hop the whole time between the two right-most or the two left-most ponds, so it could theoritically never show up if you always look at the same pond...

Antoine G - 3 years, 5 months ago

Log in to reply

Still with luck/probability one can find the frog by looking randomly as there is no time limit in the question (no on days)

vinay koti - 3 years, 5 months ago

Log in to reply

But that isn't a guarantee. If there is a possibility that the frog is not found, no matter how small the probability, it is not guaranteed that the frog will be found.

Jacob Huebner - 3 years, 5 months ago

By looking randomly you have good chance of finding the frog - 25% on every try, if you are not taking note of where you have looked already at all. If you do, this chance varies, and you can find the frog either by pure chance or by coincidentally following the actual working algorithm to find it. However, it is neither a 100% solution, nor a fast one.

József Inczefi - 3 years, 5 months ago

You can easily prove that always checking the same pond will find a frog who moves randomly with basic properties of Markov Chains; for example, if you always check pond 3, you will find the frog with probability 1 and expected times of 1 day if it starts in pond 3, 2 days if it starts in pond 4, 4 days if it starts in pond 2, and 5 days if it starts in pond 1.

However, this solution is wrong (sadly) because nowhere in the question does it say the frog's movements are random. If you were to look in pond 3 every day, for example, you would never find a frog who had decided that it only likes to hop between ponds 1 and 2. Therefore a probabilistic approach does not apply to this problem, and the correct solutions are the logic-based ones provided by other users.

Will Webster - 3 years, 5 months ago

a solution is visiting ponds, 2,2,3,3,2 and in the worst case scenario the frog will visit 4,3,2,1,2

Meneghin Mauro - 3 years, 5 months ago

Actually it's the simplest solution.

Brian Dominguez - 3 years, 5 months ago

Log in to reply

except that it's not a solution :) it's a good example of the Gambler's Fallacy though

József Inczefi - 3 years, 5 months ago

that's what I thought at first

xgozulx . - 3 years, 5 months ago

This doesn't nessecarily always lead to the discovery of the frog

Tom Darshan - 3 years, 5 months ago

Surely you check pond 2 for 1 day, then pond 3 for 2 days (thus either discovering the frog or eliminating ponds 3 and 4) before checking pond 2 for 2 further days.

If the frog is in pond 2 on day 1, you find it. If it starts in pond 1, you will either discover it on day 3 when it jumps into pond 3, or on day 5 when it jumps back into pond 2.

David Chadderton - 3 years, 5 months ago

This assumes that the frog is moving randomly, but this isn't necessarly true. But if instead of checking the same pond every day she visits ponds randomly, with infinite days, sooner or later she will find the 🐸.

Pau Dominkovics - 3 years, 5 months ago

Checking the same pond every day won't guarantee finding the frog.

G Silb - 3 years, 5 months ago
Jeff Hunt
Dec 17, 2017

The information doesn't mention any thing regarding whether the frog travels linearly from one pond to the next nearest pond or whether it has the option to move randomly from pond to pond. I'm assuming the former and suggest that she visits the same pond each night until the frog passes by. She might get lucky and see the frog on the first night but ina any case will have to wait no longer than 4 nights if she chooses the second or third pond.

If she chooses inner left it is entirely possible that the frog only travels back and forth between the two ponds on the right side and skip the two left ponds entirely.

Francis Kong - 3 years, 5 months ago

This takes worst-case infinite time. Andy's solution has finite worst-case behaviour.

Tom V - 3 years, 5 months ago

It says that it moves to a neighboring pond

Henry Welles - 3 years, 5 months ago

Log in to reply

+1 Frog moves to a neighboring pond.

Dave Collins - 3 years, 5 months ago

You are assuming something, that is not added in the question - that means, that if your assumption is correct, your solution is correct, but if it's not, it's not. Since there is a case, that your solution doesn't cover, but according to the premise of the problem, could happen, your solution is actually completely incorrect.

József Inczefi - 3 years, 5 months ago
Keith V
Dec 18, 2017

The tree structure represents all possible pond location histories after day-1, day-2, day-3 and day-4. We can see that there is a total of 16 possible day-4 sequences. The last digit corresponds to where the frog is on day-4 and the first 3 digits to the frog’s history (see the bottom layer on the tree structure). Choosing pond 1 or pond 2 on day-1 will eliminate 5 day-4 sequences. For example, just by choosing pond 1 and missing, we can reduce day-4 to 11 possible sequences: 0101, 0121, 0123, 2101,2121,2123,2321,2323,3210,3212,3232. Right away we can see only 1 of these sequences end in pond 0, 2 of these sequences end with the frog in pond 2, 5 sequences end with the frog in pond 1, 3 sequences with the frog in pond 3. We can eliminate the possibility of pond 0 and pond 2 from being the day 4 location, simply by checking pond 3 on day-2. This leaves us with 8 possible day-4 sequences: 0101,0121,0123,2101,2121,2123,2321,2323. The day 4 sequences ending in pond 3 can be eliminated by checking pond 2 on day 3, thus leaving pond 1 as the only possibility. Follow the tree structure trail to correspond to the nice solution that Andy Hayes posted.

this should have been No.1 solution :)

Mehdi K. - 3 years, 5 months ago

Excellent Solution! Thank you!

Could you also provide me with a derivation of how you arrived at the probability function that you mentioned in your answer?

Subhankar Sett - 3 years, 5 months ago

For your free-moving interpretation, the optimal frog strategy is optimized without knowing the student's strategy, then the student specifically try to counter that. Similarly, the frog can counter this "optimal-frog-counter" strategy (with optimal-frog-counter-counter strategy?) by picking the first (or he can) and the second ponds at random, thus achieving 50% chance of never getting caught (that is, if the student doesn't change strategy). This guessing game may keep going on, and I don't know if it will reach some equibilirium.

In the other hand, I would argue the best strategy for the student without assuming anything about the frog's strategy is randomly picking a pond to search everyday like you said. She can set the equal belief of frog's location for each pond, and without any assumption about how the frog choose next pond, the belief for next day doesn't change. As with a good game of {rock, paper, scissors, pith-tool}, I expect this strategy can't be beaten by the frog, as it has the benefit that it is almost surely the student will find the frog. It may be not the quickest, but still reach 0.95 probability after 11 days, and 0.99 probability after 17 days. In fact, if the student assumes the frog choose the next pond with uniform distribution regardless of current pond, then the probability the frog will move to the searched pond is 1/3, and to other ponds is 2/9 each. So the student can "optimize" this strategy by searching the same pond again, resulting in the optimal-frog-counter strategy above. Hence, I consider that strategy a degenerate case of the "best" strategy.

Btw, I think the above formula for {rock, paper, scissors, pith-tool} game should be P(n) = 1 - 0.75^n

Le Nin - 3 years, 4 months ago
Samuel Li
Dec 18, 2017

Number the ponds 1 through 4. We will prove that checking ponds 2, 3, 3, and then 2 suffices.

Note that the frog alternates between being in even-numbered and odd-numbered ponds each day.

Say the frog starts in an even pond. The second day it will be in an odd pond. The only way the frog can evade detection is by being in pond 4 the first day (he's in an even pond and we checked 2), and pond 1 the second day. This is impossible, so he will be caught.

If the frog starts in an odd pond, then on the third day it will be in an odd pond and on the fourth day it will be in an even pond. The only way the frog can evade detection is by being in pond 1 the third day (he's in an odd pond and we checked 3), and pond 4 the fourth day. This is impossible, so he will be caught.

Patriceia Yu
Dec 23, 2017

Response to Challenge Master's Extension:

STRATEGY visit each consecutive pond for 2 starting from the second until the second last. Then starting from the third last, stay 1 day for each pond until you reach the second from the beginning, then stay in each pond for 1 day starting from the second (the second would have been stayed for two) until you reach the second last again:

(number after the semicolon stands for the pond i.e. 2 is the second pond; slash stands for a change in direction) 4 ponds: 2233/2 5 ponds: 223344/32/23 6 ponds: 22334455/432/234 7 ponds: 2233445566/5432/2345 etc

The reason why this works is because in the first direction (staying 2 days each), you let the possibility of the frog crossing (switching spaces with) you only on EVERY OTHER day. Thus limiting the frogs possible position in the ponds you passed. Then when you switch direction, you only let every other frog pass you, and corner every other frog. And the last time, because the frogs are only on every other pond, you will corner and find all the possible route of the frog.

A better way to explain this and also the means by which i came to this solution is by geometry: (across the top is the pond, down the side is the day, "X" is where the biologist is, the dot is where the frog can possibly be)

The first half of these moves (where you stay two days at each pond) has accomplished nothing after 5 days - as indicated - and can be omitted. However, the second half indeed finds the frog.

Manuel Ruiz - 2 years, 12 months ago
Marcus Lee
Dec 21, 2017

I can check the second pond for the first time so the frog can either be 1, 3 or 4. Next day I check pond 2 again to if the frog isn't here means that the frog cannot be in Pond 1 therefore it must be at pond 3 or 4.

Next day I check the pond 2 again, if frog is not there it means the frog was in Pond 3 now moving to Pond 4 or the frog was in Pond 4 now moving is in Pond 3.

Finally I check Pond 3, if the frog is not here mean the frog is in Pond 4. So I simply check Pond 3 and the frog would be there.

That's not complete. The incorrect statement of yours: "Next day I check the pond 2 again, if frog is not there it means the frog was in Pond 3 now moving to Pond 4 or the frog was in Pond 4 now moving is in Pond 3." It could be in pond 3 and that night it is going to pond 2.

Keith K - 3 years, 5 months ago
John McLachlan
Dec 19, 2017

If I were the biologist I would visit the two inner ponds alternately as the fastest method of finding the frog since visiting the outer ponds has less chance of seeing the frog. Visiting the outer ponds, the frog could be alternating between the other three and never visiting that pond. Therefore eliminating the outer ponds the frog must be seen in an inner pond eventually. The frog can't possibly cross the inner ponds without being spotted and it cannot remain in an outer pond indefinitely.

exactly my choice

Ashish Sharma - 3 years, 5 months ago

That wont work. Suppose you check Pond 2 while Frog is in Pond 3. At night the frog moves to 4, then you check 3 the following day. You alternate between 2 and 3, while the frog alternates between 3 and 4, never encountering the frog.

Mark Griswold - 3 years, 5 months ago
Stewart Gordon
Dec 22, 2017

Generalisation to n n ponds:

  • Number the ponds from 1 1 to n n .
  • First, check ponds 2 2 to n 1 n-1 in order.
  • Then, check ponds n 1 n-1 to 2 2 in order.

This gives a worst case of 2 n 2 2n-2 days to find the frog.

Why it works

First, note that each night the frog will jump from an odd-numbered pond to an even-numbered pond or vice versa.

Suppose the frog started in an even-numbered pond. Then if the first check doesn't find the frog, then the frog must be in one of the even ponds 4 \geq 4 . Therefore, on the first night the frog will jump to an odd pond 3 \geq 3 . Then we will check pond 3, and the process will continue. Note that the number of the frog's actual pond will always have the same parity as that of the pond we're searching on a given day. So when we reach pond n 1 n-1 , the frog cannot be in pond n n since it has the wrong parity, and therefore must be in pond n 1 n-1 . We've found the frog!

Suppose the frog started in an odd-numbered pond. Then the checks from ponds 2 2 to n 1 n-1 won't find the frog. At this point, n 2 n-2 checks have been made, therefore the following day the frog will have jumped n 2 n-2 times. So for odd n n , the frog will now be in an even-numbered pond; for even n n , the frog will now be in an odd-numbered pond. And so searching pond n 1 n-1 again has the possibility of finding the frog. Otherwise, we apply the same argument as before, going in the opposite direction.

Visualisation of the solution for n = 10 n = 10 : Ponds are from left to right; successive days are from top to bottom. Blue denotes the pond we're checking, and green denotes the other possible ponds the frog might be in.

Malin de Koning
Dec 19, 2017

My initial instinctive solution is this one:

Naming the ponds 1, 2, 3 and 4 from left to right.

The biologist checks pond 2 for two days in a row, then checks pond 3 for two days in a row.

This way it would take maximum four days for the biologist to find the frog.

Please comment with your thoughts on my solution :-)

right on, Malin

John Wehrung - 3 years, 5 months ago

How do you know it did not go from 4 to 3 to 2

Michael Kelley - 3 years, 5 months ago

Log in to reply

you're right, she'd need an additional day at 2.

Mehdi K. - 3 years, 5 months ago
Nathan Sheely
Dec 18, 2017

lets start with four possible frog locations labeled A,B,C and D. Start with the four potential frog locations in the four ponds ordered A.B.C.D

  • On the first day check the inner left pond, if no frog than you can eliminate B. so you have A.-.C.D
  • At night the frogs jump to a random neighbor pond creating possibilities -.A.D.C or -.A.-.C or -.D.-.C
  • On the second day check the inner left pond again, if no frog you have eliminated A and the possibility where D jumped into the inner left, on the second night the frog jumps and the possibilities are now -.-.C.D or -.D.C.- or -.-.C.-
  • Third day check inner right and you have eliminated possible frog C, third night the frogs move and you have -.-.D.- or D.-.-.-
  • Fourth day check inner right, if no frog than wait a night and the frog will be at the inner left pond on the fifth day.
Thomas Lavastida
Dec 24, 2017

Let's say there are N N ponds. We will show that there exists a strategy that finds the frog by night N N . The probabilistic method will be used, so the existence of the strategy will be proven, but the strategy will not be given explicitly. Our randomized strategy is as follows: on each night choose a pond uniformly at random from 1 1 to N N . Do this for N N nights regardless if we find the frog early on or not. Let X X be the number of times we find the frog (note that this is a random variable). Let X i X_i indicate whether or not we found the frog on night i i , i.e. X i = 1 X_i = 1 if we found the frog on night i i and 0 otherwise. Then X = X 1 + X 2 + + X N X = X_1 + X_2 + \ldots + X_N . By linearity of expectation, the expected number of times we find the frog is then E [ X ] = E [ X 1 ] + E [ X 2 ] + E [ X N ] E[X] = E[X_1] + E[X_2] + \ldots E[X_N] . For each i i , we have that E [ X i ] = P ( X i = 1 ) = 1 N E[X_i] = P(X_i = 1) = \frac{1}{N} since we choose a pond uniformly at random. Therefore, the expected number of times we find the frog is E [ X ] = N × 1 N = 1 E[X] = N \times \frac{1}{N} = 1 . Since E [ X ] = 1 E[X] = 1 , there must be a sequence of N ponds ω \omega (i.e., a strategy) such that X ( ω ) E [ X ] = 1 X(\omega) \geq E[X] = 1 .

This may not be the most elegant proof, but I'm a sucker for the probabilistic method :)

Akshita Sridhar
Dec 23, 2017

Check the same pond!It says that the frog hangs out in the pond in the day. So check the same pond everyday. Easy peasy!

If you check pond 2 every day, and the frog alternates between pond 3 and pond 4, you'll never see the frog.

Brian Egedy - 3 years, 5 months ago
L4Vo5 .
Dec 23, 2017

Yes! I remember hearing of this problem when I was like 10, except it was a princess and a castle with 4 doors, and you couldn't pick the same door in two consecutive days.

If you removed that last rule, you could do it in 4 days, with that rule, it took you 5.

I remember even generalizing a solution!

Basically, the key is to think of it as if the frog starts in all of the ponds simultaneously, you can think of them as being "lit up", and when you check one, you turn it off. Every day, all ponds are lit up only if they have one adjacent pond lit up. If you find a strategy to make sure they're all turned off, you win, because it means you checked every possible move the frog could've made.

Something to note is that the parity of the position of the frog changes every day: if one day it's on an even pond, the next day it must move to an uneven one. This basically divides the problem into two equal parts: the one where the frog starts on an even position, and the one where it starts on an uneven one. With this, if you manage to solve one of these parts, you'll for sure be able to solve the other one.

To solve any of these parts: check in a pond that's adjacent to a corner, this will make it so that in the next turn, when the parity changes, the frog can be in any place of that same parity, except the corner one that you checked. Now choose the third pond from the corner (that is lit up not because it was adjacent to the previous second from the corner, because you turned that one off, but because it was adjacent to the fourth from the corner) and keep going like this, working your way to the other side, until you get completely rid of that parity group. Now repeat for the other one.

Fatih Kır
Dec 23, 2017

check each pond twice: let's say the frog is in the 4th pond and the biologist started to check ponds at the first one today. İf the biologist checks the first pond tomorrow and then go for the second and checks it in the following day and so on...even the frog moves from #4 to #3 then #3 to #4 everyday or moves like 4-3-2-1 it will be found in the end.

Alon Shikar
Dec 23, 2017

She needs to start from one side, if she got lucky great. If not, she need to visit it again. If she got lucky great. If not she need to visit the nearest pond, which she will need to visit one more time. Than again, If she got lucky great. If not she need to visit the nearest pond, which she will need to visit one more time. Eventually she will get across the rare frog.

Frank Berger
Dec 23, 2017

Assigning numbers 1 to 4 to the four ponds, from left to right, 1 - 2 - 2 - 3 - 3 - 2 will ensure finding the frog.

Disha Rathore
Dec 22, 2017

She can stay at same pond until the frog come there

Jatin Sharma
Dec 22, 2017

If she checks the number 2 pond everyday, she'll find the frog in 3 days in worst case.

Unless the frog only visits ponds 3 and 4.

Brian Egedy - 3 years, 5 months ago
Mr J
Dec 22, 2017

My thinking is that the biologist could stay in 1 pond for 4 days and eventually the frog would come

Randal Gentillon
Dec 22, 2017

Label Ponds 1 to 4 left to right. Check pond 2. If frog not found then the next night check pond 3. No frog? Then he is in either 2 or 4. He either moved from 1or 3 to 2, or he moved from 3 to 4. Check 3 again. No frog? He was in 2 is now in 1 will be in 2 again tomorrow.

William Clark
Dec 22, 2017

1,2,2,3,3,2.

Tim Elschner
Dec 22, 2017

I have a question (An sorry if it contains flawed logic please englighten me): I am stronlgy the opinion that the stated conditions are missing an important information. To my idea I cannot create a strategy because it remains unclear if the overlap between moving at night an checking during daytime creats an oberservation blind spot. Meaning: when she can only check 1 pond during daytime an the result is false but the frogs moves during night to exatly the spot she is waiting. Will she have to spend another check on the pond she is already sitting on or would this be an automatic win? If this is NOT the case then to my thinking it is impossible by logic to find the frog because there is a chance that she is always missing it because the frog could move just random jump between the positions during night, while she was always having "bad luck" doing the check. So she has to pick random positions. Eventually on every iterations here chances to get lucky increases but because of the missing options to doublecheck there is no strategy. Please correct me! Thanks Tim

I found a winning solution to be: 4 - 2 - 2 - 3 - 3 - 2. This combination will always find the frog.

Just check the first pond in the morning and the fourth in the night... If the frog isnt in the first at morning ans not in the fourth at night, he must ne in the third at night.

Keith K
Dec 21, 2017

A full proof solution would be to check pond 2 twice, then pond 3 twice, then check pond 2 again. It may not be the quickest solution, but it is simple. I will explain each check and what it establishes assuming the frog is not caught in the check.

  • Check pond 2
    • The frog did not start in pond 2.
  • Check pond 2 again
    • The frog did not start in pond 1 since it would've had to move 1->2.
  • Check pond 3
    • The frog did not start in pond 3 because it made 2 moves so far and if it was 3->2 it would've been found during the 2nd check. So its 3 moves would have had to be 3->4->3. And since it is not found, The frog had to start in pond 4.
  • Check pond 3 again
    • Checking pond 3 again ensures that the frogs path could not be 4->3->4->3 and it could not be 4->3->2->3. So, the only possibility left is 4->3->2->1. And so after this check it has to move back to 2. So checking pond 2 again will find the frog.

Does not work. If you do 2233..., the frog can cross your sweepline by doing 4321...

Manuel Ruiz - 2 years, 12 months ago
Shubham Sadhwani
Dec 21, 2017

We will first check the last pond on the right, Hence there is probability of 1/4 for finding the frog there and 3/4 for not finding it. Now if we don't find it there then it must have been somewhere in the other three ponds. Now we check in the second pond from left . If we do not find the frog there then it is obvious that it has gone to the last pond on the right as if it would be/go in the neighbouring ponds then it would get caught . Hence it is necessarily in the last pond on the right . Answer in two steps.

Thierry Adloff
Dec 19, 2017

I suppose that the biologist come to check during the day, so no way to see the frog during the night, I.E. seeing the frog during the change. I found a solution in maximum 5 days. If the biologist check the 2nd pond the first 2 days, he or she will find the frog if located in pond 1 or 2 the first day. Obviously the first day if frog starts in pond 2, the second day if frog starts in pond 1, as the frog has to move from pond 1 to pond 2 the first night. If frog has not been found at the end of day 2, that's mean frog was in pond 3 or 4 the first day.

If the frog starts in pond 3, it moves to pond 2 or 4 the second day. If it selects pond 2 it will be find by biologist the day 2. If move to pond 4, it will be back in pond 3 the day 3 where the bilogist has to stay this day 3.

Worst case is if frog start in pond 4, as when biologist change from pond 2 to 3 the 3rd day, frog could be located now on the left side. A short tree case will be easier to explain: In a conclusion, biologist has to stay in pond 2 the first 2 days ,then check pond 3 for day 3 and 4 and back to pond 2 the 5th day if not found before.

David Keadle
Dec 18, 2017

Start by checking the left center twice in a row, then the right center twice in a row, then back to left center. You will have caught the frog somewhere in that sequence. Try it and see.....

Correct, but you can omit the first step.

Manuel Ruiz - 2 years, 12 months ago
Ilya Prokin
Dec 18, 2017

If we need just a stratagy (not necessary optimal). It's easy. Let's first idealize. If frog trajectory goes through all ponds, check the same pond for a long time (possibly infinitelly long) till you find the frog. If frog moves randomly (all available directions are equally likely), we can check one of the two central locations as they are more likely. Now, let's make it worse for this strategy. The frog can be jumping between neighbouring ponds, let's say 3 and 4. If we are checking pond 2, we will never find it. Listing all possibilities: the frog can be looping between 1 and 2, 2 and 3, 3 and 4. In all cases, it should be present from time to time in either 2 or 3 (central locations). So we can check randomly either 2 or 3 till we find it. We are done.

Since we do not know the sequence of movements for the frog, lets us start at one of the inner ponds. We stay at this pond for 2 days. If we do not see it on the second day, we know it is not in the associated outer. Let us label ponds A B C D. we start at B (as one choice, we could have started at C). After 2 days, if we have not found it in B, we know that it is in C or D.

If we then change to C the following day, and we still have not found it, the frog can now only be in B or D. If we wait at C for another day and the frog hasn't turned up., we know that it will be in pond A. So we then look at B again and we will find it. It will take a maximum of 5 days to find the frog

Bruce Rennie - 3 years, 5 months ago

Log in to reply

Correct solution, but you can skip the first step.

Manuel Ruiz - 2 years, 12 months ago

No. You literally jumped to conclusions. There are infinitely many biologist sequences containing only 2 and 3, that the frog can still evade. Example: Biologist and frog:

232323232323232223232333232322...

123432123234343432121212323234...

Manuel Ruiz - 2 years, 12 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...