# Uphill and downhill [closed]

Harry walked from village $X$ to village $Y$ which took him $8$ hours. Then he walked back from $Y$ to $X$ (following exactly the same path) in $9$ hours and $20$ minutes.

• When walking uphill, Harry makes $5.6$ miles per hour.
• When walking in the plane, he makes $6.3$ miles per hour.
• And when walking downhill, he makes $7.2$ miles per hour.

What's the distance from village $X$ to village $Y$?

• I am 99% sure that it's a math question. May 18, 2016 at 10:00
• @manshu: It's a math puzzle with a sweet two-line solution. May 18, 2016 at 10:51
• I think this question should specify more detail, otherwise it is too broad. Is it the entire trip that takes 9hr20 or just the walk back? If the former does this include his stay in Y? Does Harry take the same route back or not? May 18, 2016 at 15:41
• @KeyboardWielder isn't having infinite solutions too broad? :p May 18, 2016 at 21:35
• This is a puzzle in the vein of Martin Gardner's famous "Hole in the Sphere" puzzle, which is described along with its mathematical and lateral thinking solutions here (scroll to "Martin Gardner Puzzle") May 19, 2016 at 17:56

The distance from $X$ to $Y$ is

$54.6$ miles

Because

His average speed over the whole journey (from $X$ to $Y$ and back again) is $6.3$ miles per hour and it takes a total of $17$ hours and $20$ minutes.

Reasoning

Let's say a stretch of sloped hill is $M$ miles long and he walks upward on the way there and down on the way back. Then it takes $\frac{M}{5.6}$ hours the first time and it takes $\frac{M}{7.2}$ hours the second time. On average, he walks that distance, $2M$, in $\frac{M}{5.6} + \frac{M}{7.2}$ hours so his average speed if $\frac{2}{\frac{1}{5.6} + \frac{1}{7.2}} = 6.3$ miles per hour.
Obviously, the numbers are reversed for downhill sections of the first journey and on the flat bits the speed $6.3$ both times.

• This is beautiful @___@ May 23, 2016 at 0:34

The answer to the problem is

There are infinitely many solutions for the system of equations
U/5.6 + D/7.2 + F/6.3 = 8
U/7.2 + D/5.6 + F/6.3 = 9 1/3
This is setting the uphill portion going one direction to the downhill portion of the opposite direction.

However, based on the title I inferred that there is only uphill and downhill, with no flat planes. Now the system is
U/5.6 + D/7.2 = 8
U/7.2 + D/5.6 = 9 1/3
Which has the solution U = 44.1 and D = 10.5

If my inference is correct the distance between X and Y is 54.6

• Apparently we had the same reasoning, nice ! May 18, 2016 at 15:25
• I don't have enough rep to comment on your post, but +1 to you for typing your answer faster than me haha May 18, 2016 at 15:34
• As I see it, you typed faster :p May 18, 2016 at 15:37
• @Kalissar haha whoops, leave it to me people to solve linear equations one minute but not realize that 24 minutes ago was sooner than 21 minutes ago... haha keep the +1, clearly you deserve it more than me May 18, 2016 at 15:43
• The fact that there are infinitely many solutions for the 2 equations in U,D,F does not itself prove that there are infinitely many solutions to the problem, which is to find U+D+F. Add the 2 and you will see them yield U+D+F = constant. Geometric interpretation: Yes, the 2 planes corresponding to the 2 equations intersect in an infinitely long 3-d line, and the function of interest corresponds to a family of infinite parallel planes; but that line is also parallel to all of them, and hence is entirely contained in exactly one plane of that family and does not intersect the rest. May 18, 2016 at 19:55

While I like hexomino's answer, I think it can be even more deterministic with a bit of meta information.

The puzzle is named "Uphill and Downhill" only, not "Uphill, flathill and downhill", so I think it can be shortened to a 2 variables problem.

So if we assume that

there is no flat part between the two cities.

We can write

$\frac{U}{5.6}+\frac{D}{7.2} = 8$ and $\frac{U}{7.2}+\frac{D}{5.6}=\frac{28}{3}$

which evaluates to

$U = 10.5$ and , $D = 44.1$ In miles, of course.

So the distance, which is

the sum of the two, is $54.6$ Miles

EDIT Since the changes made by Gamow the question is a simple math problem and is solved by hexomino's answer

EDIT 2 I believe that the two line solution wanted is:

