<s>[INST] What is the likelihood of two line segments crossing? Consider a square space.
Randomly select 4 points.
Randomly connect two sets of two to each other with line segments.

What is the chance of the line segments intersecting?
(I will maybe try and solve this with a little Monte-Carlo simulation but would be very interested in an analytic solution.)
 [/INST] This is my approach:
Consider a line $y=mx+c$ that divides the unit square into two trapeziums. Let us call the left trapezoid $a$, and the right trapezoid $b$.

By solving the equations $(y=mx+c)=1$ and $(y=mx+c)=0$, or $mx+c=1$ and $mx+c=0$, the $x$-values of the intersections are $x = \frac{-c+1}{m}$, and $\frac{-c}{m}$. Since the $y$-values are $0$ and $1$, the intersection coordinates are $(\frac{-c}{m}, 0)$ and $(\frac{-c+1}{m}, 1)$.  
Using this information, the area of trapezium $a$ is $1 * \frac{(-c/m+1)+(-c/m)}{2}$, and of $b$ is $1 - (1 * \frac{(-c/m+1)+(-c/m)}{2})$ (since $a+b=1$). Simplifying gives the area of $a$ as $-\frac{c}{m}+ \frac{1}{2}$, and the area of $b$ as $\frac{c}{m}+\frac{1}{2}$.
For the line connecting two points to not cross the green line, the points cannot be in $a$ and $b$. Since using geometric probability, the probability of this is $ab-ba$, we can subtract this condition from $1$ to get $1 - 2(-\frac{c}{m}+ \frac{1}{2})(\frac{c}{m}+\frac{1}{2})$, and after simplifying we have the probability as $1 - 2(-\frac{c^2}{m^2}+\frac{1}{4})$ or $$\frac{2c^2}{m^2}+\frac{1}{2},$$
where $c$ is the $y$-intercept of the line (when extended), and $m$ is its slope.
Note: This example doesn't work when $c=0$, because regardless of what $m$ is chosen, it would equal $0+\frac{1}{2}=\frac{1}{2}$, and when the line crosses a point not between $0$ and $1$ when $x=0$ or $x=1$.
</s>