Thursday, December 2, 2010

On the reflection of a point over a line

Did some brain-storming to come up with this (even if it is probably already done) formula to find the reflection P'(x2, y2) of a point P(x1, y1) over a line:
Ax + By + C = 0 --- (1)

 Idea: I will use two equations in x2 and y2, containing constants A, B, C, x1 and y1, to derive the value of x2 and y2 in terms of the said constants. For the first equation, I shall take the help of the equation of the straight line passing through P and P'. For the second equation, I shall use the midpoint formula for the point M(a, b) that lies on line (1) and lies between P and P'.

Ok, let’s look at the figure first. Suffice to say, it represents the reflection of any point over a general straight line.

PP' is a line that is perpendicular to (1)
So the equation of PP’ would be:
Bx – Ay + K = 0 --- (2)
where K is a constant
[reason: the slope of line (1) is found to be –A/B, and since line (2) is perpendicular to line (1), its slope must be B/A (to give a product of –1), which gives us equation (2)]
As P(x1, y1) lies on line (2),
Bx1 – Ay1 + K = 0
K = Ay1 – Bx1
Thus, line (2) can be written as:
Bx – Ay + (Ay1 – Bx1) = 0 --- (2)
As P'(x2, y2) also lies on this line,
Bx2 – Ay2 + (Ay1 – Bx1) = 0
=> Ay2 = Bx2 + (Ay1 – Bx1)
=> y2 = [Bx2 + (Ay1 – Bx1)]/A --- (A)

Now let us look at the point M(a, b) which lies on line (1) and is half-way between P and P'
(As P' is the reflection of P over line (1), PM = MP')
By the mid-point formula,
(x1 + x2)/2 = a
(y1 + y2)/2 = b
(a, b) lies on line (1), so:
Aa + Bb + C = 0
=> A(x1 + x2)/2 + B(y1 + y2)/2 + C = 0
=> [Ax1 + Ax2 + By1 + By2 + 2C]/2 = 0
=> Ax2 + By2 + [Ax1 + By1 + 2C] = 0
=> By2 = -Ax2 – (Ax1 + By1 + 2C)
=> y2 = [-Ax2 – Ax1 – By1 – 2C]/B --- (B)


Thus from (A) and (B),
Bx2 + (Ay1 – Bx1)     =      -Ax2 – Ax1 – By1 – 2C
A                                         B
B2x2 + B(Ay1 – Bx1) = -A2x2 – A2x1 – ABy1 – 2AC
(A2 + B2)x2 = - ABy1 + B2x1 – A2x1 – ABy1 – 2AC
x2 = (B2 – A2)x1 – 2ABy1 – 2AC
                   (A2 + B2)
Therefore, from (A),
y2 = B[(B2 – A2)x1 – 2ABy1 – 2AC]/(A2 + B2) + Ay1 – Bx1
                                                A
= B3x1 – A2Bx1 – 2AB2y1 – 2ABC + A3y1 + AB2y1 – A2Bx1 – B3x1
                                    A(A2 + B2)
= A3y1 – 2A2Bx1 – AB2y1 – 2ABC
                        A(A2 + B2)
= A2y1 – 2ABx1 – B2y1 – 2BC
                        (A2 + B2)
y2 = (A2 – B2)y1 – 2ABx1 – 2BC
                   (A2 + B2)


Let’s try this formula for a certain case, when a point is reflected on the line:
y = -x
i.e. x + y = 0
Then, A = 1, B = 1, C = 0
x2 = 0 – 2y1 – 0   = -y1
            1 + 1
y2 = 0 – 2x1 – 0   = -x1
            1 + 1

No comments:

Post a Comment