<s>[INST] Let $ABC$ be a triangle and $M$ be the midpoint of $BC$. Squares $ABQP$ and $ACYX$ are erected. Show that $PX = 2AM$. 
$\textbf{Question:}$ Let $ABC$ be a triangle and $M$ be the midpoint of $BC$. Squares $ABQP$ and $ACYX$ are erected. Show that $PX = 2AM$.

I could solve this problem using computational techniques but I am looking for purely synthetic solution. I tried drawing some extra midpoints, connected them. But still couldn't find the solution.
Any kind of hint or full solution both are appreciated.
 [/INST] Let's first give names to the sides of $\overset{\Delta}{PAX}$ triangle: $|PA| = k$, $|AX| = m$ and $|PX| = b$. Also for $\overset{\Delta}{ABC}$ triangle: $|AB| = k$, $|AC| = m$, $|BC| = 2l$ and the length of the median $|AM| = a$. Writing law of cosines for $\overset{\Delta}{PAX}$ triangle for angle $\widehat{PAX}$, which is the opposite of angle $\widehat{A}$ in $\overset{\Delta}{ABC}$ triangle, along with the fact that $\widehat{PAB} = 90^{\circ}$ and $\widehat{XAC} = 90^{\circ}$ ($\widehat{PAX} + \widehat{A} + \widehat{PAB} + \widehat{XAC} = 360^{\circ}$), we have:
\begin{align*}
b^{2} &= k^{2} + m^{2} - 2\ k\ m\ cos (180^{\circ} - \widehat{A}) \\
b^{2} &= k^{2} + m^{2} + 2\ k\ m\ cos (\widehat{A}) \tag{1}
\end{align*}
Then write the same law for $ABC$ triangle along with Apollonius's theorem and we have:
\begin{align*}
(2l)^{2} &= k^{2} + m^{2} - 2\ k\ m\ cos(\widehat{A}) \\
4 l^{2} &= k^{2} + m^{2} - 2\ k\ m\ cos(\widehat{A}) \tag{2}
\end{align*}
\begin{align*}
k^{2} + m^{2} = 2(l^{2} + a^{2}) \tag{3}
\end{align*}
Summing $(1)$ and $(2)$ and using the right-hand side of $(3)$ in place of $k^{2} + m^{2}$ we get:
\begin{align*}
b^{2} + 4 l^{2} &= 2 (k^{2} + m^{2}) \\
b^{2} + 4 l^{2} &= 4 (l^{2} + a^{2}) \\
b^{2} &= 4 a^{2} \\
b &= 2a \implies |PX| = 2 |AM| 
\end{align*}
</s>