# Symmetry of point about a line in 3d

How would I go about finding the symmetrical image of a 3d point $t = (t_x,t_y,t_z)$, about a 3d line given with the equation $\frac{x+1}{4}=\frac{y+1}{-3}=\frac{z-15}{16}$?

Edit: To clarify: The above illustration should show what I'm looking for. The coordinates of the point $t'$ on the graph. The purple line on the graph corresponds to the equation given above. It is a freshman linear algebra & analytic geometry exam question and a simple solution (without unneccesary differential equations or other complications) doable with pen and paper in a reasonable amount of time (of up to twenty minutes say) would be appreciated.

• Symmetrical image? Do you mean the point resulting after rotating $t$ $180^o$ about the line? Aug 11, 2017 at 15:53
• It is fairly easy to find the point $p$ on the line that is closest to your original point $t$. Then reflecting $p$ through this closest $t$ is what you want. Aug 11, 2017 at 15:54
• @AndrewTawfeek I edited the question for clarification. Thanks. Aug 11, 2017 at 19:17
• @hardmath Would you mind posting an answer clarifying the whole procedure? I've not been able to express $p$ without using the (also unknown) coordinates of the reflection $t'$ Aug 11, 2017 at 19:38

Let $\frac{x+1}{4}=\frac{y+1}{-3}=\frac{z-15}{16}=t$ and $(x,y,z)$ be the needed point.

Hence, $$\frac{x+t_x}{2}=-1+4t,$$ $$\frac{y+t_y}{2}=-1-3t$$ and $$\frac{z+t_z}{2}=15+16t,$$ which gives, $$x=-2+8t-t_x,$$ $$y=-2-6t-t_y$$ and $$z=30+32t-t_z.$$ In another hand $$4(t_x-x)-3(t_y-y)+16(t_z-z)=0$$ and after substitution of values $x$, $y$ and $z$ in this equation we can find a value of $t$

and from here we can get values of $x$, $y$ and $z$.

I got $$t=\frac{4t_x-3t_y+16t_z-239}{281}$$

• Thank you for the answer but for $t = (1,1,1)$ your answer yielded the coordinates of a point $D$ (as seen on this GeoGebra graph - zimagez.com/zimage/screenshot2017-08-1120-25-32.php), whereas I'm looking for the way to calculate the coordinates for the point $t'$ (plotted on the same graph). Aug 11, 2017 at 18:30
• @Luka Aleksić For $(1,1,1)$ I got $\left(\frac{-2619}{281},\frac{489}{281},\frac{1045}{281}\right)$, which you wish. Aug 11, 2017 at 18:44
• That's not what I got, so I must have made a mistake. What I did was express $t = \frac{4t_x-3t_y+16t_z+241}{281}$ and then returned this to the very first equation and express $x,y$ and $z$ through $t_x,t_y$ and $t_z$ (where $x,y$ and $z$ are coordinates of the reflection $t'$ and $t_x,t_y$ and $t_z$ the coordinates of the original point $t$) Was I supposed to do this? Is it a mistake in the principle or should I check my calculation for errors? Aug 11, 2017 at 19:14

The point you’ve labeled $c$ is the intersection of the line with the perpendicular plane to this line through $t$. The points $t$ and $t'$ are then related via the formula $$t'=t+(c-t)+(c-t)=2c-t.$$

Since most of the other answers so far bring differential calculus to bear, I’m going to give you a more geometrical approach. The direction vector of the line is $(4,-3,16)$, so the equation of the perpendicular plane through t is $$4x-3y+16z=4t_x-3t_y+16t_z.$$ Eliminate $\lambda$ from ${x+1\over4}={y+1\over-3}={z-15\over16}=\lambda$ to get a pair of linear equations that describe two planes that contain the line, e.g., $3x+4y+7=0$ and $4x-z+19=0$. The point $c$ lies at the intersection of these three planes, i.e., is the solution to the system of the three equations, which you can find using your favorite method. (Back-substitution might be reasonably fast here because two of the equations involve only two variables each.) Once you have $c$, use the formula from the beginning of this answer to compute $t'$.

