Artificial intelligent assistant

Polygonal line in a square > A polygonal line of the length $1001$ is given in a unit square. Prove that there exists a line parallel to one of the sides of the square that meets the polygonal line in at least $500$ points. My try : I haven't done much. I tried to take a very small part of the polygonal line of length $t$, and consider its horizontal component $x$, vertical component $y$, then I haven't done anything more from here. Any help is welcomed. Thanks a lot.

Assume no segment in the polygonal line is vertical or horizontal, else the problem is trivial. Let $f(u)$ be the number of points of the polygonal line on the segment $x=u$; let $g(v)$ be the number of points of the polygonal line on the segment $y=v$. You should be able to get the lower bound $$ \int_0^1 f(u)\,du + \int_0^1 g(v)\,dv > 1001 $$ by considering the contribution from a given segment of the polygonal line to both integrals. This means there is either a $u$ for which $f(u)>1001/2$ or a $v$ for which $g(v)>1001/2$. So indeed you get $501$ points, not just $500$.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e2be4923db098f1938c4f476882e40c2