I've some questions about the proof of

As you can see there are two parts to the proof.

Let be a line and let be a point. There is a unique point on for which is orthogonal to . Moreover, is given by

the following formulas:

where is any point on , is a unit vector in the direction of , and is a unit vector orthogonal to .

Proof:

can be parameterized as (Vector equation of line). We seek a point for which is orthogonal to the direction of the line, i.e. for which

This relation has a unique solution Substituting for in gives the first

formula(first proof) for in the statement of the result.

My question is:

How did the author find the solution from the equation? What method he used for this?

How did he conclude that ?

And back to the proof.

Substituting into:

gives the second part of the proof.

How to prove by substituting into ?