Hardmath’s answer reminded me of another geometric solution. From an equation of a line of the form ${x-x_0\over a}={y-y_0\over b}={z-z_0\over c}$, you can derive the parametric form $(x_0,y_0,z_0)+\lambda(a,b,c)$, or, more succinctly, $p_0+\lambda v$. The vector $v$ gives the direction of the line. As shown in your diagram, the point $c$ is the orthogonal projection of $t$ onto the line, which can be computed using a standard formula: $$c=p_0+{(t-p_0)\cdot d\over d\cdot d}d=p_0+{t\cdot d-p_0\cdot d\over d\cdot d}d.$$ The reflected point $t'$ is then obtained via the formula at top. Plugging in the values in your example, we have \begin{align}c &= (-1,-1,15)+{4t_x-3t_y+16t_z-\left((-1)(2)+(-1)(-3)+(15)(16)\right)\over 4^2+(-3)^2+16^2}(4,-3,16) \\ &=(-1,-1,15)+{4t_x-3t_y+16t_z-239\over16+9+256}(4,-3,16).\end{align} The fraction in the second line should look familiar: it’s $\lambda$ from Hardmath’s answer.

• Thanks. The first part with the intersection of the three planes was the most effective solution for me. Aug 14, 2017 at 13:40

I would rearrange some of the ideas exposed by @amd.

Consider the point $t=(t_x,t_y,t_z)$ and line:

$$\frac{x+1}{4}=\frac{y+1}{-3}=\frac{z-15}{16}=\lambda$$

with $\lambda$ considered as parameterization of the line.

More explicitly the points on this line are:

$$p=(4\lambda -1, -3\lambda -1, 16\lambda + 15)$$

if we let $\lambda$ take on any real number value.

Minimizing the distance between $p$ and $t$ is equivalent to minimizing the square of that distance, which is a function of only $\lambda$:

$$f(\lambda)= (4\lambda - 1 - t_x)^2 + (-3\lambda -1 - t_y)^2 + (16\lambda + 15 - t_z)^2$$

Since this is a sum of squares, the function $f(\lambda)$ has a global minimum that corresponds to the value of $\lambda$ where $p$ is closest to $t$. We need only differentiate and find the unique critical point to determine this $\lambda$:

$$\frac{df}{d\lambda} = 2(4\lambda - 1 - t_x)(4) + 2(-3\lambda - 1 - t_y)(-3) + 2(16\lambda + 15 - t_z)(16) = 0$$

Divide through by $2$ and distribute:

$$4^2\lambda - 4 - 4t_x + 3^2\lambda + 3 + 3t_y + 16^2\lambda + 240 - 16t_z = 0$$

After collecting like terms and simplifying:

$$(16+9+256)\lambda = 4t_x - 3t_y + 16t_z + 4 - 3 - 240$$

$$\lambda = \frac{4t_x - 3t_y + 16t_z - 239}{(16+9+256)}$$

Now that $\lambda$ is known, so too is $p$ determined. The symmetric reflection of $t$ through $p$ is $t'=2p-t$, as amd noted. We can verify the symmetry by calculating the midpoint of $t$ and $t'$ is $p$ and recalling that since $p$ is the closest point to $t$, it must also be the closest point to $t'$.

• It might be instructive to expand the mysterious $-239$ In the numerator of the expression for $\lambda$ (as well as the other elements, which are more obvious) in terms of the coefficients in the equation of the line. I find the resulting expression quite satisfying.
– amd
Aug 12, 2017 at 2:08
• Thanks, I found it hard to know how much detail to stuff into the first draft. There is a parallel in this computation with the normal form of a line, better known in 2D, but applicable in any finite dimensions. Aug 12, 2017 at 2:15
• Indeed, $\lambda$ is more or less the scalar projection of $t$ onto the line.
– amd
Aug 12, 2017 at 6:12

Find point $\vec{c}$ on the line that is closest to $\vec{t}$. Then, the reflection $\vec{t}'$ is such that $\vec{c}$ is in the middle of the line between $\vec{t}$ and $\vec{t}'$, i.e. $$\vec{t}' = \vec{c} - (\vec{t} - \vec{c}) = 2 \vec{c} - \vec{t} \tag{1}\label{1}$$

To find $\vec{c}$, first find two points $\vec{p}_0$ and $\vec{p}_1$ that fulfill the line equation. (I normally find $\vec{p}_0 = ( x_0 , y_0 , z_0 )$ by having the equation be equal to $0$, and $\vec{p}_1 = ( x_1 , y_1 , z_1 )$ by having the equation equal to $1$. However, any two different scalar constants will work just fine.)

