These types of questions are the real-time examples of linear equations in two variables.
In water, the direction along the stream is called downstream. And, the direction against the stream is called upstream.
Let us consider the speed of a boat is u km/h and the speed of the stream is v km/h, then:
Speed Downstream = (u + v) km/h
Speed Upstream = (u – v) km/h
We know that, Speed = Distance/Time
So, the speed of boat when running downstream = (20⁄2) km/h = 10 km/h
The speed of boat when running upstream = (20⁄5) km/h = 4 km/h
From above, u + v = 10>…….(1)
u – v = 4 ………. (2)
Adding equation 1 and 2, we get: 2u = 1
u = 7 km/h
Also, v = 3 km/h
Therefore, the speed of the boat in still water = u = 7 km/h