# What is the probability of two random line segments crossing in a unit square?

For the purposes of this question a random line segment is defined by connecting two random points inside the unit square, where a random point is found by generating two random numbers between 0 and 1, and taking them as the x and y co-ordinates. What is the probability of two such randomly generated line segments crossing?

• If I'm understanding the problem right, you want line segments instead of lines. Otherwise I'm inclined to believe the probability of intersection (= probability of two lines having different slopes) is 1. Commented Jul 1, 2015 at 0:46
• I'm thinking that the lines can be extended but the point of intersection must be inside the unit square
– WW1
Commented Jul 1, 2015 at 0:58
• If it's any consolation, 500,000 simulations showed it happens with probability 0.660. Commented Jul 1, 2015 at 1:02

First decide whether you mean the line segments only, or the whole lines through the two points. Then the following method should lead you to the answer:

Generate four points at random. There are three ways to pair those points together, and the probability that the lines/line segments intersect will be $0$ or $\frac13$ or $\frac23$ or $1$, depending on whether the four points form a convex quadrilateral or a triangle with a fourth point in its interior.

So the overall probability can be deduced once you know the probability that four randomly chosen points from the unit square form a convex quadrilateral (or a triangle with a point inside). Not a trivial probability problem but I think it is known.

The answer appears to be 133/432 = approx 0.308.

If the four points form a convex quadrilateral, there is a 1/3 chance of the two line segments crossing. This is because, out of 3 possible pairings, the only one in which the line segments cross is one in which the diagonals of the quadrilateral are drawn.

The probability of four randomly chosen points forming a convex quadrilateral is equal to the chance of the fourth randomly chosen point falling outside the triangle that the first three points establish. This probability is basically the area outside of the triangle. Since the area of a randomly constructed triangle is 11/144 (see The expected area of a triangle formed by three points randomly chosen from the unit square), the area outside the triangle is 133/144.

Hence the desired probability is 1/3 * 133/144 = 133/432.