# Perpendicular lines and vectors

My textbook is confusing me a little. Here is a worked example from my textbook:

Line $$l$$ has the equation $$\begin{pmatrix}3\\ -1\\ 0\end{pmatrix}+\lambda \begin{pmatrix}1\\ -1\\ 1\end{pmatrix}$$ and point $$A$$ has co-ordinates $$(3, 9, -2)$$.

Find the coordinates of point $$B$$ on $$l$$ so that $$AB$$ is perpendicular to $$l$$.

$$\vec{AB\cdot }\begin{pmatrix}1\\ -1\\ 1\end{pmatrix}=0$$

$$\vec{OB}=r=\begin{pmatrix}3+\lambda \\ -1-\lambda \\ \lambda \end{pmatrix}$$

$$\vec{AB}=\begin{pmatrix}\lambda \\ -10-\lambda \\ \lambda +2\end{pmatrix}$$

$$\begin{pmatrix}\lambda \\ -10-\lambda \\ \lambda +2\end{pmatrix}\cdot \begin{pmatrix}1\\ -1\\ 1\end{pmatrix}=0$$

$$3\lambda= -12, \lambda = -4$$

Coordinates of $$B$$: $$(-1, 3, -4)$$

The thing I don't understand is why they found the dot product of the line AB and the direction vector of line l. My textbook does mention that to check whether two vectors are perpendicular, $$a\cdot b = 0$$ and for lines, the dot product of their direction vectors = 0. So why did they mix both here? Didn't they use the entire line $$AB$$ and then just the direction vector of line l? Or am I missing something as usual?

There is nothing special here the dot product $AB\cdot v$ gives the condition of orthogonality between the vector from $A$ to $B$ and the direction vector of the given line.
Note also that vector $AB$ is a direction vector for the line orthogonal to the given line in $B$ and passing through $A$.
So to get the coordinates of $B$ given the parametric equation of line $\ell$ and coordinates of $A$. You need $\vec{AB}$ and the direction vector of $\ell$, namely $\vec{u_{\ell}}$ to be orthogonal, i.e. $$\vec{AB}.\vec{u_{\ell}}=0$$