I was doing a problem related to multiple diamonds placed on a 2d plane. Each diamond $d_i$ has the centre $(x_i,y_i)$. Each diamond is essentially a $45^o$ rotated square. The question was related to finding connected components of overlapping diamonds in the plane.
The editorial/solution of the problem first proposed to change all the diamonds into squares for easier solving. For each centre $(x, y)$, the new rotated square centre is $x'= x+y$ and $y' = x-y$.
I'm wondering why this transformation works. Also if two diamonds were overlapping in the beginning, why would this transformation guarantee that the resulting squares will also overlap? Similarly what about diamonds that weren't overlapping initially? Can they overlap in any case? If a point $(x,y)$ in is the intersection of two diamonds, will the point $(x+y,x-y)$ also be in the intersection of the transformations of the two diamonds?
Thanks!
This transformation can be represented in matrix form as $$\left(\begin{array}{rr}1&1\\1&-1\end{array}\right)=\sqrt2\left(\begin{array}{rr}\frac1{\sqrt2}&\frac1{\sqrt2}\\\frac1{\sqrt2}&-\frac1{\sqrt2}\end{array}\right)=\sqrt2\left(\begin{array}{rr}\cos\frac\pi4&\sin\frac\pi4\\\sin\frac\pi4&-\cos\frac\pi4\end{array}\right).$$ From this we can see that the transformation consists of a reflection in a line that makes an angle of $\frac\pi8=22.5°$ with the $x$-axis and a uniform dilation by a factor of $\sqrt2$. The reflection effectively rotates the diamonds so that their sides are parallel to the coordinate axes. It’s a rigid motion of the plane, so sizes of objects and their relative positions (aside from a change of handedness) aren’t changed. The dilation grows everything and moves everything away from the origin, but it does so in the same proportion throughout, so again the relationships among the diamonds remain unchanged. The effect of the transformation on a few diamonds is illustrated below.