Finding the position vector of a point on a line

Question goes:

Find the position vector of the point P on the line AB such that OP is perpendicular to AB.

A has a position vector 7i-8j+7k, B has 4i+7j+4k and O is the origin.

I started by finding out the line BA, which is: r = <7,-8,7> + t<1,-5,1>

Why is it BA though, and not AB? I first tried to make it AB (which is b-a), but got the wrong position vector and direction vector. AB is what it's supposed to be isn't it?

I know what formula to probably have to use, OP * AB = 0 means the lines are perpendicular. I thought I'd have to denote P by (x,y,z) and find out OP by p - o, which would result in (x,y,z) as well. After this I got lost, and couldn't get the right answer.

The final answer should be 5i+2j+5k

$$\vec {OP}$$ $$\perp$$ $$\vec {AB}:$$

$$\small{((7,-8,7)+t(1,-5,1))\cdot (1,-5,1)=0;}$$

$$54+t(27)=0;$$

$$t=-2.$$

$$\vec {OP}= (7,-8,7)-2(1,-5,1)=(5,2,5)$$.

It doesn’t matter whether you use $$B-A$$ or $$A-B$$, or whether you take $$A$$ or $$B$$ as the fixed point. All of the parameterizations that result describe the same line.

You have a general formula for a point on the line: $$P(t)=\langle7,-8,7\rangle+t\langle1,-5,1\rangle$$. In particular, the direction vector of the line is $$\langle1,-5,1\rangle$$. $$OP$$ is obviously given by exactly the same expression. As you’ve written, for this to be perpendicular to the line, we must have $$OP\cdot\langle1,-5,1\rangle=0$$. This expands into a simple linear equation that you can solve $$t$$ and substitute back into your formula for $$P(t)$$.