It's important to understand what Downstream and Upstream mean here.
Let's assume the Speed of the Boat in Still water to be #S_b# and the speed of the current to be #S_c#(which is 4kmph )
#color(green)(*Downstream# would mean that the current and the boat are moving in the SAME direction . Hence the speed of the current would enhance the speed of the boat and the overall speed would be #S_b+S_c#
We know that #Time = (Distance) / (Speed)#
For Downstream it will be
#color(green)(Time(Downstream) = 40 / (S_b + S_c) = 40 / (S_b + 4)#
#color(red)(*Upstream# would mean that the current and the boat are moving in the OPPOSITE direction . Hence the speed of the current would restrict the speed of the boat and the overall speed would be #S_b-S_c#
For Upstream it will be
#color(red)(Time(Upstream) = 24 / (S_b - S_c) = 24 / (S_b - 4)#
#color(green)(Time(Downstream) = color(red)(Time(Upstream)#
#40 / (S_b + 4) = 24 / (S_b - 4)#
#40(S_b - 4) = 24(S_b + 4)#
#40S_b - 160 = 24S_b + 96#
#40S_b - 24S_b = 96 + 160#
# 16S_b = 256#
#S_b = 16#
The rate of Jai Singh’s boat in still water will be #color(blue)(16 kmph#