Let $l$ be the line in $\mathbb{R}^n$ whose parametric equation is $\boldsymbol{\alpha}(t) = \boldsymbol{a} + t\boldsymbol{v}$, and let $\boldsymbol{p}$ be a point in $\mathbb{R}^n$. Suppose that $\boldsymbol{q}$ is the point at the foot of the perpendicular formed from $\boldsymbol{p}$ to $l$.
Since $\boldsymbol{q}$ lies on $l$, there is a value of $t$ that satisfies $\boldsymbol{q} = \boldsymbol{a} + t\boldsymbol{v}$. Find a formula for $t$ in terms of $\boldsymbol{a}, \boldsymbol{v}$, and $\boldsymbol{p}$. Hint: $l$ lies in a direction perpendicular to $\boldsymbol{p - q}$.
This is a very basic question from an introductory multivariable calculus text, but I seem to be missing an intuition. Algebraically, $t = \frac{q - a}{v}$. Also, since $\boldsymbol{p - q}$ is perpendicular to $l$ then the dot product of any vector parallel to $l$ and $\boldsymbol{p - q}$ is $0$.
Still, I'm failing to see how we get to the answer of
$$\frac{\boldsymbol{v} \cdot(\boldsymbol{p - a})}{\boldsymbol{v}\cdot \boldsymbol{v}} $$
Thanks for any insight.
The straight line $l$ is perpendicular to $\boldsymbol{p}-\boldsymbol{q}$, hence $$\boldsymbol{v}\cdot (\boldsymbol{p-q})=0\tag{1}$$
Next, we take the dot-product to the both sides of the equation: $\boldsymbol{q} = \boldsymbol{a} + t\boldsymbol{v}$, and get
$$\boldsymbol{v}\cdot\boldsymbol{q} = \boldsymbol{v}\cdot\boldsymbol{a} + t(\boldsymbol{v}\cdot\boldsymbol{v})$$
Use eq.(1) to replace $\boldsymbol{v}\cdot\boldsymbol{q}=\boldsymbol{v}\cdot\boldsymbol{p}$
$$\boldsymbol{v}\cdot\boldsymbol{p} = \boldsymbol{v}\cdot\boldsymbol{a} + t(\boldsymbol{v}\cdot\boldsymbol{v})$$
therefore, $$\boxed{t=\frac{\boldsymbol{v} \cdot(\boldsymbol{p - a})}{\boldsymbol{v}\cdot \boldsymbol{v}}} $$