Two Laptop Bag*
The moose likes Programming Diversions and the fly likes Math Puzzle - Where Are You? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Math Puzzle - Where Are You?" Watch "Math Puzzle - Where Are You?" New topic
Author

Math Puzzle - Where Are You?

Doug Wang
Ranch Hand

Joined: Oct 05, 2001
Posts: 445
You are standing somewhere on earth. You face south and walk 1 kilometer. Then you turn to face west and walk 1 km. Then you turn to face north and walk 1 km. You find that you are back where you began. Where are you?
Hint: You may have heard this before and think you know the answer, but there is more than one solution to this puzzle.


Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep
Abadula Joshi
Ranch Hand

Joined: Sep 01, 2002
Posts: 126
North Pole.
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Wouldn't any point on the equator also qualify?
Doug Wang
Ranch Hand

Joined: Oct 05, 2001
Posts: 445
Abadula,
You are right. But wait, there are more solutions to this puzzle. Keep up thinking.
Michael,
I am afraid that no point on the equator would qualify.
Yes. If you follow the path described you would expect to be back on the equator, but not on the very point where you begin.
[ November 09, 2002: Message edited by: Doug Wang ]
navneet bhartia
Greenhorn

Joined: Sep 23, 2002
Posts: 8
north pole
and is the second sol. about 2 kms north of the south pole?


<a href="http://www.technohost.net/" target="_blank" rel="nofollow">Web Hosting</a> | <a href="http://www.reviewmovie.net" target="_blank" rel="nofollow">Review Movie</a>
Doug Wang
Ranch Hand

Joined: Oct 05, 2001
Posts: 445
navneet,
Well done. The second solution IS near the south pole. you are very close to the right answer. Keep it up...
[ November 09, 2002: Message edited by: Doug Wang ]
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

lets see if i recal correctly circumference = 2 PI R we need to sove for R.
answer is 1 + 1/2Pi kilometers north of south pole


SCJP
Visit my download page
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

but earth is sphere not circle so that is wrong. i dont know correct formula and it isnt important enough for me to find it.
[ November 09, 2002: Message edited by: Randall Twede ]
Meadowlark Bradsher
Ranch Hand

Joined: Jan 23, 2001
Posts: 109
Originally posted by Randall Twede:
but earth is sphere not circle so that is wrong. i dont know correct formula and it isnt important enough for me to find it.
[ November 09, 2002: Message edited by: Randall Twede ]

I think I see where you are going so I will try to follow further.
If your brain isn't wet already, get ready for a snore!
Actually there is an infinite number of answers to this question, plus the northpole answer, so then there are infinite plus 1 answers (does that equal two infinities?). Futhermore the "plus 1" answer is an irrational number that we define the best we can.
I'll get into the infinite answers in a moment but the answer, I think Randall was exploring, depends on the unknown, x, which is whatever distance from the south pole would allow the westerly walk to still constitute one full and exact trip around the circumference of that earth's latitude line (obviously its very close to the south pole), leaving the pedestrian to turn north again and face their original spot.
X represents the distance from the south pole that we do not know about, the 1 represents the 1 kilometer walked westerly that resulted in a full circumambulation of the south pole:
That's the diameter of the 1 kilometer circle right? We need the radius.
So divide that by 2 gives us
0.159154943091895335768883763372514...
and then add the extra 1 kilometer (north/south) walk.
grand total of
1.159154943091895335768883763372514...
1.159154943091895335768883763372514... kilometers north of the south pole is the answer I think is being sought here.
But then Randall said that the earth is a sphere so the number will be larger due the curvature of the planet.
Its worth looking into to see what can be made of the curvature problem. I already have some good leads on finding this additional information.
However my guess is the 2D answer is all that you were asking for.
The reason I said that there are an infinite number of answers, though, is that the same answer could be applied to a walk west that resulted in TWO exact walks around the pole ( apoint closer to the south pole), then the answer would be 1.318309886183790671537767526745029. Also one answer would be based upon an exactly three-time walk around the pole going west (even closer to the south pole) or 1.477464829275686007306651290117543 kilometers north of the south pole. The same can be said for four times circumabmulation, five time, six time ad infinitum. At some point it is like Zeno's movement paradox where it is a logic problem not a practical one, but since we are asking mathematically, and logically, it is infinite at the very least.
Ah well. I'm sorry that I've overindulged this question and myself here a little. I never had the chance to do it in college because I haven't started it just yet. I start this Winter I hope.
Later I'll see if I can apply myself to the curvature problem. I'm afraid I will have to assume the earth is a perfect sphere unless I find some specific data help on its real shape in this part down south.
God forbid we have to do topographical based calculations as well. Then I refuse!