Then, you can parametrise the line as $$\vec{p}(s) = (1 - s)\vec{p}_0 + s \, \vec{p}_1 = \vec{p}_0 + s \left ( \vec{p}_1 - \vec{p}_0 \right )$$

The distance between point $\vec{t}$ and $\vec{p}(s)$ is $$d(s) = \left\lVert \vec{p}(s) - \vec{t} \right\rVert = \sqrt{ \left(\vec{p}(s) - \vec{t} \right) \cdot \left(\vec{p}(s) - \vec{t} \right) }$$ Because the distance is nonnegative, the $s$ that minimizes $d(s)$ also minimizes $\left(d(s)\right)^2$; so, we use $f(s) = \left(d(s)\right)^2$, and $$\begin{array}{rl}f(s) = & \left( x_0 + s (x_1 - x_0) - x_t \right)^2 + \\ \; & \left( y_0 + s ( y_1 - y_0 ) - y_t \right)^2 + \\ \; & \left( z_0 + s ( z_1 - z_0 ) - z_t\right)^2 \end{array}$$ As usual, $f(s)$ reaches its extrema (minimum or maximum values) when its derivative is zero: $$\begin{array}{rl} \frac{d \, f(s)}{d \, s} = & 2 (x_1 - x_0 ) \left( x_0 - x_t + s ( x_1 - x_0 ) \right ) + \\ \, & 2 ( y_1 - y_0 ) \left( y_0 - y_t + s ( y_1 - y_0 ) \right ) + \\ \, & 2 ( z_1 - z_0 ) \left( z_0 - z_t + s ( z_1 - z_0 ) \right ) = 0 \end{array} \tag{2}\label{2}$$

Solve $\eqref{2}$ for $s$, and you find $\vec{c} = \vec{p}(s)$. Substitute $\vec{c}$ into $\eqref{1}$, and you find the result, $\vec{t}'$.

Find the closest point on the line to the point.

The location on a line with parametric equation ${\bf r}(\lambda) = {\bf r}_0 + \lambda \,{\bf e}$ closest to the point ${\bf p}$ is defined by

$$\lambda = \frac{{\bf e} \cdot ( {\bf p}-{\bf r}_0 )}{ \| {\bf e} \|^2}$$

This center point has coordinates

$${\bf q} = {\bf r}_0 + \frac{{\bf e} \cdot ( {\bf p}-{\bf r}_0 )}{ \| {\bf e} \|^2} \,{\bf e}$$

The mirror point is at

$${\bf p}' = {\bf p} + 2 ( {\bf q}-{\bf p}) = 2 {\bf q}-{\bf p}$$

In your case, use \begin{aligned} {\bf r_0} & = \pmatrix{-1 & -1 & 15} \\ {\bf e} & = \pmatrix{4 & -3 & 16} \\ {\bf p} & = \pmatrix{t_x & t_y & t_z} \end{aligned}

Not much different from the other answers, but a bit tidier, maybe.

Suppose your line has parametric equation $\mathbf{L}(t) = \mathbf{A} + t\mathbf{U}$, where $\mathbf{U}$ is a unit vector. We're given a point $\mathbf{P}$, and we want to find its mirror image $\mathbf{Q}$.

Let $\mathbf{R} = \mathbf{L}(t_0) = \mathbf{A} + t_0\mathbf{U}$ be the projection of $\mathbf{P}$ onto the line. Then $\mathbf{R} - \mathbf{P}$ is perpendicular to the line, so $(\mathbf{R} - \mathbf{P}) \cdot \mathbf{U} = 0$, which means that $(\mathbf{A} + t_0\mathbf{U} - \mathbf{P}) \cdot \mathbf{U} = 0$. Solving for $t_0$ gives $t_0 = (\mathbf{P} - \mathbf{A}) \cdot \mathbf{U}$. So, we have $$\mathbf{R} = \mathbf{A} + \bigl[\mathbf{P} - \mathbf{A}) \cdot \mathbf{U}\bigr]\mathbf{U}$$ Then the mirror image point $\mathbf{Q}$ is just $$\mathbf{Q} = \mathbf{R} + (\mathbf{R} - \mathbf{P}) = 2\mathbf{R} - \mathbf{P}$$ In your case $$\mathbf{A} = (-1,-1,15) \quad ; \quad \mathbf{U} = \frac{1}{\sqrt{281}}(4,-3,16)$$