<s>[INST] Proofs of the Reflection Rules I couldn't find a formal proof for the rule:
when a point $(a,b)$ is reflected along $y=x$, it becomes $(b,a)$.
I tried to prove it by sketching out the situation:

However, I still don't know how to prove that $b'=b, a'=a$.
Furthermore, I just want to make sure, for the following two rules:

*

*Reflection Across Y-Axis. $(x,y)\to(-x,y)$

*Reflection Across X-Axis. $(x,y)\to(x,-y)$.

Do they have formal proofs or do we just prove them by visualizing where a point ends up to be on a cartesian plane?
 [/INST] To find the coordinates of the reflected point $P'$, let us first find the intersection point of the line $y=x$ and the line perpendicular to that line and passing through the point $P=(a,b)$.
As we know, the equation of the line perpendicular to the line $y=x$ and passing through the point $P=(a,b)$ is$$y=-(x-a)+b.$$So, the intersection point can be obtained by solving the following system of equations as follows.$$\begin{cases} y=x \\ y=-(x-a)+b \end{cases} \quad \Rightarrow \quad M=\left ( \frac{a+b}{2}, \frac{a+b}{2} \right ).$$According to the definition of reflection, the point $M$ is the midpoint of the segment $\overline{PP'}$. So the reflected point $P'$ can be obtained by the following vector addition:$$\overrightarrow{OP'}=\overrightarrow{OP}+ 2 \overrightarrow{PM},$$where $O=(0,0)$ is the origin.
So, we need to do some vector algebra as follows.$$\overrightarrow{PM}=\left ( \frac{a+b}{2}, \frac{a+b}{2} \right ) - \left ( \vphantom{\frac{a}{b}} a,b \right )= \left ( \frac{b-a}{2}, \frac{a-b}{2} \right )$$$$\Rightarrow \quad \overrightarrow{OP'}=  \left ( \vphantom{\frac{a}{b}} a,b \right )+ 2 \left ( \frac{b-a}{2}, \frac{a-b}{2} \right )=(b,a).$$Thus, the coordinates of the reflected point $P'$ is$$P'=(b,a).$$

Addendum
We can also find the coordinates of the reflected point by equating the distances of the points $P$ and $P'$ from the Point $M$ as follows (Please note that the point $P'$ lies on the line $y=-(x-a)+b$).$$d_{P',M}=d_{P,M}$$$$\Rightarrow \quad \sqrt{\left ( x- \frac{a+b}{2} \right )^2+ \left ( (-x+a+b) - \frac{a+b}{2} \right )^2}= \sqrt{ \left ( a- \frac{a+b}{2} \right )^2 + \left ( b - \frac{a+b}{2} \right )^2}$$$$ \Rightarrow \quad x=a \quad \text{ or } \quad x=b$$ $x=a$ corresponds to the point $P$. Thus, the coordinates of the reflected point $P'$ is$$P'=(b,a).$$
</s>