# Reflecting a point over a line created by two other points

This problem came up while discussing using a simplex to solve systems of equations.
(By the way, yes, this is very similar to this one.)

Given three points, how do I find the location of the point that results from reflecting one of them over the line between the other two?

This is what I mean:

How do I find $C'$?

-
Why are you answering your own question, immediately after it's asked? Perhaps you should go ahead an accept your own answer? –  mixedmath May 25 '11 at 15:47
That's interesting. Having read through that topic and the one referenced, I suppose I just thought along the same lines as Pete Clark with respect to questions where the OP knows the answer. Thank you for the explanation. –  mixedmath May 25 '11 at 15:55
@mixedmath: You're welcome. :) –  El'endia Starman May 25 '11 at 15:58
@mixedmath: look at El'endia's profile... Quite an awesome youthful grandma (or -pa?!) we have here :) –  t.b. May 25 '11 at 16:09

For reference:

Let...
$\vec{P} = \langle x-a, y-b \rangle$
$\vec{Q} = \langle c-a, d-b \rangle$
$\theta = \text{ the angle between } \vec{P} \text{ and } \vec{Q}$

First off, let's start with projecting $\vec{P}$ onto $\vec{Q}$. In math...

$\vec{K} = \text{Proj}_{\vec{Q}} \vec{P} = \displaystyle \frac{\vec{P} \cdot \vec{Q}}{||\vec{Q}||^2} \vec{Q}$

This gives us the vector $\vec{K}$ that goes from $A$ to the "intersection" of the two lines $\overline{AB}$ and $\overline{CC'}$. To find the vector from $C$ to that intersection, simply subtract $\vec{K}$ from $\vec{P}$. You can then multiply this vector by two and add to $C$ to get $C'$, or in other words $2(\vec{K}-\vec{P}) + \vec{P}$. This is equivalent to $2\vec{K}-\vec{P}$. Substituting the formula for $\vec{K}$ back in gives:

$\vec{P'} = \displaystyle 2\frac{\vec{P} \cdot \vec{Q}}{||\vec{Q}||^2} \vec{Q} - \vec{P}$

You can now add $\vec{P'}$ to $A$ to get $C'$. That sufficient for your needs?

-
Plenty sufficient for mine, in fact. Nice question and answer! –  t.b. May 25 '11 at 15:55
@Theo: Thanks! :) –  El'endia Starman May 25 '11 at 15:58
By the way: did you ever try GeoGebra? After a short while of getting used to it, you can create quite awesome pictures with that. –  t.b. May 25 '11 at 16:00
@Theo: Oh cool! Definitely gonna check that out! :D –  El'endia Starman May 25 '11 at 16:03
Maybe it is interesting for you that your approach can be generalized to the reflection at planes in arbitrary dimensions. It is known (at least numerical people) as Householder transformation. –  Fabian May 25 '11 at 16:56