From $X$ to $Y$ call uphill $u$, downhill $d$, plane $p$; the distance we require is $u+d+p$
Now the total walk from $X$ to $Y$ and back takes $\frac{52}{3}$ hours, so
$$\frac{52}3 = \frac{u+d}{5.6}+\frac{u+d}{7.2}+\frac{2p}{6.3}$$
hence
$$u+d+p=\frac{52}3 \times \frac{6.3}{2} = 54\frac6{10}$$

why?

because
$$\frac{1}{5.6}+\frac{1}{7.2} = \frac{2}{6.3}$$
which may be seen by multiplying through and simplifying: $$\frac{1}{5.6}+\frac{1}{7.2} = \frac{720}{56\times72}+\frac{560}{56\times72} = \frac{720+560}{56\times72} = \frac{1280}{4032} = \frac{20\times64}{63\times64} = \frac{20}{63} = \frac{2}{6.3}$$
so \begin{align}\frac{52}3 &= \frac{u+d}{5.6}+\frac{u+d}{7.2}+\frac{2p}{6.3} \\ \rightarrow \frac{52}3 &= (u+d)(\frac{1}{5.6}+\frac{1}{7.2})+p\frac{2}{6.3} \\ \rightarrow \frac{52}3 &= (u+d)\frac{2}{6.3}+p\frac{2}{6.3} \\ \rightarrow \frac{52}3 &= (u+d+p)\frac{2}{6.3} \\ \rightarrow u+d+p &= \frac{52}3 \times \frac{6.3}{2} \\ \rightarrow u+d+p &= 54\frac6{10} \\ \end{align}

Assuming the question is: Harry walked from $X$ to $Y$ in $8$ hours, then walked back to $Y$. The total duration of the trip was $9$ hours $20$ minutes ($\frac{28}3$ hours). How far apart are $X$ and $Y$?

Then we can fit, for example:

$0$ miles (or infinitesimal miles)

Harry walks from $X$ $25.2$ miles up a hill and then $25.2$ miles back down (or any combination of inclines and declines summing to the same) to $Y$ this takes Harry
$\frac{25.2}{5.6}+\frac{25.2}{7.2}=8$ hours;

Harry then stays in $Y$ for $1$ hour $20$ minutes ($\frac43$ hours); and

then takes the quick route home, taking $0$ hours.

$8 + \frac43 + 0 = \frac{28}3$

We could also fit, for example:

$6.3$ miles

Harry walks a total of $25.2$ miles uphill and $25.2$ miles downhill from $X$ to $Y$, again taking $8$ hours;

stays in $Y$ for $20$ minutes ($\frac13$ hours); and

walks the easy way back in a straight line along the plane for $6.3$ miles taking $1$ hour

$8 + \frac13 + 1 = \frac{28}3$

Or:

anything in between (and more)

There was a mistake in my original answer as pointed out by vaultah.
Partial answer so far:

Let the uphill part of the first trip be d1, the plane part d2 and the downhill part d3.
The full distance is then d = d1 + d2 + d3
From the first trip we get (as a sum of times spent on each part): d1/5.6 + d2/6.3 + d3/7.2 = 8 (eq1)
From the second trip we get (because whatever part was uphill is now downhill and vice versa): d3/5.6 + d2/6.3 + d1/7.2 = 9.3333 (eq2)
Subtracting these two equations we get (eq2 - eq1) (d3 - d1)/5.6 + (d1 - d3)/7.2 = 4/3, which simplifies to
d3 = d1 + 33.6
That means that the downhill part is 33.6 miles longer and we spent 33.6/7.2 = 4 hours and 20 minutes on the extra part. (And 33.6/5,4 = 6 hours on the extra uphill part on our way back.)
This leaves us with 3 hours and 20 minutes to travel the plane part, the uphill part and the portion of the downhill part that is as long as the uphill part (on our first trip).
d1/5.6 + d2/6.3 + d1/7.2 = 3.333, which simplifies to
2d1 + d2 = 21

• I think $(d3 - d1)/5.6 + (d1 - d3)/7.2 = 4/3$ simplifies to $d3 = 33.6 + d1$. May 18, 2016 at 10:08
• You are right, vaultah. May 18, 2016 at 10:12
• @Meiffert Please hide your answers using this method: puzzling.stackexchange.com/editing-help#spoilers. May 18, 2016 at 10:25
• @ vaultah Please read this.meta.stackexchange.com/questions/17447/… May 18, 2016 at 10:32
• @Chowzen: mm, why? May 18, 2016 at 10:36