1. From the definition of speed: you know that

2. From the headline of your post I believe that you want to know the shortest time to go from A to B(?).

3. Draw a sketch. Actually you are dealing with a right triangle with the length of the hypotenuse of 10 km and the legs, which are 6 km and 8 km long.

4. Let denote the angle with respect to North (=heading). Then the first part of the trip has a length of:

and the time which takes this part is:

5. The second part is:

and the time which takes this part is:

6. The total time is:

7. If you want to get the minimum of the elapsed time, differentiate t, set and solve for .