Where find point $M$ on diagonal of cuboid $ABCDPQRS$ such that the sum $MA+MD$ is minimal? Let a rectangular cuboid of bases $ABCD$ i $PQRS$ such that $AB=1 , BC=2 , AP=3$ . How find on the diagonal $BS$ of the cuboid a point $M$ such that the sum $MA+MD$ is minimal?
 A: Let $A = (0,0,0)$, $B = (1,0,0)$, $C = (1,2,0)$, $R = (1,2,3)$, $D = (0,2,0)$, $P = (0,0,3)$, $Q = (1,0,3)$, $S = (0,2,3)$. Point $M$ can be expressed as: $t(1,0,0) + (1-t)(0,2,3) = (t,2-2t,3-3t)$, $t \in [0,1]$. Thus: $MA + MD = \sqrt{(t-0)^2 +(2-2t-0)^2 + (3-3t-0)^2} + \sqrt{(t-0)^2 +(2-2t-2)^2 + (3-3t-0)^2} = \sqrt{t^2 + 13(1-t)^2} + \sqrt{5t^2 + 9(1-t)^2} = f(t)$. We can use calculus to find $f_{min}$. You can continue. Once you find critical value $t_0$ which minimizes $f$, then use this same value $t_0$ to find the point $M$.
A: Take some coordinates:
\begin{align*}
A&=(0,0,0) & B&=(1,0,0) & C&=(1,2,0) & D&=(0,2,0) \\
P&=(0,0,3) & Q&=(1,0,3) & R&=(1,2,3) & S&=(0,2,3)
\end{align*}
Now you are looking for a point
$$M=B+\lambda(S-B)=(1-\lambda)B + \lambda S=(1-\lambda,2\lambda,3\lambda)$$
which minimizes
\begin{align*}
f&=\lVert M-A\rVert+\lVert M-D\rVert\\&=
\sqrt{(1-\lambda)^2+(2\lambda)^2+(3\lambda)^2}
+\sqrt{(1-\lambda)^2+(2-2\lambda)^2+(3\lambda)^2}
\end{align*}
in the domain $\lambda\in[0,1]$. You can differentiate to find extrema:
$$\frac{\mathrm df}{\mathrm d\lambda}=
\frac{14 \, \lambda - 1}{\sqrt{{\left(\lambda - 1\right)}^{2} + 13 \, \lambda^{2}}} + \frac{14 \, \lambda - 5}{\sqrt{5 \, {\left(\lambda - 1\right)}^{2} + 9 \, \lambda^{2}}}$$
Setting that to zero will yield
$$\lambda=\frac{3\sqrt{65} - 5}{112}$$
So your optimum is at
$$M=\left(\frac{117 - 3\sqrt{65}}{112},
\frac{3\sqrt{65} - 5}{56},
\frac{9\sqrt{65} - 15}{112}\right)$$
for the coordinates I chose. If you have different coordinates, the coordinates of $M$ might differ as well, but the linear combination to compute it stays the same.
