I'm struggling to understand the sketch given in the solution of my problem. The question states the point $P$ lies on the vector $AB$, which means $P$ should be between the points $A$ and $B$ right?
Question & solution:
Hint: let $\overrightarrow{BP} = q$ then $\overrightarrow{AP} = 2q$ by construction.
Then $p=a+2q=b+q\,$, and eliminating $q$ between the two equations gives $p$ in terms of $a,b\,$.
As has been written in the comment, we look for a point $P$ on the line through $A$, $B$ such that the distance $|AP|$ is 2 times the distance $|BP|$ and the point $P$ should be chosen such that the vector starts at A and goes to P. This can be done by 'pasting' the vector $AB$ in direction of the line through $A,B$ at the point $B$. We could also solve this using coordinates: We have that $A = (5,4,1)$ and $B = (-1,1,-2)$. Denote $P = (x_1, x_2, x_3)$, then the condition $AP = 2BP$ is equivalent with the following system of linear equations: \begin{equation} \begin{cases} x_1 - 5 = 2(x_1 - (-1))\\ x_2 - 4 = 2(x_2 - 1)\\ x_3 - 1 = 2(x_3 - (-2)) \end{cases} \end{equation} We then find $P = (-7, -2, -5)$.