I found out something interesting today. About myself as well as about an interesting maths problem. It turns out I’m slightly suspicious about maths problems in general when it comes to exact solvability. Whenever I get a problem under my nose, apparently I immediately adopt the attitude that there’s probably no exact solution. I think this is a consequence of my field, numerical analysis and scientific computing. My work focuses mainly on problems that are solvable, though not necessarily by exact means.
Interestingly, I once heard someone say that if you were to take a maths problem at random, the probability that it’s solvable is zero. Moreover, if you just restrict yourself to the problems that are solvable and you pick one at random, the probability that it’s exactly solvable is again zero. Imagine my surprise when I encountered a problem out of the blue that is exactly solvable. Imagine my joy when I actually solved it!
A square in a square?
The problem is as follows: consider a square with vertices and . Next, copy the square and rotate it by an arbitrary angle . Now shrink the copied square until the vertices are on the edges of the original square. The smaller rotated square I will call an inner square. What is the shape of the intersection of all possible inner squares?
At first, you might think it’s a circle, which would be true if the original square was just rotated. However, we have to keep in mind that the inner square changes size as well as orientation as it’s rotated. Fortunately, since it’s two-dimensional problem, we can simply make a sketch or write a Matlab program to draw some examples. Here’s a plot of 100 different such inner squares at evenly distributed rotations. As you can see, the inner figure is something of a rounded square.
Based on the plot, I first thought the rounded square consisted of four circular arcs. However, if you plot these together in the same figure, see below, you’ll quickly realise that this is not the case. It’s definitely similar to the actual figure, but not quite there. In fact, it’s rather a long ways away from the true answer.
Alright, let’s find the actual shape of the intersection of the inner squares. To do this, we’re gonna need a neat little result: the intersection of any number of convex sets is itself a convex set. Based on the figure, we can see that the boundary of the intersection is going to be piecewise smooth. Convex curves have the nice property that any tangent line is completely on one side of the curve, discounting the intersection point, which is on the curve. We can therefore conclude that any edge of an inner square will be a tangent line to the shape we’re looking for, which will intersect the boundary only at a single point. So far so good.
Next, we should realise that if we take two inner squares whose angles are very close together, then the intersection points of their edges is going to be very close to the boundary curve. The closer the two angles are, the closer the intersection points are going to be to the curve. In the figure, this is apparent from the fact that the meshing becomes more dense closer to the boundary. This is really all we need to find the boundary curve, at least in principle. Taking the limit of the two angles approaching each other results in a boundary point.
We now have a programme to calculate the boundary curve: first, figure out what an edge for an arbitrary inner square looks like; second, take two edges of inner squares with a small difference in angles and find the intersection point; third, take the limit of vanishing angular difference.
Living on the edge
Step 1 is to find out what the edges of an inner square look like. To do so, we’re gonna need a bit of trigonometry. Below I’ve made a sketch of an arbitrary inner square with angle . I’ve marked two of the angles and three line segments. First, the edge of the inner square has length ; second, the longer side of the original square as divided by the point where the inner square touches the bigger one is a line segment with length ; third, the shorter side has length .We’re looking to express in terms of , while we know that is the length of an edge of the original square. Now comes the trigonometry bit: the cosine of is going to be , while the sine is going to be . Since , it is the case that
, or .
Next, we know that the inner square is a copy of the original square, but rotated. A rotation in the plane can be represented by a rotation matrix
Multiplying the vertices of the original square by this matrix results in a rotated square. For instance, the vertex becomes . After the rotation, we need to scale the rotated square to make sure the edges have the correct length . The edges after rotation have length , so we need to divide by , so that the upper right vertex becomes
We can further simplify this expression by employing some elementary complex analysis, in particular Euler’s identity. If we work out
we see that the real part involves the numerator of , while the imaginary part involves the denominator. On the other hand, if we work out the answer in the complex plane a little further, we have
Using Euler’s identity again, we’re able to see that and . We can then simplify to read
It turns out that is going to be the crucial quantity, and we can express the whole shape in terms of . But I’m getting ahead of myself. Incidentally, the bottom right vertex of the rotated triangle is .
I find it beautiful that the mathematics works itself out so nicely. Of course the -coordinate of the upper right vertex had to come out as 1, that’s how we defined the inner squares. In fact, we can use it as a sanity check. If it had come out otherwise, I’d probably guessed I’d made a mistake somewhere. Anyway, now that we have two vertices, we can get on with our plan. The other vertices and pieces of the boundary curve can be found by rotation through .
An edge of a square is a straight line connecting two vertices. No miracles there, but that means we can find the line segment in terms of Cartesian coordinates. We know the line segment runs from to , so the line segment satisfies
A good sanity check is always to make sure the correct -values come out when you put in the -values of the endpoints. So no we’ve completed step 1, we know what an edge of an arbitrary inner square looks like, given .
Step 2 was to take two corresponding edges of inner squares with a small angular difference and find their intersection point. To simplify matters a little bit, I’ll first introduce a shorthand for the slope:
Then, our programme tells us that we should find the intersection point between two corresponding edges with a small angular difference. I’ll denote this difference as , as we already know we’re supposed to take a limit later. Since we have the Cartesian form of the line segments, we can simply equate
The 1 cancels on both sides and we end up with
This looks an awful lot like some sort of derivative!
This brings us squarely to step 3, taking a limit. Here we should recognise that taking the limit of vanishing leads to differentials. To find the differential of , we have to use the chain rule:
The differential of is found using the product rule
In the expression for , the differential of cancels and we end up with
According to our reasoning earlier, this is the -coordinate of a point on the curve we’re looking for. Let’s calculate the derivative of with respect to , which is given by
This allows us to express purely in terms of :
which simplifies all the way down to
As this is the intersection point between two edges with vanishing angular difference, we can find the -coordinate by plugging it back into the expression we found for the line segment:
Here, we can simplify the expression by realising that . The -component finally comes out as
These expressions are valid for the upper right boundary curve, and the other ones can be found simply by rotation through . This gives the curve we’re looking for parametrised by the rotation angle . This is sufficient, since we can now plot it. After all, we know the angular range should be . After a rotation by , the inner square is once again identical to the original square.
To give a complete picture, let’s also find the vertices of the rounded square. If we find those, we also know where to switch from one curve to the next. By symmetry, they have to be located on the coordinate axes. The top corner point has to be located at , which allows us to find the value of ,
, so that .
We need the value that lies within , since is the -coordinate of the upper right vertex of the inner square. The value for therefore becomes . Consequently, we can find the -coordinate as well, which works out as .
The whole result is plotted in the figure below, with the red lines being the boundary curves and the red crosses being the corner points.
I’m quite pleased with the result. It was a fun exercise and I was astounded to found out the problem could be solved so satisfactorily. It’s quite an interesting problem, where a lot of mathematics come together; I needed to use convexity theory, trigonometry, complex analysis, geometry, calculus and of course a lot of algebra. And besides from that, I think the pictures are quite pleasing aesthetically.