Assuming the traveling speed to be constant, the law that involves space, speed and time is

So, the sentence "Traveling at an average speed of 50 miles per hour, the trip from point A to point B takes 2 hours" translates to

from which we deduce that A and B are 100 miles apart. In fact, we also have

which again yields s = 100.
Now, the question changes the perspective, because it asks for the time needed to travel at a certain speed. Now that we know that the distance is 100 miles, if we travel at 45 miles per hour we have

from which we can deduce

which, rounded to the nearest hundreth, is 2.22.