The speed of an object is equal to the distance traveled divided by the time it takes.
In this case, the cars travel 540 km together, however since one is moving faster than the other, they do not split the distance equally.
We can however find the average speed of the cars.
540 km / 3 hr = 180 km/h
Since the cars are traveling in opposite directions, their respective speeds can be added together. This is because they are both traveling on a route which has no overlap with the other, so when they meet somewhere in the middle, the average of their respective distances traveled times the 3 hours they each drove will equal the total 540 km.
Therefore, if the average speed is 180 km/h, and assuming the cars were going the same speed, both cars would be going 90 km/h in opposite directions. However, we know one is traveling 20 km/h slower, so the cars must be traveling 80 km/h and 100 km/h, respectively. The average of these two speeds is still 90 km/h and one is 20 km/h slower, therefore it is our answer.
The slower car is going at a rate of 80 km/h
----------------------------------
That was an intuitive solution, but you can also use a more formulaic approach.
We could say that the distance traveled by an object is equal to the speed times the time it takes, therefore:
540 km = (speed of car A + speed of car B) * 3 hours
We know one car is 20 km/h slower, therefore in other words:
540 = (s + (s + 20)) * 3,
where s is the speed of the slower car.
540 = 3(2s + 20)
540 = 6s + 60
480 = 6s
s = 80 km/h
Using this method, we also conclude that the answer is 80 km/h. Hopefully this helps, and I apologise if formatting is bad since I am on mobile.