Question: I am trying to solve the following question:  

Let $L$ be the line passing through the point $A(5,-6, 7)$ parallel to the x–axis. Write down the coordinates of the point B on L which is closest to $C(1, 3, 4)$.

This is what I have tried doing so far:  

Since the line is parallel to the x-axis, the equation of the line is:  

$L = (5, -6, 7) + t(1, 0, 0)$
So the coordinates of the point B will be:  

$x = 5+t$  

$y=-6$  

$z=7$ 

I have got the $y$ and $z$ coordinates, but I am unable to find the $x$-coordinate because of the scalar, $t$. 

Could someone please check whether I am on the right track, and help me find the $x$-coordinate? Thanks :)

Answer: 
There is a very straightforwatd method using dot product. For the line equation $$\underline{r}=\underline{a}+\lambda\underline{b},$$where $\underline {a}$ is a known fixed point on the line and $\underline{b}$ is the direction of the line, then the closest point to $P$ with position vector $\underline{p}$ is found by solving the equation $$(\underline{r}-\underline{p})\cdot\underline{b}=0$$ to obtain the parameter value for the foot of the perpendicular from $P$ to the line.

In this case, you have $$\underline{r}-\underline{p}=\left(\begin{matrix}5\\-6\\7\end{matrix}\right)+\lambda\left(\begin{matrix}1\\0\\0\end{matrix}\right)-\left(\begin{matrix}1\\3\\4\end{matrix}\right)=\left(\begin{matrix}4+\lambda\\-9\\3\end{matrix}\right)$$

Therefore $$\left(\begin{matrix}4+\lambda\\-9\\3\end{matrix}\right)\cdot\left(\begin{matrix}1\\0\\0\end{matrix}\right)=0\Rightarrow \lambda=-4$$

Hence $$\underline{r}=\left(\begin{matrix}1\\-6\\7\end{matrix}\right)$$
Try to merge algebra with geometry within you own mind. The answer should be obvious with few calculations.

[![enter image description here](https://i.stack.imgur.com/i9bDP.png)](https://i.stack.imgur.com/i9bDP.png)