[ November 09, 2002: Message edited by: Meadowlark Bradsher ]

Meadowlark Bradsher
SCJ2P, IBM XML V1, Series 7/63
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

i think for once i am not going to be the one accused of indulging in drugs
Meadowlark Bradsher
Ranch Hand

Joined: Jan 23, 2001
Posts: 109
I don't remember what I did last night. Did I write that?
[ November 10, 2002: Message edited by: Meadowlark Bradsher ]
Meadowlark Bradsher
Ranch Hand

Joined: Jan 23, 2001
Posts: 109
I don't feel like completing this puzzle with the curvature included. Its better for my social life if I avoid discussions, or games, like this in the wrong company.
If someone wants to see how its done here is an exerpt about calculating the distance between two points based upon latitude and longitude (in miles).
That may help.
If you need greater accuracy, you must use the exact distance calculation. The exact distance calculation requires use of spherical geometry, since the Earth is a sphere. The exact distance calculation also requires a high level of floating point mathematical accuracy - about 15 digits of accuracy (sometimes called "double-precision"). Many computer languages do not provide sufficient accuracy for this calculation. In addition, the trig math functions used in the exact calculation require conversion of the latitude and longitude values from degrees to radians. To convert latitude or longitude from degrees to radians, divide the latitude and longitude values in this database by 180/pi, or 57.2958. The radius of the Earth is assumed to be 6,378 kilometers, or 3,963 miles.
If you convert all latitude and longitude values in the database to radians before the calculation, use this equation:
Exact distance in miles = 3963 * arccos[sin(lat1) *
sin(lat2) + cos(lat1) *
cos(lat2) * cos(lon2 - lon1)]
If you do NOT first convert the latitude and longitude values in the database to radians, you must include the degrees-to-radians conversion in the calculation. Substituting degrees for radians, the calculation becomes:
Exact distance in miles = 3963 * arccos[sin(lat1/57.2958) *
sin(lat2/57.2958) +
cos(lat1/57.2958) *
cos(lat2/57.2958) *
cos(lon2/57.2958 - lon1/57.2958)]
OR
Distance = acos(sin(lat1)*sin(lat2)+cos(lat1)*
cos(lat2)*cos(long2-long1)) * r
Where r is the radius of the earth in whatever units you desire.
r=3437.74677 (statute miles)
r=6378 (kilometers)
r=3963 (normal miles)

If the computer language you are using has no arccosine function, you can calculate the same result using the arctangent function, which most computer languages do support. Use the following equation:
Exact distance in miles = 3958.75 * arctan[sqrt(1-x^2))/x]
where x = [sin(lat1/57.2958) * sin(lat2/57.2958)] +
[cos(lat1/57.2958) *
cos(lat2/57.2958) *
cos(lon2/57.2958 - lon1/57.2958)]

If your distance calculations produce wildly incorrect results, check for these possible problems:
1. Did you convert the latitude and longitude values from degrees to radians? Trigonometric math functions such as sine and cosine normally require conversion of degrees to radians, as described above.
2. Are the equations implemented correctly with necessary parentheses? Remember the old math precedence rule: MDAS - multiply, divide, add, subtract.
3. Does your computer language provide sufficient mathematical accuracy? Many languages simply do not provide the required floating point precision. For best results, you need about 15 digits of accuracy. Older versions of Basic, for example, often provide much less accuracy than required for the exact distance calculation.
4. Did you retain decimal points in the latitude and longitude values? When you imported the data into your database program, you may have lost the decimal point during the importation of latitude and longitude values.

