let
the distance between p and q is =120 km
boat takes 10 hour to travel from p to q
that means the boat travel 10 hour thhrough a distance of 120 km with "sum of speed of boat and the river" because the direction of flow of river is same as that of boat
the total speed of boat and the river = distance / time
= 120 km /10 hour
= 12 km/hr
it is the speed of boat + speed of river = 3km/h +x km/h
12=3+x
so x = 12-3= 9 km/h
now in the case of returnig of boat from q to p ,we take the speed of the boat as -ve ,because the flow of river is against the direction of boat
total speed = x-speed of boat = 9-3= 6 km/hr
that is ,during return the boat has an effective speed of 6 km/h
time taken by boat from q to p = distance /velocity
or speed
= 120km /6 km/h
=20 hour