How can I find the coordinates of a point which is the reflection of a point about a line in 3D I am currently working on a project on Matlab and I need to find the coordinates of a point which is reflected about a line. I know how to do it in 2D but in 3D things are getting ugly.
So, we have a line which goes through two points $A(x_1, y_1, z_1)$ and $B(x_2, y_2, z_2)$. $P_1(x_0, y_0, z_0)$ is reflected about that line and i need to find the coordinates of reflection of P1. 
 A: Assume a point on the line in parametric form and use the fact that the line from it to P is perpendicular to line. 
Remember the formula for perpenducular direction ratios? Then apply mid-point theorem. What is the mid point of what here?
A: The equation of a straight line AB passing through the points $A(x_1, y_1, z_1)$ & $B(x_2, y_2, z_2)$ in 3-D is given as follows
$$\frac{x-x_1}{x_2-x_1}=\frac{y-y_1}{y_2-y_1}=\frac{z-z_1}{z_2-z_1}=k (\text{any arbitrary constant})$$ then the reflection of the point $P_1(x_o, y_o, z_o)$ about the line above is a point say $P'(x', y', z' )$ whose co-ordinates are calculated by applying the two conditions 


*

*Mid point of the points $P_1$ & $P'$ lies on the line $AB$ 

*Lines $AB$ & $P_1P'$ are perpendicular to each other 
We can easily find out the mathematical expressions to calculate the co-ordinates of the point of reflection $P'(x', y', z')$ as follows
$$x'=2k(x_2-x_1)+2x_1-x_o$$ $$y'=2k(y_2-y_1)+2y_1-y_o$$ $$z'=2k(z_2-z_1)+2z_1-z_o$$ Where, $$k=\frac{(x_2-x_1)(x_o-x_1)+(y_2-y_1)(y_o-y_1)+(z_2-z_1)(z_o-z_1)}{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}$$ 