[ November 10, 2002: Message edited by: Meadowlark Bradsher ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Meadowlark- it looks like you're multiplying where you should be dividing. All the South-pole solutions should be in the range
1 < x <= 1.159154943
As a sanity check, where do you have to start to travel around the pole 1000 times in a 1-km journey? If your answer comes out to 160km north of the south pole, think about that a moment.
The radius r of a circular path around the south pole can be determined using
2*pi*r*k = 1
where k = 1, 2, 3, ...
This gives
r = 1/(2*pi*k)
This is the straight-line distance from the Earth's axis to any point on the circular part of the trip. The effect of the curvature of the earth is quite negligible, but we can find it by calculating the angle A formed between the earth's axis and a line from the center of the earth to a point on the circle:
sin(A) = r/R
where R is the radius of the earth (I used 6288km). Angle A is related to the curved-surface distance s from the pole to the circle using:
A = s/R
(A is in radians of course.)
Combining these equations we get
s = R * asin(r/R) = R * asin(1/(2*pi*R*k))
Plug in k = 1, ... 10 and add 1 km to get the first 10 solutions for the curvilinear distance from the south pole:
1.1591549431088888
1.079577471548072
1.053051647697928
1.0397887357732394
1.031830988618515
1.0265258238487278
1.0227364204417488
1.0198943678865202
1.0176838825657895
1.0159154943092066


"I'm not back." - Bill Harding, Twister
Meadowlark Bradsher
Ranch Hand

Joined: Jan 23, 2001
Posts: 109
Originally posted by Jim Yingst:
Meadowlark- it looks like you're multiplying where you should be dividing. All the South-pole solutions should be in the range
1 < x <= 1.159154943

I don't see where I have provided any figures outside of this range. I think you must be misreading something.
I started with
1.159154943091895335768883763372514
which is clearly the maximum, as you had mentioned.
Then getting smaller...ooohh I did make some kind of error after that. The figures I have should be shrinking, for the two time rotation I had 1.318309886183790671537767526745029 and the three time rotation I had 1.477464829275686007306651290117543 but look at all three of them, they're progressively increasing! Doh! I just looked the other way I guess. I'm a bit tired but I'll look into it. You said I was multiplying instead of dividing?
Ok..
Yes I see. The way I was looking at it, using your variables, was ((1/k)/pi)/2 = r. As you pointed out, I made the error of multiplying instead, in the sense that I wasn't dividing 1/k, by using only (k/pi)/2 = r. If you saw my face now I am blushing!!

I've never done calculus, even just on a calculator, so I'll have to learn really quickly what the principal is before I grasp sin, asin, or the others but based upon the output the difference of using it really is small, as you said. It make sense too. In a 1.159154 km walk I am not walking far compared to a walk from pole to pole.
When I reread my first post, I see I was a bit too giddy about thinking of the premise for the answer. Obviously I am some kind of weird neophyte.
[ November 11, 2002: Message edited by: Meadowlark Bradsher ]
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

i do see now how there are an infinite number of answers. good work meadowlark.
Meadowlark Bradsher
Ranch Hand

Joined: Jan 23, 2001
Posts: 109
Originally posted by Randall Twede:
i do see now how there are an infinite number of answers. good work meadowlark.


Ahhh plplch!

just kidding, thanks Randall.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
any points 1.0027777777780666 km north of the south pole (that curve) shd qualify.
1 + 2*pi*R/360 * Math.asin(1/R/2/pi)
~ 1 + 2*pi*R/360 * 1/R/2/pi
~1 + 1/360
~1.0027777777777777777777....
where
R: earth's radius
pi: 3.1415926535897384626433......
because at this curve, if u walk 1km west, u r back to where you start.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
i meant that from any point at that curve, walk 1 km south to B, and from B u walk 1km west, u are back to point B
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
and pi is acutally
3.1415926535897932384626433....
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

...8327950288419716939937510582 and so on, but it's a fact among pi freaks that beyond 15 decimals you've got enough precision to approximate the curvature of the universe with a high degree of confidence.
And the earth is not a sphere but an ellipsoid, so I doubt pure math actually gets you a working answer
Juanjo Bazan
Ranch Hand

Joined: Feb 04, 2002
Posts: 231
My guess is that the correct answer should be simpler...
Lets say I start in a point 1 Km away from the South Pole.
If I face south and I walk 1Km..I'm in the SP.
Then, walking 1 Km west has no sense(I assume 'walk west'-and walk east- means walk through a line joining point with the same latitude), I would be just spinning over the SP.
So then I can face north and return to my starting point.
So the complete answer could be: North Pole and Every point 1 Km north from the South Pole.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Consider the latitude (say, L) near the south pole that is exactly 1km in length. That is, if you walk on that latitude for 1 km, you circle around the south pole and come back to the same point where you started. Now take "any" point on this latitude and go north for 1 km. to a point say X (there will be infinite such possiblities). The set of all such X points is your answer, other then the north pole.
Reason: If you start from X and go south 1km. you reach the latitude L. Since L is 1km in length, going west for 1km, brings you back to that same point. Then you go back north 1km and you reach your starting X.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
This is exactly my answers above.
Originally posted by <Simpler Answer>:
Consider the latitude (say, L) near the south pole that is exactly 1km in length. That is, if you walk on that latitude for 1 km, you circle around the south pole and come back to the same point where you started. Now take "any" point on this latitude and go north for 1 km. to a point say X (there will be infinite such possiblities). The set of all such X points is your answer, other then the north pole.
Reason: If you start from X and go south 1km. you reach the latitude L. Since L is 1km in length, going west for 1km, brings you back to that same point. Then you go back north 1km and you reach your starting X.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Originally posted by <bill>:
This is exactly my answers above.

Agreed!!!
(i did not read it before as it involved way too many numbers)
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Juanjo:
My guess is that the correct answer should be simpler...
To dreammm... the impossible dreammm...
Lets say I start in a point 1 Km away from the South Pole.
If I face south and I walk 1Km..I'm in the SP.
Then, walking 1 Km west has no sense

And therefore, this solution doesn't work. The problem said "Then you turn to face west and walk 1 km." At the south pole, it's not even possible to turn to face west - much less walk 1 km in that direction. If you can't do that, you don't have a valid solution.


"Simpler Answer":
Consider the latitude (say, L) near the south pole that is exactly 1km in length.
Ah, yes, that would be what Meadowlark and I have been talking about. Don't forget the other solutions for latitudes of length 1/2 km, 1/3 km, 1/4 km etc.


"bill":
1 + 2*pi*R/360 * Math.asin(1/R/2/pi)
Pardon me? What do you think you're doing? It looks like you're confusing degrees and radians (hint: degrees are completely useless in this problem - get rid of them).
[ November 24, 2002: Message edited by: Jim Yingst ]
Meadowlark Bradsher
Ranch Hand

Joined: Jan 23, 2001
Posts: 109
Originally posted by Jim Yingst:
"Simpler Answer"
Consider the latitude (say, L) near the south pole that is exactly 1km in length.
Ah, yes, that would be what Meadowlark and I have been talking about. Don't forget the other solutions for latitudes of length 1/2 km, 1/3 km, 1/4 km etc.
[/QB]

Simpler Answer
You have a point. To be closer to exact, there is the set of all the points on the latitudes that Jim and I have been describing. We've just described the solution in terms of the latitude line (or at least that's how I read it). There are all of those points on the line and just for fun there are an unlimited number of latitudes (that's what we were describing). However, in light of this I think you should consider changing your name to "more complex answer".
I'm sure I don't know how to express sets mathematically, so I can't try to express this more complete view without reading on it. If I find the time I am sure it is worth learning.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Originally posted by Jim Yingst:
"bill":
1 + 2*pi*R/360 * Math.asin(1/R/2/pi)
Pardon me? What do you think you're doing? It looks like you're confusing degrees and radians (hint: degrees are completely useless in this problem - get rid of them).[/QB]

obviously you did not know what your were talking
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Sigh. Let's try again. I for one do not understand where you got yor formula, and I don't think you do either. Can you provide any explanation for it? In particular, why is there a "360" in there? Is it part of a conversion between degrees and radians? Is any other quantity in your formula measured in degrees?
You may note that I've already provided an answer of my own to the original problem, with explanation. The formulas I used are rather similar to the ones you made up, but with some key differences. If you disagree with what I said, feel free to explain why, or ask for clarification as I have from you. If you can't be bothered to clarify, why should anyone assume you have any idea what you're talking about?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi:
All your guys are talking about south pole, is there any solution near South Korea by any chance?
:roll:
Originally posted by <Simpler Answer>:

Agreed!!!
(i did not read it before as it involved way too many numbers)
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Please, someone, anyone, summarise and explain all these posts to me in just 4 sentences.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

eric,
1. the best answers are near the top of this thread.
2. if you cant figure it out i doubt i can explain in my inebriated state.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Sorry my mistake!
i thought Math.asin returns degree (-90^o~90^o)!
So your answers are correct:
1 + R * Math.asin(1/R/(2*pi)/k))
~ 1 + 1/(2*pi)/k
where k=1,2,3,4 .....
I wish I could delete my previous msg

