<s>[INST] 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?
 [/INST] 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$.
</s>