So I was trying to solve a problem I saw in a practice set for a 6th-grade math competition, as far as I can remember it. It was a story problem, but I think the solution is the minimum value of

$$ \sqrt{x^2 + 25} + \sqrt{(5-x)^2 + 49} $$

for $x$ in the interval $[0,5]$. I know the derivative at a minimum should be zero, so

$$ {x \over \sqrt{x^2+25}} + {x-5 \over \sqrt{(5-x)^2 + 49}} = 0 $$

I can see by experimentation that the answer is close to $13$, with $x$ close to $2.08$. However, I get stuck after that. If I write as

$$ {x \over \sqrt{x^2+25}} = {5-x \over \sqrt{(5-x)^2 + 49}} $$

can I multiply both sides by the product of the denominators? Can I square both sides? When I do that, I get a fourth-degree polynomial on each side, but the fourth-degree and third-degree term cancel out; and the I'm left with a quadratic equation whose roots are nowhere near the interval I need.

More generally, is there an analytical solution for

$$ \min\left(\sqrt{x^2+y_0^2} + \sqrt{(x_0-x)^2+y_1^2}\right) $$

where $y_0$, $y_1$, and $x_0$ are positive constants?


3 Answers 3


Not many Grade 6 students are comfortable with calculus, so we solve the problem in another way.

Draw the point $P=(0,5)$ and the point $Q=(5,7)$. We want the point $X=(x,0)$ on the $x$-axis such that the sum of the distances $PX$ and $XQ$ is a minimum. (We also want $0\le x\le 5$, but that will turn out to be irrelevant.)

Let $P'=(0,-5)$. By symmetry we want $P'X+XQ$ to be a minimum.

Join $P'$ and $Q$. Putting $X$ where $P'Q$ meets the $x$-axis minimizes the sum of the distances. (The straight line path from $P'$ to $Q$ minimizes the distance travelled.)

By the Pythagorean Theorem, the distance $P'Q$ is $\sqrt{5^2+12^2}$.

  • 1
    $\begingroup$ I suspect that the original 'story' problem was about finding this minimum distance, and that the OP complificated things by expressing the distance as an algebraic expression. $\endgroup$
    – TonyK
    Mar 12, 2016 at 2:55
  • $\begingroup$ @TonyK: The result, in geometric form, would be familiar to a lot more contest kids than would the calculus approach. $\endgroup$ Mar 12, 2016 at 3:00
  • $\begingroup$ @TonyK: you're right; well, not the "reflection" distance, but a distance wrapped around the edge of a 3D object. $\endgroup$
    – david
    Mar 12, 2016 at 12:29

The minimum to the general case $\sqrt{x^2+a^2}+\sqrt{(b-x)^2+c^2}$ is found (as you correctly noticed) by differentiating, setting equal to zero, and solving for $x$.

After some tedious computations (or letting a computer do the work for you) you get:

$$x_{min}=\frac{ab}{a\pm c}$$

Putting in the values from your specific problem, we that $$x_{min}=\frac{25}{12}=2.08\overline{33}$$

As pointed out in the comments, note that when trying to find a minimum in a specific interval, you have to check the end-points as well.

  • 1
    $\begingroup$ See my warning about endpoints, though. $\endgroup$ Mar 11, 2016 at 23:17
  • $\begingroup$ @CarlHeckman Yeah, it's probably good to throw in there, although I wrote my answer more with the general case (without the interval) in mind. Thanks! $\endgroup$ Mar 11, 2016 at 23:20

You can do both things that you mentioned, and you should get the equation $$x^2\left((5-x)^2+49\right)=(5-x)^2(x^2+25)$$ which simplifies to $$24 x^2 +250x-625=0.$$ The roots are $25/12$ and $-25/2$; you discard $-25/2$ because it's outside of the interval $[0,5]$. (These are the so-called critical points.)

However, you also should check the endpoints ($0$ and $5$), because in some problems, that's where the minimum is. The minimum actually turns out to be at $x=25/12$, a little over $2$.

In answer to your second question, the analysis can be done with generic constants $x_0$, $y_0$ and $y_1$; however, if you're finding the minimum value over an interval, you also need to check the endpoints, and whether the critical points are within that interval. For the record, the critical points are: $${x_0 \left(y_0 \pm y_1\sqrt{y_0}\right)\over y_0 -y_1^2},$$ unless of course $y_1^2=y_0$, in which case the only critical point is $\displaystyle {x_0 \over 2}$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .