When you think of the speed (rate) of a boat and the current, we first need to understand that a boat travelling upstream, against the current, will travel slower than a boat travelling downstream, with the current.
So if v is the speed of the boat in still water and c is the current
v+c = downstream rate
v-c = upstream rate
Per the problem
v+c=21
v-c=13
We can solve this system of equations using elimination by adding the two equations together.
v+c=21
v-c=13
2v = 34
divide both sides by 2
v = 17 km/hr.