Calculation of the Coordinates of the Intersection Point of the Altitude and the Base of a Triangle Given any triangle $\Delta ABC$, what are the coordinates of the point $D$, along the line $\overline{BC}$, such that $\overline{AD}$ is perpendicular to $\overline{BC}$?
For example, given the triangle $\Delta ABC$, where $(A_x = -1,\ A_y = 4)$, $(B_x = -1,\ B_y = 2)$, and $(C_x = 5,\ C_y = 1)$, the solution is $(D_x = 1.4,\ D_y = -0.8)$. I know the solution to this particular example from watching this video explaining how to calculate altitudes. This was one of the examples used in the video, but it was calculated using a multi-step process.
I know that the slope of line segment $\overline{BC}$ is the negative inverse of $m_\overline{BC}$.
$$m_\overline{BC} = \frac{y_2 - y_1}{x_2 - x_1}$$
$$m_\overline{BC} = \frac{1 - (-2)}{5 - (-1)}$$
$$m_\overline{BC} = \frac{1}{2}$$
$$m_\overline{AD} = \frac{-1}{\frac{1}{2}}$$
$$m_\overline{AD} = -2$$
Despite being able to calculate the slope of the line, I’m not sure at what point it will intersect $\overline{BC}$.
I am searching for a general formula to calculate the $x$ and $y$ Cartesian coordinates of point $D$. Please provide a explicit solution for the $x$ and $y$ coordinates of $D$ denoted by $D_x$ an $D_y$, respectively.
 A: Here is a step by step approach.
$1.$ As we have the coordinates of $B$ and $C$, we can compute a unit normal vector to the line segment $BC$. This is how yo may do this
$$\begin{align}
{\bf{L}}&= {\bf{x}}_B-{\bf{x}}_C\\
&=(x_B-x_C){\bf{i}}+(y_B-y_C){\bf{j}} \\
\\
{\bf{N}}&= {\bf{k}} \times {\bf{L}}\\
&=-(y_B-y_C){\bf{i}}+(x_B-x_C){\bf{j}} \\
\\
{\bf{N}} \cdot {\bf{L}} &= 0 \\
\\
{\bf{n}} &= \frac{\bf{N}}{\|\bf{N}\|} \\
&= \frac{{\bf{k}} \times {\bf{L}}}{\|\bf{L}\|} \\
&= \frac{{\bf{k}} \times ({\bf{x}}_B-{\bf{x}}_C)}{\|{\bf{x}}_B-{\bf{x}}_C\|}\\
&=\frac{-(y_B-y_C){\bf{i}}+(x_B-x_C){\bf{j}}}{\sqrt{(x_B-x_C)^2+(y_B-y_C)^2}}
\end{align}$$
$2.$ We can observe from the figure below that
$$d = ({\bf{x}}_B-{\bf{x}}_A)\cdot{\bf{n}}$$
so we have found the length of $AD$.

$3.$ The coordinates of $D$ will be
$$\begin{align}
{\bf{x}}_D &= {\bf{x}}_A + d{\bf{n}} \\
&= {\bf{x}}_A + [({\bf{x}}_B-{\bf{x}}_A)\cdot{\bf{n}}]{\bf{n}} \\
\\
&= {\bf{x}}_A + \left[({\bf{x}}_B-{\bf{x}}_A)\cdot\frac{{\bf{k}} \times ({\bf{x}}_B-{\bf{x}}_C)}{\|{\bf{x}}_B-{\bf{x}}_C\|}\right]\frac{{\bf{k}} \times ({\bf{x}}_B-{\bf{x}}_C)}{\|{\bf{x}}_B-{\bf{x}}_C\|} \\
\end{align}$$
and finally
$$\boxed{{\bf{x}}_D= {\bf{x}}_A + \frac{{\bf{k}} \cdot \left[ ({\bf{x}}_B-{\bf{x}}_C) \times ({\bf{x}}_B-{\bf{x}}_A) \right] \ }{\|{\bf{x}}_B-{\bf{x}}_C\|^2} {\bf{k}} \times ({\bf{x}}_B-{\bf{x}}_C)}$$
you can write the above vector equation as the following two scalar ones
$$\boxed{
\begin{align}
x_D &= x_A - \frac{\begin{vmatrix}
x_B-x_C & y_B-y_C \\
x_B-x_A & y_B-y_A \\
\end{vmatrix}}{(x_B-x_C)^2+(y_B-y_C)^2} (y_B-y_C) \\
\\
y_D &= y_A + \frac{\begin{vmatrix}
x_B-x_C & y_B-y_C \\
x_B-x_A & y_B-y_A
\end{vmatrix}}{(x_B-x_C)^2+(y_B-y_C)^2} (x_B-x_C)
\end{align}
}$$
Also, here is a MAPLE file that can help the reader of this post for the computation of final formulas mentioned here and the verification of the example mentioned in the question.
A: Let $A:(x_1,y_1)$, $B:(x_2,y_2)$, $C:(x_3,y_3)$.
So the equation of line through $BC$ will be, $$y-y_2=(\frac{y_2-y_3}{x_2-x_3})(x-x_2)$$
And thus, the slope of altitude will be negative inverse, 
$$-\left(\frac{x_2-x_3}{y_2-y_3}\right)$$
And thus, the equation of the line:
$$y=c-\left(\frac{x_2-x_3}{y_2-y_3}\right)x$$
Putting in the values and solving for $c$, gives the equation, 
$$y=y_1+\left(\frac{x_2-x_3}{y_2-y_3}\right)x_1-\left(\frac{x_2-x_3}{y_2-y_3}\right)x$$
Now just solve the two equations simultaneously.


Hint: To do that, let
$$\left(\frac{y_2-y_3}{x_2-x_3}\right)=m$$
So we have to solve $$y=y_2+m(x-x_2)$$
$$y=y_1+\frac1mx_1-\frac1mx$$

This is an elementary approach, a slightly more advanced approach would be to rotate the triangle, so its base is parallel with the x-axis. There are various formulae for it for example:
$$\begin{bmatrix}\cos\theta \ -\sin\theta \\ \sin\theta \ \ \ \ \ \cos\theta\end{bmatrix}$$
the rotation matrix. Or Rotation Formulae. 
Then translate it so that one of the base vertices are on the origin, and then use the method above, it would simplify a hell lot of a things.
