Q. How to reflect a point over \(y = x\).
Answer

For a point \((x,y)\), the reflection across the line \(y=x\) is \((y,x)\).
Quick explanation: the midpoint of \((x,y)\) and \((y,x)\) is \(\bigl(\frac{x+y}{2}, \frac{x+y}{2}\bigr)\), which lies on \(y=x\); and the slope of the segment joining them is -1, perpendicular to the slope 1 of \(y=x\), so they are symmetric.
Detailed Explanation
-
State the given point and the mirror line.
Let the point to be reflected be \(P=(a,b)\). The mirror line is \(y=x\).
-
Find the equation of the line through \(P\) that is perpendicular to \(y=x\).
The line \(y=x\) has slope 1. A line perpendicular to it has slope -1. The perpendicular line through \(P=(a,b)\) therefore has equation
\[y-b = -1(x-a)\]
or equivalently
\[y = -x + (a+b)\]
-
Find the intersection point \(Q\) of the perpendicular line with \(y=x\) (the foot of the perpendicular).
At the intersection, \(y=x\) and \(y=-x+(a+b)\). Solve the system:
\[x = -x + (a+b)\]
\[2x = a+b\]
\[x_Q = \frac{a+b}{2}\]
Since \(y_Q=x_Q\),
\[y_Q = \frac{a+b}{2}\]
Thus the foot is \(Q=\bigl(\frac{a+b}{2}, \frac{a+b}{2}\bigr)\).
-
Use the midpoint property to determine the reflected point \(P’\).
Reflection across a line makes the intersection point \(Q\) the midpoint of the segment joining \(P\) and its reflection \(P’=(x’,y’)\). Therefore
\[\frac{a+x’}{2} = x_Q = \frac{a+b}{2}\]
\[\frac{b+y’}{2} = y_Q = \frac{a+b}{2}\]
Solving these gives
\[x’ = a+b – a = b\]
\[y’ = a+b – b = a\]
Hence the reflection is \(P’=(b,a)\).
-
Summary and alternative matrix viewpoint.
Reflecting a point across the line \(y=x\) swaps the coordinates. For any point \(P=(a,b)\), the reflection across \(y=x\) is
\[P’=(b,a)\]
Equivalently, as a linear transformation on column vectors, the reflection is given by the matrix
\[\begin{pmatrix}0 & 1\\[4pt]1 & 0\end{pmatrix}\]
so
\[\begin{pmatrix}0 & 1\\[4pt]1 & 0\end{pmatrix}\begin{pmatrix}a\\[4pt]b\end{pmatrix}= \begin{pmatrix}b\\[4pt]a\end{pmatrix}\]
-
Quick numeric example.
Reflect \(P=(2,5)\) across \(y=x\). Swap coordinates to get \(P’=(5,2)\).
FAQs
What is the rule to reflect a point over the line y = x?
How do I write the reflection as a matrix?
How do I reflect the graph of an equation across y = x?
How do I reflect a point across the line y = x + c (parallel shifted)?
How do I reflect a point across a general line ax + by + c = 0?
How do I reflect a polygon or shape over y = x?
Does reflection across y = x preserve distances and orientation?
How is this reflection expressed in the complex plane?
Try our tools below.
Math, Calculus, Geometry, etc.