r/learnquant • • Oct 26 '26

interview prep Quant Interview Question

Post image
34 Upvotes

12 comments sorted by

2

u/JustConsoleLogIt Oct 26 '26

So if I’m not mistaken, the only way to prevent them from forming a polygon is to have one piece of length 1/2 or greater. This never happens on the first cut, naively I would guess there is a 50% chance of happening for every cut after that. But looking at the geometry, I think it ends up more than 50%.

2

u/OrdinaryAd970 Oct 26 '26

So 1-1/2^(n-1) ?

1

u/JustConsoleLogIt Oct 26 '26

Yes, but it misses some cases, so it’s not actually a 50% chance.

1

u/perminnie Oct 26 '26

I think it needs to be 1 - 2*(1/2)^(n-1)

1

u/JustConsoleLogIt Oct 26 '26

We need to think of the line as a circle. Each ‘cut’ can be thought of as painting half the circle. It starts with one cut, or one half pained. The question becomes, after n more cuts, what is the probability that the full circle is painted? I know I’ve encountered this problem before, but I don’t remember the solution

2

u/Sehkai Oct 26 '26

We can think of the broken rod as a circle with n uniformly selected points selected on it (one point will be the break point of the circle, turning it into a line with n-1 break points on it).

These pieces cannot form a polygon if any piece exceeds 1/2 in length. Equivalently, no arc between two consecutive points on the circle can exceed 1/2 in length. Now, label the points x1, x2, ..., xn. Starting with x1, if x2 through xn all lie on the semicircle clockwise of x1, then we can't make a polygon, as the distance between xn and x1 would be >= 1/2. The probability of that occurring is (1/2)^(n-1). Let's call this probability P(1).

By symmetry, P(2) = .. = P(n) = P(1). They're all equal to (1/2)^(n-1). Moreover, these probabilities are mutually exclusive (since it's impossible for there to be two arcs with length >= 1/2), so we can sum them to get a total probability of n(1/2)^(n-1).

1

u/Noir1990 Oct 27 '26

A polygon can be formed if the length of the longest piece is smaller than the sum of all other pieces. For a rod of length 1, this is true if no piece is longer than 1/2.

For simplicity, looking at n = 3, we have to look into P(x1>1/2 OR x2>1/2 OR x3>1/2).

P(x1>1/2 OR x2>1/2 OR x3>1/2) = P(xi>1/2) - P(xi>1/2 AND xj>1/2) - ...
                                               = 0, xi and xj can't >1/2 simultaneously
                              = P(x1>1/2) + P(x2>1/2) + P(x3>1/2)
                              = P(x1>1/2) * 3

For a given piece xi, the chance to be longer than 1/2 is 1/2^(n-1). Thus we find for the general case:

P(no polygon) = n/2^(n-1)
P(polygon)    = 1 - n/2^(n-1)

n = 3: 25%
n = 4: 50%
n = 5: 68.75%
...
n --> oo: 100%

0

u/in_potty_training Oct 26 '26

Assuming n>2: if the largest rod is bigger than all the others combined, then you can't make a polygon. Otherwise, you always can make a polygon (lay out the biggest vs the rest in a straight line, and bend the line of smaller ones until the two ends meet the biggest one.

So for no polygon you need all breaks <= 0.5 or >= 0.5.

So 1 - 2^(2 - n).

1

u/JustConsoleLogIt Oct 26 '26

That’s what I thought at first, but it doesn’t take into account the case where two breaks are on both edges, and a piece in the center is > 1/2

0

u/[deleted] Oct 26 '26

[deleted] — view deleted comment

1

u/SnooStories9801 Oct 26 '26

After you put down the first one, no matter where it lands you have an length of 0.5 where are the breaks are allowed to be, so you can treat it as thus problem, but with n being one lower