I have been looking for a formula to do an equation with " Train A and Train B, I need to find out when Train B will catch Train A. Trian A is traveling at 40 miles per hour, train B is traveling at 48 miles per hour. Train A passes a station at 8:10p.m.. If Trian B passes the same station at 8:48 p.m. What time will Train B catch up to Trian A

The only "formula" you need for these type of question is

Distance = rate x time , and its variations
Other than that you have to determine what is equal to form your equation.
In your problem the distances covered by both trains when they meet are equal

let the time passed since 8:48 be t hrs.
so when they meet ...
train A has covered (38/60)40 + 40t
train B has covered 48t

so 48t = (38/60)(40) + 40t
8t = 76/3
t = 19/6 hrs or 190 minutes
so we add 190 minutes or 3:10 hrs to 8:48 pm to get 11:58 pm