This problem is about equations.
The first car have the next equation for your distance from math city:
[tex]d=45h[/tex]where d is the distance and h is our unknown value.
And for the second car the equation for distance is:
[tex]d=25h+80[/tex]So, we want to know the value of h which make d equal value for both cars. That's mean:
[tex]45h=25h+80[/tex]Now, we isolate h from the equation above:
[tex]\begin{gathered} 45h=25h+80 \\ 45h-25h=80 \\ (45-25)h=80 \\ 20h=80 \\ h=4 \end{gathered}[/tex]The answer is h=4 hours.