# Intersection point of perpendicular lines to two other point

I got this question which confused me and I can't find the solution,

The two lines have equations

Line $1$ : $r = (3,5,4)+t(2,3,1)$

Line $2$: $r = (1,1,-1)+s(1,1,1)$

Where s and t are constants.
These lines don't intersect.
A line perpendicular to line $1$ and line $2$ intersect line $1$ and line $2$ at points $P$ and $Q$ respectively. Find the coordinates of $P$ and $Q$.

Thanks!

First, note that $(2,-1,-1)$ is perpendicular to both $(2,3,1)$ and $(1,1,1)$. As such, the line perpendicular to both lines can be written as $$\vec r=(x_0,y_0,z_0)+a(2,-1,-1).$$
Here $(x_0,y_0,z_0)=(3+2t,5+3t,4+t)$ are the coordinates of $P$ for some $t$. Since the perpendicular intersects the second line at $Q=(1+s,1+s,s-1)$, we have
$$(3+2t,5+3t,4+t)+a(2,-1,-1)=(1+s,1+s,s-1),$$ which results in $$3+2t+2a=1+s,$$ $$5+3t-a=1+s,$$ and $$4+t-a=s-1.$$ Solving them for $a$, $t$, and $s$ results in $a = 5/6$, $t=1/2$, and $s=14/3$.
Consequently, the coordinates of $P$ are $(3+2t,5+3t,4+t)=\color{red}{(4,13/2,9/2)}$ and that of $Q$ are $(s+1,s+1,s-1)=\color{red}{(17/3,17/3,10/3)}$.
use that the dot product of direction vector of your searched equation must Zero, this means $$[2;3;1]\times[x;y;z]=0$$ and $$[1;1;1]\times [x;y;z]=0$$ at first compute $[x;y;z]$