Suppose you are swimming in a lake and find yourself 200m from shore. You would like to get back to the spot where you left your towerl, which is at least 200m down the beach, as quickly as possible. You can walk along the beach at 100m/min, but you can swim at only 50m/min. To what point of the beach should you swim to minimize your total travelling time?

Is this function correct?

T=(200-x)/100 + (sqrt(200^2+x^2))/50