Let the speed of the stream be v km/h.
The speed of a person rowing in still water = 5 km/h
The speed of a person rowing downstream = (5 + v)km/h [His speed + speed of the stream]
And the speed of a person rowing upstream = ( 5 – v ) km/h [His speed - speed of the stream, as rowing upstream is in the direction opposite to that of the flow of the stream]
Now, time taken by the person to cover 40 km downstream is
t1=405+vh [∵speed=distancetime]
and the time taken by the person to cover 40km upstream is
t2=405−vh
By the given condition, t2=t1 ×3
⇒ 405−v=405+v×3
∴ v=104= 2.5 km/h
Hence, the speed of the stream is 2.5 km/h.