# What is the shortest possible length of such a path?

Let $P = (0, 1)$ and $Q = (4, 1)$ be points on the plane. Let $A$ be a point which moves on the $x$-axis between the points $(0, 0)$ and $(4, 0)$. Let $B$ be a point which moves on the line $y = 2$ between the points $(0, 2)$ and $(4, 2)$. Consider all possible paths consisting of the line segments $PA,AB$ and $BQ$. What is the shortest possible length of such a path?

totally stuck on this problem.how can I able to solve this problem

• A geometrical solution: Think about reflections. (If you only had to consider $PA + AQ$, what happens if you reflect $Q$ about $y=0$?)
– user856
Commented Jan 13, 2013 at 11:54

A geometric proof as Rahul Narain hinted in the comments.

The distance from point $$P = (0, 1)$$ to point $$Q = (4, 1)$$ through points $$(a, 0)$$ and $$(b, 2)$$ is the same as the distance from $$P' = (-1, 0)$$ to $$Q' = (4, 3)$$ through the same points, as in the picture below.

The path from $$P'$$ to $$Q'$$ is shortest when it is a straight line. This immediately gives the values of $$a$$ and $$b$$.

• Awesome. This answer makes the OP's question an excellent (almost non-math) riddle. Commented Jan 14, 2013 at 7:10

If point $A$ is at $(a,0)$ and point $B$ is at $(b,2)$, the total length is: $$L=\sqrt{1^2+a^2}+\sqrt{2^2+(b - a)^2}+\sqrt{1^2+(4-b)^2}$$ You are looking for the global minimum of this expression. To do this, differentiate according to $a$ and $b$ and compare the gradient vector to zero. By comparing $\partial L/\partial a$ to zero, you'll find that: $$a (3 a + 2 b) = b^2\ \rightarrow\ a = b/3$$ Now take the derivative with respect to $b$, and plug in $a$: $$\frac{\partial L}{\partial b} = \frac{b-a}{\sqrt{(b-a)^2+4}}-\frac{4-b}{\sqrt{(4-b)^2+1}}$$ After some algebra, you'll find: $$b = 3 \rightarrow a = 1$$

Edit: By symmetry we know that $b = 4 -a$, leading to only needing to calculate one derivative which is much easier.

Hint: (Assuming you are familiar with calculus)

Suppose the point $A$ is at $(a,0)$, $0\leq a\leq 4$ and $B=(b,2)$. Then the total distance is $$D=d(PA)+d(AB)+d(BQ)=\sqrt{a^2+1^2}+\sqrt{(b-a)^2+2^2}+\sqrt{(4-b)^2+1^2}.$$ You then need to find the minimum of this function wrt $a$ and $b$.

More hint: This is when $\frac{\partial D}{\partial a}=0$ and $\frac{\partial D}{\partial b}=0$. This gives $a=1$ and $b=3$. You can do the working to verify this.