Let us refer to boat speed as X and water speed as Y
On the way down the stream, the water speed is added to the speed of the boat: speed of the boat (X) + water speed (Y) is 9km/h
When the boat is moving upstream, water speed is taken away from the speed of the boat: Speed of the boat (X) - water speed (Y) is 7.2 km/h
Therefore:
X + Y = 9 : X - Y = 7.2
2X = 16.2
X = 8.1
X + Y = 9
8.1 + Y = 9
Y = 0.9
The river is flowing at 0.9 km/h