Deriving of formula for finding the length of median In the below image

$AD$ is the median of $\triangle ABC$
We know that $m_A = \frac 1 2 \sqrt{2b^2 + 2c^2 - a^2} $  
But can someone tell me how it's derived !! I am just unable to think of it !! 
But I assume it muste be linked with the Appolonius Theorem !!
 A: Let $AM=2AD$, then $ACMB - $parallelogram. Then $$2(AC^2+AB^2)=AM^2+BC^2$$
$$2(b^2+c^2)=4m_a^2+a^2$$
$$m_a^2=\frac{2b^2+2c^2-a^2}{4}$$
A: Let $\theta$ denote the angle at the bottom-left corner of the figure (i.e. $\theta = \angle ABD$).  Then the law of cosines, applied to triangle $ABD$, tells us:
$$(m_A)^2 = c^2 + (a/2)^2 - 2(a/2)c\cos\theta$$
But the same law of cosines, applied to triangle $ABC$, tells us
$$b^2 = c^2 + a^2 - 2ac\cos\theta$$
From these two equations, you can derive the desired formula:  just solve the second equation for $\cos\theta$ in terms of $a, b, c$ and substitute that into the first equation.
A: Here's a self-contained argument:

We drop perpendiculars from $B$ and $C$ to $B^\prime$ and $C^\prime$ on $\overleftrightarrow{AM}$, where $M$ is the midpoint of $\overline{BC}$. We readily deduce that $\triangle MBB^\prime \cong \triangle MCC^\prime$, so that
$$\begin{align}
\overline{BB^\prime} \cong \overline{CC^\prime} \quad\text{, with common length we'll denote } h \\
\overline{MB^\prime} \cong \overline{MC^\prime} \quad\text{, with common length we'll denote } k
\end{align}$$
Invoking Pythagoras' Theorem on various right triangles, and writing $d$ for $|\overline{AM}|$ (and assuming, without loss of generality, that $b \geq c$, to alleviate a minor sign ambiguity), gives ...
$$\begin{align}
\triangle MBB^\prime: \quad \left(\frac{a}{2}\right)^2 &= h^2 + k^2 \quad\quad\quad\;\;\to\quad a^2 = 4 h^2 + 4 k^2 \\[4pt]
\triangle ACC^\prime: \quad\,\;\;b^2\;\;\, &= h^2 + \left(d + k\right)^2 \quad\to\quad b^2 = h^2 + k^2 + d^2 + 2 k d \\[8pt]
\triangle ABB^\prime: \quad\,\;\;c^2\;\;\, &= h^2 + \left(d - k\right)^2 \quad\to\quad c^2 = h^2 + k^2 + d^2 - 2 k d
\end{align}$$
The result immediately follows: 
$$-a^2 + 2b^2 + 2 c^2 = 4 d^2 \qquad\square$$
