b = speed of the boat in still water
c = speed of the current
when going Upstream, the boat is not really going "b" fast, is really going slower, is going "b - c", because the current is subtracting speed from it, likewise, when going Downstream the boat is not going "b" fast, is really going faster, is going "b + c", because the current is adding its speed to it.
now, going either way the boat travelled the same 18 miles.