Dense landmines on a unit square - One unoriginal and one original problem (I think) Earlier today I shared problem 1 with my friends and after solving it with relative ease, one of them asked if a modified version of the problem had a similar solution. For the next hour we worked until we finally came up with a solution that I'd would like to share with the people of stack exchange now. So first we introduce the problems:
Problem 1 (easy)
Consider a unit square $[0,1]\times[0,1]$. I place a landmine at every point with rational coordinates e.g. $(a,b)$ for $a,b\in\mathbb{Q}$. Can you find a continuous path in the square from $(0,0)$ to $(1,1)$ that does not pass through any mine?
Problem 2 (hard)
Consider a unit square $[0,1]\times[0,1]$. I place a landmine at every point with irrational coordinates e.g. $(a,b)$ for $a,b\in\mathbb{R}/\mathbb{Q}$ as well as on the boundaries of the square except $(0,0)$ and $(1,1)$. Can you find a continuous path in the square from $(0,0)$ to $(1,1)$ that does not pass through any mine?
Please give both these problems a try before viewing my solutions as I think that both have very interesting solutions.
 A: Solution 1
This might seem hopeless at first. After all the rationals are dense in the reals, so anywhere you step on this landmine puts you arbitrarily close to a mine. However you remember that there are also many many more irrationals than there are rationals. To find a simple solution choose your favorite irrational $a\in(0,1)$. Consider the line segments from $(0,0)$ to $(a,1-a)$ and $(a,1-a)$ to $(1,1)$ the gradient of this first line is $1/a - 1$ which must also be irrational, hence it doesn't pass through any mines. Similarly the second segment doesn't pass through any mines and the point $(a,1-a)$ doesn't contain a mine. Hence we are done!


The truly remarkable thing about this first problem is when you realize that almost every line segment will not hit any mines. There are an uncountable number of irrational gradients and compared to a countable number of rational gradients. So the solution shown above with "random" gradients (given infinite drawing precision) is also probably a solution.
Solution 2
This one seems much more challenging. I won't spoil the solution immediately because I think the motivation we had towards the solution tells a richer story than just seeing the solution immediately. All of our instincts first led us to the conclusion that it must be impossible. So we began by assuming we had a solution a curve which we will denote by $S$ e.g. $S$ is the set of points in our path.
Now consider what if S is strictly increasing. Well then we can show a contradiction. Take any point $(a,b)\in S$ and label them as such. If $a\in\mathbb{Q}$ then label the point $P_a$ otherwise if $a\in\mathbb{R}/\mathbb{Q}$ then we know $b\in\mathbb{Q}$ so label it $Q_b$. Since we   wanted $S$ to be strictly increasing we know each label must be unique, hence we can label the uncountable number of points in $S$ with the countable set of $\{P_a\}\cup\{Q_b\}$ without repeats, a contradiction. Hence we conclude that if any solution did exist it would have to by non-increasing (and similarly non-decreasing) at every point.
Next we ask if there is some way to connect arbitrary mineless points on the square. If we have two points one with a rational $x$-coordinate and one with a rational $y$ coordinate, we could simply travel across the horizontal and vertical line segments with said $x$ and $y$ coordinates. The only problem is that for the start and end points $(0,0)$ and $(1,1)$ we cannot travel across the boundary as specified by the problem description.

It seems as though if we are able to escape from the origin, we will be able to make it safely to our goal using this rational jumping trick. But how do we do this? We know that any increasing or decreasing point in our path will immediately render it invalid, so our curve must be differentiable nowhere except for when it is constant with respect to either coordinate (horizontal or vertical). At this point you might consider something like the dreaded Weierstrass function (and so did we :) ) as it is the textbook example of an everywhere continuous nowhere differentiable function. But then we had a brilliant idea, consider the straight line segment from  $(0,0)$ to $(1,1)$. Clearly this hits an uncountable number of mines, but what if you were also able to "dodge" every mine along the way using this rational jumping trick.
Here I am reminded of the construction of the Cantor set by removing the middle third of every interval at every step. Now we do a similar trick. Let's replace the middle segment of our straight line solution with one of these rational jumps.


You can see that if we keep repeating this the only remaining points of the initial line are rational and these are all connected by these jumps so indeed this is a solution! I find it amazing that even though there are uncountable mines blocking our path somehow we can traverse it safely. I gave this problem to another friend and he managed to come up with another solution that is arguably more elegant where the rational points on the diagonal are powers of $2$ less than or equal to $1/2$ e.g. $(1/2,1/2),(1/4,1/4),(1/8,1/8),\dots$ and then simply rotate this around the center of the square  to get the other half.