Originally posted by Jim Yingst:
Sigh. Let's try again. I for one do not understand where you got yor formula, and I don't think you do either. Can you provide any explanation for it? In particular, why is there a "360" in there? Is it part of a conversion between degrees and radians? Is any other quantity in your formula measured in degrees?
You may note that I've already provided an answer of my own to the original problem, with explanation. The formulas I used are rather similar to the ones you made up, but with some key differences. If you disagree with what I said, feel free to explain why, or ask for clarification as I have from you. If you can't be bothered to clarify, why should anyone assume you have any idea what you're talking about?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Originally posted by Jim Yingst:
Don't forget the other solutions for latitudes of length 1/2 km, 1/3 km, 1/4 km etc.

Ah Thanks. I did not think of those latitudes.
So, in effect, the set of all the latitudes are valid candidates that are of length 1/n km, where n is a positive (and negative too ?) integer. That is Latitudes of length, 1, 1/2, 1/3, ...
Well, going by that, as n->∞, length of the latitude->0. That is, as n tends to infinity, L tends to become the South Pole and Juanjo's answer of South Pole starts making sense.
(At the same time at n=∞, Juanjo's idea of "going west on SP does not make sense" itself does not make sense = "going west on SP does make sense" )Hey! you can ignore this last para if it does not make sense.
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
This post is somehow calling out tob related to this thread.
Simple answers
That's why it keeps popping up ?
regards
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11150
    
  16

summary:
solution 1: North Pole
there are an infinite number of other points. Imagine a circle EXACTLY 1 km in Circumference, with its center at the SOUTH pole. If i start 1km North of this circle, i walk South, towards it for 1 km, turn west, walk around the circle, turn north, and end up back where i started.
Note that there are an infinite number of points 1km North of this circle where i can start from.
Now imagine a circle EXACTLY 0.5km in circumference, centered at south pole. Start 1km North of this circle, walk around the circle TWICE, return to start. and, again, there are an infinite number of starting points for this case.
now, imagine a circle 1/3 km in circumference...1/4 km, 1/5 km...
so, not only are there an infinite number of points for each circle around the south pole, there are an infinite number of circles...


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8801
    
    5
Weren't polar bears supposed to be part of this discussion?


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Or Empire penguins !
regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Math Puzzle - Where Are You?
 
Similar Threads
Puzzle anyone
puzzle...
Puzzle
puzzle
Pattern Puzzle!!!