# Equation of a line passing through a point and perpendicular to another line

Find the equation of a line $$n$$ passing through point $$T(2,3,1)$$ which is also perpendicular to a line given by equation $$p:\frac{x+1}{2}=\frac{y}{-1}=\frac{z+2}{1}$$

I did this using two methods both giving me the same solution and both differing from the solution that's apparently correct, which is $$n:\frac{x-2}{-3}=\frac{y-3}{-3}=\frac{z-1}{1}$$

My solutions:
$$1$$. method
We can find orthogonal projection of a point $$T$$ on a line $$p$$ by finding a intersection point between some plane $$\alpha$$, such that it contains point $$T$$ and is perpendicular to line $$p$$, and line $$p$$. We know, from the fact that $$p$$ is perpendicular to $$\alpha$$, that $$\vec{n_\alpha}=(2,-1,1)$$. After plugging in point $$T$$, we get: $$\alpha: 2x-y+z-2=0$$ Writing line $$p$$ in its parametric form, there is: $$x=2t-1$$ $$y=-t$$ $$z=t-2$$ where $$t\in\mathbb{R}$$. So we from the the system of equation of $$\alpha$$ and $$p$$ in the written form we can find that $$t=1$$. From whis follows point of intersection and also orthogonal projection $$S(1,-1,-1)$$ After putting the points $$T$$ and $$S$$ in the equation of line between two points, the result I got is: $$n:\frac{x-1}{1}=\frac{y+1}{4}=\frac{z+1}{2}$$ And obviously the vector of direction of aforementioned solution is not colinear to the solution I got.

$$2$$. method
Let $$n:\frac{x-2}{a}=\frac{y-3}{b}=\frac{z-1}{c}$$ There need to be 2 condition satisfied. First that $$\vec{n}\cdot\vec{p}=0$$, where $$\vec{n}$$ and $$\vec{p}$$ are vector of directions of $$n$$ and $$p$$, respectively. And second that these two lines are perpendicular to each other.
From first condition we can find the equation $$(a,b,c)\cdot(2,-1,1)=2a-b+c=0$$.
For the second condition we can take the point $$M(-1,0,-1)$$ from the line $$p$$ and then we get the equation: $$\begin{vmatrix} -3 & -3 & -3\\ a & b & c\\ 2 & -1 & 1 \end{vmatrix}=6a+3b-9c=0$$

After solving this system of two equation we get $$(a,4a,2a)$$ from which we can set $$\vec{n}=(1,4,2)$$. This gives the solution: $$n:\frac{x-2}{1}=\frac{y-3}{4}=\frac{z-1}{2}$$ Which is indeed the same as with $$1$$. method just at a different point.

If I'm not mistaken this method is fine, so is it possible that my solution is the right one, or did I make some mistake in the calcution?

• Shouldn't line $p$ in its parametric form have $y=-t$ rather than $y=t+1$? Commented May 18, 2023 at 21:43
• Did you do a sanity check on your solution before posting? It seems that your line neither contains $(2,3,1)$ nor is $\perp$ to the line $p.$ Commented May 18, 2023 at 21:45
• @AnneBauval I did and looks like I did it wrong, somehow I was sure that $\vec{n}\cdot\vec{p}=0$. But I'll check how the colution changes based on the previously commented $y=-t$. Bunch of mistakes I made Commented May 18, 2023 at 21:49
• @AnneBauval $n$ would still contain $T$ even if I did make the mistake previously cause $T$ is in the calculation, but then again I also made a mistake in the substitution in the end. Commented May 18, 2023 at 21:55
• @J.W.Tanner I'll change my question using the correct form, cause it still doesn't yield the result I'm looking for Commented May 18, 2023 at 21:56

The given line is

$$\dfrac{x+1}{2} = \dfrac{y}{-1} = \dfrac{z+2}{1} = t$$

so the parametric equation of the given line is

$$(x, y, z) = (-1, 0, -2) + t (2, -1, 1)$$

The required line passes through $$T = (2,3,1)$$ and is perpendicular to the given line. Let the point of intersection between the two lines be

$$P = (-1, 0, -2) + t (2, -1, 1)$$

Then we want $$TP \perp (2, -1, 1)$$ , i.e.

$$( (-3, -3, -3) + t (2, -1, 1) ) \cdot (2, -1, 1) = 0$$

This gives us

$$-6 + t (6) = 0$$

so $$t= 1$$ and $$P = (1,-1,-1)$$

So now the required line is just the line $$TP$$, the direction vector of which is

$$d = P - T = (-1, -4, -2)$$

or $$d = (1,4, 2)$$

Therefore, the equation of the line is

$$\dfrac{ x - 2 }{1} = \dfrac{ y - 3}{4} = \dfrac{z - 1}{2}$$

The direct method is this: A perpendicular dropped from point $$M_0(x_0, y_0, z_0)$$ , on to a straight line $$L_1$$ with following equation:

$$\frac {x-x_1}{l_1}=\frac {y-y_1}{m_1}=\frac {z-z_1}{n_1}$$

is given by:

$$\begin{cases}l_1(x-x_0)+m_1(y-y_0)+n_1(z-z_0)=0\\\begin {vmatrix}x-x_0 &y-y_0 & z-z_0\\x_1-x_0 & y_1-y_0 & z_1-z_0\\l_1 & m_1 & n_1 \end{vmatrix}=0\end {cases}$$

We have:

$$(x_0. y_0, z_0)=(2, 3, 1)$$

$$(x_1, y_1, z_1)=(-1, 0, -2)$$

$$(l_1, m_1, n_1)=( 2, -1 ,1)$$

Putting values we finally get a system of two equation of two planes which is one method of representing of a line as intersection of these planes. Generally if a line is represented by following equations:

$$\begin{cases}A_1x+B_1y+C_1z=-D_1\\A_2x+B_y+C_z=-D_2\end{cases}$$

then we have:

$$l=\begin{vmatrix}B_1 & C_1\\B_2 & C_2\end{vmatrix}$$

$$m=\begin{vmatrix}C_1 & A_1\\C_2 & A_2\end{vmatrix}$$

$$n=\begin{vmatrix}A_1 & B_1\\A_2 & B_2\end{vmatrix}$$

and the equation of perpendicular line is:

$$\frac{x-x_0}l=\frac{y-y_0}m=\frac{z-z_0} n$$