Consider point $A(5, 2)$ and variable points $B(a, a)$ and $C(b,0),\, a\in R, \, b\in R$. If the perimeter of $\triangle ABC$ is minimum, find $a$ and $b$.
My attempt:
$\begin{align} P&=AB+BC+CA\\ &=\sqrt{(a-5)^2+(a-2)^2}+\sqrt{(a-b)^2+(a)^2}+\sqrt{(5-b)^2+(2)^2} \end{align}$
I tried to partial differentiate the equation w.r.t. $a$ and $b$ and solve for $a$ and $b$ and obviously I didn't get the answer as the derivative of square root into its argument is getting much more complicated. I didn't show the calculations here as it is very tedious.
I also know that this is not the expected method to solve this problem. It has something to do with "For minimum length, path followed by light ray is to be traced". But I don't know how to apply it here.
Any hints are appreciated!
Suppose we draw $\triangle ABC$. Reflect $A$ about the line $y = x$, to the point $A' = (2,5)$. Also, reflect $A$ about the line $y = 0$ to the point $A'' = (5,-2)$. Then the side $AB$, when reflected about $y = x$, becomes $A'B$, and the side $AC$, when reflected about $y = 0$, becomes $A''C$, and the path $A'BCA''$ has the same length as the perimeter of $\triangle ABC$ because $A'B = AB$ and $A''C = AC$. For what choice of $B$ and $C$ do we have the shortest possible distance between $A'$ and $A''$, and therefore the least possible perimeter?