In a triangle, G is the centroid of triangle ADC. AE is perpendicular to FC. BD = DC and AC = 12. Find AB. G is the centroid of the triangle ADC. AE is perpendicular to FC. BD = DC
and AC = 12. Find AB.

According to the solution manual, we can let the midpoint of AC be H. D, G, and H are collinear as G is the centroid. Given that AGC is a right triangle, AG is 6, and DG is 12. How come the DG is 6 and DG is 12?
 A: $AG$ is not necessarily $6$. But $HG$ is. Why? Draw a circle with center $H$ of radius $6$. Then $A$ and $C$ are on the diameter, and for any point  $X$ on the circle $\angle AXC=90^\circ$. And the reverse is true, if $\angle AXC=90^\circ$, then $X$ is on the circle. This happens to be the case for $G$. Then $HG=6$. You also know that the centroid divides the median in ratios $2:1$, so $$\frac{DG}{GH}=\frac21$$
so $DG=2GH=12$
A: 
Given AG $\perp$ CG, the midpoint H is the circumcenter of AGC, which yields GH = $\frac12$AC = 6 and in turn DH = 3GH = 18 due to the centroid point G. Then, AB = 2DH = 36 since D and H are the midpoints.
A: 
Since medians $AE$ and $CF$
of $\triangle ADC$ intersect at the right angle,
we must have
\begin{align} 
|AD|^2+|CD|^2&=5\,|AC|^2
\tag{1}\label{1}
.
\end{align} 
Also, we know that the length of the median can be found from
the side lengths of the triangle, in particular
\begin{align}
|DH|&=\tfrac12\,\sqrt{2\,(|AD|^2+|CD|^2)-|AC|^2}
\tag{2}\label{2}
.
\end{align} 
Using \eqref{1}, we have
\begin{align}
|DH|&=\tfrac12\,\sqrt{2\,(5\,|AC|^2)-|AC|^2}
=\tfrac32\ |AC|
=18
\tag{3}\label{3}
.
\end{align} 
So, $|AB|=2|DH|=36$.
