Rotating x,y points 45 degrees
Solution 1:
The transformation you describe by examples is not a rotation, in fact it does not preserve norms, it is the projection on the real axis. If instead you want a $45°$-counterclockwise rotation, apply the rotation matrix $$\left( \begin{array}{cc} \cos\theta&-\sin\theta\\ \sin\theta&\cos\theta \end{array} \right)$$
with $\theta=\frac{\pi}{4}$
Solution 2:
There are a few ways to work this out, but my favorite is with complex numbers.
If we represent the point $(x,y)$ by the complex number $x+iy$, then we can rotate it 45 degrees clockwise simply by multiplying by the complex number $(1-i)/\sqrt{2}$ and then reading off their $x$ and $y$ coordinates.
$$(x+iy)(1-i)/\sqrt{2} = ((x+y) +i(y-x))/\sqrt{2} = \tfrac{x+y}{\sqrt{2}} + i\tfrac{y-x}{\sqrt{2}}.$$
Therefore, the rotated coordinates of $(x,y)$ are $\big(\tfrac{x+y}{\sqrt{2}},\tfrac{y-x}{\sqrt{2}}\big)$.
If your data consists of rational numbers, scaling by $\sqrt{2}$ may be undesirable. In that case, you can leave the $\sqrt{2}$ out of the denominator, but then note that the points have been both rotated and scaled.
Finally, if $(u,v)$ is a point in your rotated coordinates and you want to get back to the original data, you just multiply $u+iv$ by $(1+i)/\sqrt{2}$, the inverse of $(1-i)/\sqrt{2}$.