
Connectedness puzzle
Here's a puzzle I mentioned in another thread but it might be of interest here. I came up with it many years ago based on a math article I had read.
Find two sets, P and Q satisfying the following:
1) They are both subsets of the square in defined by
and
2) P contains the diagonally opposite points (1, 1) and (1, 1) while Q contains the diagonally opposite points (1, 1) and (1, 1).
3) P and Q are both connected sets.
4) P and Q are disjoint.
The key is that while P and Q are required to be connected, they cannot be pathconnected.

Nice problem! I didn't think that was possible at first, but then I came up with this idea. For convenience in writing the formulas, it works on the unit square rather than on the square from –1 to 1.
Let P consist of the graph of the function together with the line segment from to , and let Q consist of the graph of the function together with the line segments from to and from to . Then P and Q are disjoint, connected (but not pathconnected), P contains (0,1) and (1,0), and Q contains (0,0) and (1,1).

Basically, yes, though my solution uses sin(1/x) rather than cosine but is basically the same as yours. I'm impressed! I am sure I spent much longer working it out than you did! (But not surprised. You may have noticed that I seldom respond to any question you have already answered you have already said it much better than I could!)
Let A be the straight line from (1, 1) to (0, 1/2), let (the ".05" is to shift it downward slightly and the ".9" is to make sure that, even shifted, it stays above y= 1), and let C be the line from to (1, 1). Let .
Let X be the straight line from (1, 1) to (0, 1/2), let (the "0.5} is to shift it upward slightly and the ".9" is to make sure that, even shifted, it stays below y= 1), and let Z be the line from to (1, 1). Let .
It is easy to see that P and Q satisfy (1) and (2) of the requirements. It is also easy to see that they satisfy (4). For every x, the corresponding y of one set is different from the corresponding y in the other set.
Each is clearly made up of three connected sets and two of those sets overlap at and for P and Q, respectively. Finally, the closures of B and Y include an interval of the y axis that intersects A and X.