# gpt-4 stuck on probability problem (part 2?)

Continue from part 1, I input

“revise: I spent some fun (and frustration) with gpt-4 for an hour. For your information, the correct answer should be 1/9 and 11/18. When randomly breaking into pieces. There is a nice formula that the expected length of the k-th shortest piece is . gpt-4 cannot get the correct length even for the shortest piece. But the approach is correct. At the beginning, it seems to keep insisting its incorrect answer 1/4. And eventually it gave up, but it throws solutions that apparently violates it original assumption (x<y). And at one point, I commented that its specified region is incorrect, but it just repeated its incorrect region. Maybe I was not specific enough and it misunderstood.”

thinking to let gpt-4 to revise my English for my previous post. Instead, it output

Thank you for your feedback and for sharing the correct answer and formula. I apologize for the confusion and frustration that my earlier responses may have caused. Your insights will help improve the model’s understanding and performance in similar problems.

It is important to note that the ChatGPT model, like any AI model, has its limitations and might not always provide the correct answers. We appreciate your patience and understanding as we strive to improve the model.

The correct answer, as you mentioned, is 1/9 and 11/18 for the average lengths of the shortest and longest pieces, respectively. The formula you provided for the expected length of the k-th shortest piece when randomly breaking into n pieces is a valuable insight: .

### User: given the correct minimum length of 1/9, can you try to rewrite the solution again?

Given that the correct average length of the shortest piece is 1/9, let’s revisit the solution for the problem.

When a 1-meter stick is broken randomly at two places, we have three segments with lengths x, y-x, and 1-y, where 0 < x < y < 1.

We need to find the expected value E[Z_min], where Z_min is the length of the shortest piece. To do this, we will calculate the integral of the probability density function for each possible ordering of the segments and then sum them up.

Case 1) x < y-x < 1-y In this case, we have 0 < x < y < 1/2. The integral for this case is: ∬ x * f_{X,Y}(x,y) dx dy, with integration limits x from 0 to y and y from 2x to 1/2.

Case 2) x < 1-y < y-x In this case, we have 1/3 < x < y < 2/3. The integral for this case is: ∬ x * f_{X,Y}(x,y) dx dy, with integration limits x from 1/3 to y and y from 1/3 to 2/3.

The sum of these integrals will give us the expected value of the minimum length:

E[Z_min] = Integral_Case_1 + Integral_Case_2

After solving these integrals, we find that E[Z_min] = 1/9, which is approximately 0.1111 meters. This is the average length of the shortest piece when a 1-meter stick is broken randomly at two places.

Its solution is still incorrect. It seems that it just randomly making up things now.
Next, I tried to ask the same question but with a double length:

### User: A two meter stick is broken at random in two places. What are the average lengths the shortest and the longest pieces?

When a 2-meter stick is broken randomly at two places, we have three segments with lengths x, y-x, and 2-y, where 0 < x < y < 2.

We need to find the expected value E[Z_min] for the shortest piece and E[Z_max] for the longest piece, where Z_min and Z_max are the lengths of the shortest and longest pieces, respectively. To do this, we will calculate the integral of the probability density function for each possible ordering of the segments and then sum them up.

Case 1) x < y-x < 2-y In this case, we have 0 < x < y < 1. The integral for this case is: ∬ x * f_{X,Y}(x,y) dx dy, with integration limits x from 0 to y and y from 2x to 1.

Case 2) x < 2-y < y-x In this case, we have 2/3 < x < y < 4/3. The integral for this case is: ∬ x * f_{X,Y}(x,y) dx dy, with integration limits x from 2/3 to y and y from 2/3 to 4/3.

The sum of these integrals will give us the expected value of the minimum length:

E[Z_min] = Integral_Case_1 + Integral_Case_2

After solving these integrals, we find that E[Z_min] = 2/9, which is approximately 0.2222 meters. This is the average length of the shortest piece when a 2-meter stick is broken randomly at two places.

Now, to find the average length of the longest piece, we can use the following observation: the sum of the average lengths of the shortest, middle, and longest pieces must equal the total length of the stick (2 meters). Since we already found the average length of the shortest piece and we know that the average length of the middle piece is the same due to symmetry, we can calculate the average length of the longest piece as follows:

E[Z_max] = Total Length – 2 * E[Z_min] = 2 – 2 * (2/9) = 10/9, which is approximately 1.1111 meters.

So, the average length of the longest piece when a 2-meter stick is broken randomly at two places is approximately 1.1111 meters.

For the shortest one, the “answer” is correct given what I said earlier. But the steps appear to be trash. For the longest one, even the answer is incorrect. It should 11/9 instead.

And as I repeat the same question with a different session, it reiterates the wrong answer (1/4 of the length of the stick as the shortest length) again. And it answers wrong with the longest one also. Moreover, it seems to lack the common sense (or intuition?) that the longest and shortest piece should not have the same length on average.

To find the average lengths of the shortest and longest pieces, we can use the concept of expected value. We know that a two-meter stick is broken at random in two places. Let’s represent the break points by X and Y, where X and Y are uniformly distributed random variables on the interval [0, 2]. We will then have three pieces, with lengths X, Y-X, and 2-Y.

The shortest piece will be min(X, Y-X, 2-Y), and the longest piece will be max(X, Y-X, 2-Y). We want to find the expected values of these functions. To do this, we will integrate over the region where X and Y are both between 0 and 2, which is the unit square. We will use double integration to find these expected values.

Expected value of the shortest piece:

E[min(X, Y-X, 2-Y)] = ∫∫min(X, Y-X, 2-Y) dx dy over the unit square

For the region where Y < X and Y < 2-X, the shortest piece is Y. For the region where X < Y and X < 2-Y, the shortest piece is X. For the region where 2-Y < X and 2-Y < Y, the shortest piece is 2-Y. We will integrate over these three regions separately and sum them up.

E[min(X, Y-X, 2-Y)] = ∫∫Y dx dy + ∫∫X dx dy + ∫∫(2-Y) dx dy

E[min(X, Y-X, 2-Y)] = 1/6 + 1/6 + 1/6 = 1/2

Thus, the expected length of the shortest piece is 1/2 meters.

Expected value of the longest piece:

E[max(X, Y-X, 2-Y)] = 2 – E[max(min(X, Y-X, 2-Y), min(X, 2-Y, Y-X), min(2-Y, Y-X, X))]

We already found that E[min(X, Y-X, 2-Y)] = 1/2, and by symmetry, the other two expected values are also 1/2. Therefore:

E[max(X, Y-X, 2-Y)] = 2 – (1/2 + 1/2 + 1/2) = 1/2

Thus, the expected length of the longest piece is also 1/2 meters.