# 3 Ants and Triangle Problem

By | August 7, 2017

This is a famous Interview Puzzle and one of the most easiest once too.

Three ants [A,B,C] are sitting at the three corners of an equilateral triangle. Each ant starts randomly picks a direction and starts to move along the edge of the triangle. What is the probability that none of the ants collide?

Well, take pen and paper and try to solve the solution.

You should be able to get it with just some basic Maths probability and basic logic. ðŸ˜‰

Once you are ready check the Solution below:

Puzzle Solution:

Approach 1:

Lets think this through.

The ants can only avoid a collision if they all decide to move in the same direction (either clockwise or anti-clockwise). If the ants do not pick the same direction, there will definitely be a collision. Each ant has the option to either move clockwise or anti-clockwise. There is a one in two chance that an ant decides to pick a particular direction. Using simple probability calculations, we can determine the probability of no collision.

P(No collision) = P(All ants go in a clockwise direction) + P( All ants go in an anti-clockwise direction)Â = 0.5 * 0.5 * 0.5 + 0.5 * 0.5 * 0.5 =Â 0.25

Approach 2:

Three Ants:
0â€“>clockwise
1â€“>Anticlockwise
All combinations will be :

A B C

0 0 0 [No collision]
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1 [No collision]

Probability = 2/8=0.25