Triangles and medians Let G be the ABC barycenter. A line intersects the medians AD, BE and CF in X, Y and Z, respectively. Prove that
$$\frac{XD}{XG}+\frac{YE}{YG}+\frac{ZF}{ZG}=3$$
By areas relations I found that
$\frac{XG\cdot YG}{BG\cdot DG}=\frac{6SG_{\triangle XYG}}{S_{\triangle ABC}}\\
\frac{XG\cdot ZG}{CG\cdot DG}=\frac{6SG_{\triangle XZG}}{S_{\triangle ABC}}\\
\frac{YG\cdot ZG}{BG\cdot CG}=\frac{3SG_{\triangle YZG}}{S_{\triangle ABC}}$
And using that
$S_{GYZ}=S_{GXZ}+S_{GXZ}$
I wrote
$$XG\cdot YG\cdot CG+XG\cdot ZG\cdot BG=2YG\cdot ZG\cdot DG$$
But I can't solve this problem.
Can someone help me?
Thanks for antetion!
 A: Denote by $\ell$ the line through $X, Y, Z$. Define a function $f: \mathbb{R}^2 \to \mathbb{R}$ by $$ f(P) := \text{dist}(P, \ell). $$ It is easy to see that $f$ is linear (as a map of vector spaces). Since $G$ is the barycenter (centroid) of $\triangle ABC$, we have $3G = A + B + C = D + E + F$, and hence $$ f(D) + f(E) + f(F) = 3f(G). $$ By similar triangles, we have $XD/XG = f(D)/f(G)$, along with two other analogous relations. Therefore, $$ \frac{XD}{XG} + \frac{YE}{YG} + \frac{ZF}{ZG} = \frac{f(D)}{f(G)} + \frac{f(E)}{f(G)} + \frac{f(F)}{f(G)} = 3. $$
N.B. The quantities in the problem statement must be interpreted as signed lengths, e.g. the quantity $XD/XG$ is positive if the rays $\overrightarrow{XD}$ and $\overrightarrow{XG}$ point in the same direction and negative otherwise.
A: Without loss of generality, we can scale and place the triangle so that its center of mass is in the origin and one of its vertices is on the $y$-axis at a unitary distance from the center of mass. So the vertices are $A(0,1)$, B$(p,q)$, and $C(-p,r)$. By well known properties of the medians, the midpoints of $BC$, $AC$, and $AB$ are, respectively:
$$D\Big(0, -\frac{1}{2}\Big)$$
$$E\Big(-\frac{p}{2}, -\frac{q}{2}\Big)$$
$$F\Big(\frac{p}{2}, -\frac{r}{2}\Big)$$

Also note that, because the $y$-coordinate of $D$ is the average  of the $y$-coordinates of $B$ and $C$, we have $(q+r)/2=-1/2$ and then $q+r=-1$.
The medians correspond to the lines
$$AD\rightarrow\,\,\, x=0$$
$$BE\rightarrow\,\,\, y=\frac{q}{p}\,x$$
$$CF\rightarrow\,\,\, y=-\frac{r}{p}\,x  $$
Now let us draw a line $y=mx+n$, not parallel to any of the medians.  Its intersections with the medians $AD$, $BE$, and $CF$ are, respectively
$$X\left(0,n \right)$$
$$Y\left(\frac{np}{q-mp},  \frac{nq}{q-mp} \right)$$
$$Z\left(-\frac{np}{r+mp},  \frac{nr}{r+mp}\right)$$
Then we have
$$\frac{XD}{XG}=\left|\frac{n+1/2}{n}\right|=1+\frac{1}{2n}$$
$$\frac{YE}{YG}=\frac{ \sqrt{ 
      \left(     \frac{np}{q-mp}+\frac{p}{2}
      \right)^2+\left(    
  \frac{nq}{q-mp}+\frac{q}{2}     \right)^2     }}{   \sqrt{ 
      \left(     \frac{np}{q-mp}
      \right)^2+\left(    
  \frac{nq}{q-mp}\right)^2      }     }\\
=\sqrt{1+\frac{(np^2+nq^2)(q-mp)  }{n^2(p^2+q^2)}+\frac{(p^2+q^2)(q-mp)^2}{4n^2(p^2+q^2)}
   }\\
\sqrt{ 1+\frac{q-mp}{n}+ \frac{(q-mp)^2}{4n^2} }\\
= 1+\frac{q-mp}{2n} $$
$$\frac{ZF}{ZG}=\frac{ \sqrt{ 
      \left(     \frac{-np}{r+mp}-\frac{p}{2}
      \right)^2+\left(    
  \frac{nr}{r+mp}+\frac{r}{2}     \right)^2     }}{   \sqrt{ 
      \left(     \frac{-np}{r+mp}
      \right)^2+\left(    
  \frac{nr}{r+mp}\right)^2      }     }
\\
=\sqrt{1+\frac{(np^2+nr^2)(r+mp)  }{n^2(p^2+r^2)}+\frac{(p^2+r^2)(r+mp)^2}{4n^2(p^2+r^2)}
   }\\
\sqrt{ 1+\frac{r+mp}{n}+ \frac{(r+mp)^2}{4n^2} }\\
= 1+\frac{r+mp}{2n} 
$$
Therefore
$$\frac{XD}{XG}+\frac{YE}{YG}+\frac{ZF}{ZG}\\= 1+\frac{1}{2n}+1+\frac{q-mp}{2n}  + 1+\frac{r+mp}{2n} \\
= 3+\frac{1}{2n}+\frac{q+r}{2n}  $$
and since $q+r=-1$, we get
$$\frac{XD}{XG}+\frac{YE}{YG}+\frac{ZF}{ZG}= 3$$
