I’m fine reflecting across the x- or y-axis (flip a sign) and across y = x (swap x and y). But the second the mirror is a slanted line that’s not so friendly, my brain stalls.
Example: reflect P = (4, 2) across the line y = 2x − 5.
My lazy attempt: “shift-swap-shift.” I added 5 to y → (4, 7), swapped → (7, 4), then subtracted 5 from y → (7, −1). That obviously isn’t the mirror – plugging into 2x − y − 5 gives 10, so it’s not even the right distance off the line. I guess this ‘swap’ trick only works when the slope is 1.
Then I did the full perpendicular drop, which works but feels like overkill: slope ⟂ is −1/2, line through P is y − 2 = −1/2(x − 4). Intersecting with y = 2x − 5 gave me M = (3.6, 2.2), and reflecting across M gave P’ = (3.2, 2.4). Seems right, but it’s a lot of algebra for something that feels like it should have a quicker recipe.
Question: What’s the simplest, repeatable way to reflect a point across a general line y = mx + b without grinding through simultaneous equations every time? Bonus if there’s a mental trick like the “swap then shift” one for y = x + c. Any help appreciated!
















3 Responses
Quick rule: for a line written Ax + By + C = 0 (so for y = mx + b take A = m, B = −1, C = b), the reflection of (x0, y0) is (x0 − 2A(Ax0 + By0 + C)/(A^2 + B^2), y0 − 2B(Ax0 + By0 + C)/(A^2 + B^2)). For (4, 2) across y = 2x − 5 (A = 2, B = −1, C = −5) this gives (3.2, 2.4); hope this helps!
A quick, repeatable recipe uses the line’s normal vector. For y = mx + b the normal is n = (m, −1). For a point P = (x0, y0), compute the signed offset t = (m x0 − y0 + b)/(m^2 + 1). Then reflect by moving back twice along that normal:
x’ = x0 − 2 m t
y’ = y0 + 2 t
Example: with y = 2x − 5 and P = (4, 2), t = (2·4 − 2 − 5)/(2^2 + 1) = 1/5, so P’ = (4 − 2·2·1/5, 2 + 2·1/5) = (3.2, 2.4).
This is the compact form of the general ax + by + c = 0 reflection:
(x’, y’) = (x, y) − 2 (a x + b y + c)/(a^2 + b^2) · (a, b).
For y = mx + b we have a = m, b = −1, c = b. As a nice check, when m = 1 this collapses to the “swap then shift” rule: across y = x + c, (x, y) ↦ (y − c, x + c). Would you like a short derivation of the formula, or a way to remember it geometrically?
Oh man, I feel that “brain stall” the moment the mirror tilts! Flipping across the axes or y = x is like turning pancakes; the moment the pan is at an angle, I’m suddenly second-guessing my wrist. I kept wishing for a swap-then-shift trick that works for any slant.
Here’s the way I talk myself through it that feels fast and surprisingly “mental,” because it uses just one scalar and one little vector. Think of the line y = m x + b as a wall, and the vector perpendicular to that wall is n = (m, −1). If you know how far you are from the wall in the perpendicular direction, you just step twice that amount along n to bounce to the other side.
Recipe for reflecting P = (x0, y0) across y = m x + b:
1) Compute the “gap” g = m x0 − y0 + b. This is the signed perpendicular-ish distance scaled by the length of n.
2) Compute the scale s = 2 g / (m^2 + 1).
3) Move by s times the normal: P’ = P − s (m, −1).
Written out:
– x’ = x0 − 2 m (m x0 − y0 + b) / (m^2 + 1)
– y’ = y0 + 2 (m x0 − y0 + b) / (m^2 + 1)
I always do a tiny “wait, is the sign right?” check by plugging in a point that’s on the line (g = 0 gives P’ = P, so that passes).
Why this works (intuitively): the line in standard form is m x − y + b = 0, so its normal vector is n = (m, −1). The signed “how far off the wall” score is g = n · P + b0, and when you project along n you scale by 1/(m^2 + 1). Reflection means “overshoot” back by twice that normal component, hence subtract 2 g/(m^2 + 1) times n.
Your example, super quick:
– Line: y = 2x − 5, so m = 2, b = −5.
– Point: P = (4, 2).
– g = 2·4 − 2 + (−5) = 8 − 2 − 5 = 1.
– s = 2g/(m^2 + 1) = 2/5 = 0.4.
– n = (2, −1). So P’ = (4, 2) − 0.4·(2, −1) = (4 − 0.8, 2 + 0.4) = (3.2, 2.4).
No simultaneous equations, no perpendicular-line algebra-just one dot-like computation and a small vector n you can picture.
Mental tips I lean on:
– m x − y + b is the “plug into the left-hand side” score. Zero means you’re on the mirror. Positive vs. negative tells you which side you’re on.
– The normal (m, −1) is easy to remember because it just comes from m x − y.
– If m^2 + 1 is friendly (like 5 for m = 2), dividing by it is quick. Then it’s just “nudge by that many steps of (m, −1), twice.”
Bonus general form (works for any line a x + b y + c = 0):
– Let n = (a, b) and g = a x0 + b y0 + c.
– P’ = P − 2 g/(a^2 + b^2) · n.
And yes, your “swap-then-shift” trick is the special case m = 1. When m = 1, reflecting across y = x + c is: shift by −c in y, swap x and y, then shift back by +c. That works because the normal and the 45-degree geometry line up perfectly for that neat swap.
Curious: do you prefer this “normal vector bounce” because it’s just one formula, or would you rather have a rotate–flip–rotate-back picture (translate to hit the origin, rotate to flatten the line, flip over the x-axis, then undo)? I can sketch that approach too if it helps cement the intuition.