Skip to main content
Home
plus.maths.org

Secondary menu

  • My list
  • About Plus
  • Sponsors
  • Subscribe
  • Contact Us
  • Log in
  • Main navigation

  • Home
  • Articles
  • Collections
  • Podcasts
  • Maths in a minute
  • Puzzles
  • Videos
  • Topics and tags
  • For

    • cat icon
      Curiosity
    • newspaper icon
      Media
    • graduation icon
      Education
    • briefcase icon
      Policy

    Popular topics and tags

    Shapes

    • Geometry
    • Vectors and matrices
    • Topology
    • Networks and graph theory
    • Fractals

    Numbers

    • Number theory
    • Arithmetic
    • Prime numbers
    • Fermat's last theorem
    • Cryptography

    Computing and information

    • Quantum computing
    • Complexity
    • Information theory
    • Artificial intelligence and machine learning
    • Algorithm

    Data and probability

    • Statistics
    • Probability and uncertainty
    • Randomness

    Abstract structures

    • Symmetry
    • Algebra and group theory
    • Vectors and matrices

    Physics

    • Fluid dynamics
    • Quantum physics
    • General relativity, gravity and black holes
    • Entropy and thermodynamics
    • String theory and quantum gravity

    Arts, humanities and sport

    • History and philosophy of mathematics
    • Art and Music
    • Language
    • Sport

    Logic, proof and strategy

    • Logic
    • Proof
    • Game theory

    Calculus and analysis

    • Differential equations
    • Calculus

    Towards applications

    • Mathematical modelling
    • Dynamical systems and Chaos

    Applications

    • Medicine and health
    • Epidemiology
    • Biology
    • Economics and finance
    • Engineering and architecture
    • Weather forecasting
    • Climate change

    Understanding of mathematics

    • Public understanding of mathematics
    • Education

    Get your maths quickly

    • Maths in a minute

    Main menu

  • Home
  • Articles
  • Collections
  • Podcasts
  • Maths in a minute
  • Puzzles
  • Videos
  • Topics and tags
  • Audiences

    • cat icon
      Curiosity
    • newspaper icon
      Media
    • graduation icon
      Education
    • briefcase icon
      Policy

    Secondary menu

  • My list
  • About Plus
  • Sponsors
  • Subscribe
  • Contact Us
  • Log in
  • Mad robot: Solution

    14 October, 2012
    robot

    A mad robot sets off towards the North East on a journey from the point (0,0) in a coordinate system. It travels in stages by moving forward and then rotating on the spot. It follows these pseudo-code instructions:

    SUB JOURNEY

    DISTANCE = 1000

    WHILE (DISTANCE > 0.001)
    MOVE DISTANCE
    STOP
    ROTATE(90, DEGREES, CLOCKWISE)
    DISTANCE = DISTANCE / 2
    END WHILE

    EXPLODE

    END SUB

    Where does the robot explode?

    Solution

    First we find the number of forward turns, noting that the WHILE(DISTANCE > 0.001) condition is evaluated after each halving.

    The forward motion, if it occurs, following the $n$th turn will be of distance $1000\times 2^{-n}$. This will occur for each $n$ for which $$1000\times 2^{-n} > 0.001.$$ Taking logs gives $$\log{1000}-n\log{2}>\log{0.001}$$ Rearranging gives $$n\frac{\log{1000}-\log{0.001}}{\log{2}} = \frac{\log{1000000}}{\log{2}} \approx 19.93.$$ This first becomes invalid after 20 turns. Thus, the path of the robot is determined by 20 motions. The directions that the robot travels in these 20 motions are alternately NE, SE, SW, NW, .... Since there are 20 motions in total there are 5 motions in each of these directions. Let $T$ be the total distance travelled NE. Then $$T=1000\left(\frac{1}{2^0}+\frac{1}{2^4}+\frac{1}{2^8}+\frac{1}{2^{12}}+\frac{1}{2^{16}}\right).$$ The NE motion contributes a component $d$ travelled in the $x$ direction and the same component $d$ travelled in the $y$ direction. By Pythagoras' theorem we have $$2d^2=T^2,$$ so $$d=\frac{T}{\sqrt{2}}.$$ Note that the distance SE will be half of T, since each motion is half the length of the preceding NE motion. Similarly, the total distance SW will be one quarter of $T$; total distance NW will be one eighth of $T$. Each of these motions contributes the same component in the $x$-direction as in the $y$-direction. The NE direction counts positively towards both $x$ and $y$ directions, the SE direction counts positively in the $x$ direction and negatively in the $y$ direction, SW counts negatively in both $x$ and $y$ directions and NW counts negatively in the $x$ and positively in the $y$ direction. The final coordinates are therefore $$(x,y)=\left(\frac{T}{\sqrt{2}}\left(1+\frac{1}{2}-\frac{1}{4}-\frac{1}{8}\right),\frac{T}{\sqrt{2}}\left(1-\frac{1}{2}-\frac{1}{4}+\frac{1}{8}\right)\right)=\left(\frac{9T}{8\sqrt{2}},\frac{3T}{8\sqrt{2}}\right)$$

    This problem comes from our sister site NRICH, which is packed with challenges, activities and articles for maths learners and teachers.

    Back to puzzle

    • Log in or register to post comments

    Anonymous

    3 September 2014

    Permalink
    Comment

    i think this is a good site and great learning activity for young kids

    • Log in or register to post comments
    University of Cambridge logo

    Plus is part of the family of activities in the Millennium Mathematics Project.
    Copyright © 1997 - 2025. University of Cambridge. All rights reserved.

    Terms