Minimum square sum of inscripted triangle Problem: In a right triangle $ABC$, the hypotenuse is long $4$ and the angle in $B$ is $30°$. Calling $N$ the midpoint on the side $AB$ (the hypotenuse), and $M$ the middle point on the side $CB$, consider a random point on the side $AC$, lets call it $P$ and $AP = x$. Find the value of $x$ such that is minimum the sum of the squares of the sides of triangle $PNM$.
My Solution so far:

I have to minimise $NM^2+NP^2 + PM^2$ and

*

*$NM$ is fixed and equal to $1$, so I should only care about $NP$ and $MP$

*$ABC$ is a right triangle with two angles of one angle of $30°$ then the other angle will be $60°$ and therefore the side $AC$ is half the hypotenuse, therefore $AC=2$, and from this follow that $CB = 2 \sqrt{3}$

*$PM$ is the hypothenuse of the right triangle $CPM$ and therefore its equation is $PM^2 = CM^2 + PC^2 = (\sqrt{3})^2 + (2-x)^2 = x^2 -4x + 7$
But now I'm stuck since I don't know how to correctly parametrise $PN$ as a function of $AP$.
Once found a way to write $PN$ as a function of $AP$ I'm done, since I can write them inside my, equation, take the derivative and find the minimum of the function of $AP$
Final Solution:
Thanks to @mathlove, the triangle $APN$, can be solved by using the Law of Cosines, in our case used on the side $PN$ and with angle $\beta$ it results in:
\begin{equation}\begin{aligned}
 PN^2 &= AP^2 + AN^2 - 2\cdot AP\cdot AN\cdot cos(\beta) = \\
 &= x^2 + 2^2 - 4xcos(60) =\\
&= x^2 -2x + 4
\end{aligned}\end{equation}
Now I finally have an equation of both $PN^2$ and $PM^2$ both depending on $x$ and therefore I can find the minimum:
\begin{equation}\begin{aligned}
PN^2+PM^2 &= x^2 -2x + 4 + x^2 -4x +7 = \\
& = 2x^2 + -6x + 11  
\end{aligned}\end{equation}
Which by deriving in $x$ we obtain $4x -6 = 0$ which implies $x = 3/2$

You can apply the law of cosines to $\triangle{APN}$ to have
$$PN^2=x^2+2^2-4x\cos 60^\circ=x^2-2x+4$$
Also, note that $CB=2\color{red}{\sqrt 3}$.
