Modeling all with linear algebra.
The lines through the sides are:
$$
\begin{align}
g_a(t) &= u_B + (u_C - u_B) t \\
g_b(t) &= u_C + (u_A - u_C) t \\
g_c(t) &= u_A + (u_B - u_A) t
\end{align}
$$
One then goes for the normals, looking for solutions to
$$
\begin{align}
n_a \cdot (u_C-u_B) = 0 \\
n_b \cdot (u_A-u_C) = 0 \\
n_c \cdot (u_B-u_A) = 0
\end{align}
$$
In two dimension given a vector $v = (x, y)$, the vector $w = (y, -x)$ is orthogonal, as $v \cdot w = xy - yx = 0$. The normal to $v$ is then $n = w / |w|$, where $|v| = \sqrt{x^2 + y^2}$ is the norm of the vector $v$.
With this recipe you can find the tree normals to the given difference vectors.
The normal lines through the triangle corners are then:
$$
\begin{align}
h_a(t) &= u_A + n_a t \\
h_b(t) &= u_B + n_b t \\
h_c(t) &= u_C + n_c t
\end{align}
$$
Then one would solve for an intersection of those normal lines, considering two lines should be enough:
$$
h_b(t_b) = h_c(t_c) \iff \\
u_B + n_b t_b = u_C + n_c t_c \iff \\
n_b t_b - n_c t_c = u_C - u_B \iff \\
L x = y \\
x = L^{-1} y
$$
with the matrix $L = (n_b,-n_c)$, solution vector $t = (t_b, t_c)$ and inhomogenity $y = u_C - u_B$.
For $2\times 2$-matrices the inverse can be calculated with this:
$$
L =
\left(
\begin{matrix}
\alpha & \beta \\
\gamma & \delta
\end{matrix}
\right)
\Rightarrow
L^{-1} =
\frac{1}{\det L}
\left(
\begin{matrix}
\delta & -\beta \\
-\gamma & \alpha
\end{matrix}
\right)
$$
where $\det L = \alpha\delta - \beta\gamma$ is the determinant, which needs to be not zero.
Finally you would use one of the found solutions $(t_b, t_c)$ and put it into the normal line to get the coordinates of the orthocenter, for example
$$
h_b(t_b) = u_B + n_b t_b
$$