A bearing is an angle measured clockwise from the north direction.
It is much easier to draw a diagram to show the situation.
The original bearing is ‘ø’ and when the person walks 5 km towards the north, the bearing becomes 2ø.
The angle inside the triangle adjacent to the 2ø, must be equal to 180º – 2ø
The sum angles inside the triangle which are opposite to the 2ø must be equal to 2ø. (exterior angle rule)
Since the initial bearing was ø, the third angle = 2ø – ø = ø
Since there are two angles which are the same in a triangle, the triangle must be isosceles.
2 equal sides = 5 km
Let the third side = T
Split the isosceles triangle in to two right-angled triangles. The third side must be 0.5 T
cos ø = adjacent = 0.5T
5 cos ø = 0.5 T
T = 10 cos ø