How to turn the reflection about $y=x$ into a rotation. If we reflect $(x,y)$ about $y=x$ then we get $(y,x)$. And because $x^2+y^2=y^2+x^2$ this can also be represented by a rotation. 
Using this we get:
$$(x,y)•(y,x)=2xy=(x^2+y^2)\cos (\theta)$$
Hence 
$\theta=\arccos (\frac{2xy}{x^2+y^2})$
So using complex numbers we rotate $(x,y)$ clockwise/counterclockwise an angle of $\arccos (\frac{2xy}{x^2+y^2})$ depending on which side of $y=x$ the point is, i.e. Depending on wether or not $y > x$.

My question :
  How can we know the angle is $\arccos (\frac{2xy}{x^2+y^2})$ without using the already known result that $(x,y)$ rotated about $x=y$ is $(y,x)$?

 A: If $\theta$ is the angle between the x-axis and the line from 0 to $(x,y)$, then $\theta = \arccos(\frac{y}{\sqrt{x^2+y^2}})$.  We reflect about a line with angle $\frac{\pi}{4}$, so the angle between $(x,y)$ and the line $x=y$ is $\frac{\pi}{4} - \theta$.  The angle between $(x,y)$ and the reflected point will be double the previous angle, or $\frac{\pi}{2} -2 \theta$.  Compute the cosine of $\frac{\pi}{2} - 2\theta$ and you will get $\frac{2xy}{x^2+y^2}$.
A: What follows might be difficult to understand because of abuse of notation.
First calculate the orthogonal projection of $(x,y)$ onto the line $y=x$ (i.e. the point on the line $y=x$ which is closest to the point $(x,y)$).
Call the resulting point $(a,b)$.
Then calculate the angle between the vector with $(a,b)$ as its arrow and $(0,0)$ as its base and the vector with $(x,y)$ as its head and $(0,0)$ as its base. Call this angle $\theta$.
If $(x,y)$ is $\theta$ to the right of $y=x$ then its reflection about the line is $\theta$ to the left of $y=x$ (and $2\theta$ to the left of the vector with arrow $(x,y)$ and base at the origin).
Likewise everything above with left and right interchanged if $(x,y)$ is $\theta$ to the left of $y=x$.
The rotation of $(a,b)$ by $\theta$ or $(x,y)$ by $2\theta$ can be accomplished by using a 2d rotation matrix: https://en.wikipedia.org/wiki/Rotation_matrix
