Okay, we know the speed of Train A is 45 kmph.
Let speed of Train B be "s" kmph
Let the trains meet after "t" hours.
Let Train A cover a distance d1 when it meets Train B, and correspondingly, let Train B cover a distance d2 when it meets Train A.
Speed of Train A is 45 kmph, so it will take d1/45 hours to cover distance d1. Now this is "t". So, t = d1/45.
Similarly, speed of Train B is "s" kmph, so it will take d2/s hours to cover distance d2. Now this is also "t" because the trains have traveled for "t" hours before meeting.
So, t = d2/s.
Therefore, d1/45 = d2/s, or d1/d2 = 45/s.
After meeting, Train A has to cover d2 kms and train B has to cover d1 kms to reach their destinations (because the trains are travelling in opposite directions and, therefore, d1+d2 is the total distance of the journey).
Train A has already covered d1, so it has to cover d2 now. Likewise, Train B has to cover d1. Train A covers d2 in 90 minutes while Train B covers d1 in 40 minutes.
Now, Train A covers d2 in 90 minutes, or 90/60 hours. Speed of Train A is 45kmph, so it will cover d2 in d2/45 hrs. So d2/45 = 90/60. Therefore, d2 = (90 x 45)/60.
Likewise, speed of Train B is "s" kmph, so it will cover d1 kms in d1/s hours. But this is 40 minutes, or 40/60 hrs. So, d1/s = 40/60. Therefore, d1 = 40s/60.
Therefore d1/d2 = (40s/60) / [(90 x 45)/60]. That is d1/d2 = 40s/ (90 x 45).
But d1/d2 = 45/s.
Therefore 45/s = 40s/ (90 x 45).
So, 40s2 = 45 x 90 x 45.
Therefore, s2 = (45 x 90 x 45) / 40.
Therefore s = square-root of (45 x 90 x 45 / 40).
Now we are considering speed, so only positive values need to be taken.
Therefore s = 45 x 3/2.
Or, s = 67.5 kmph. Therefore, speed of Train B is 67.5 kmph.
Seems you could have applied a simple formula to arrive at the answer. The formula is:
Speed of Train A/ speed of Train B = square-root (time taken by Train B to reach destination after meeting)/ square-root (time taken by Train A to reach destination after meeting). Thus, 45/s = square-root(40)/square-root(90).
Now, for the total distance between Udaipur and Chittorgarh: The total distance is d1 + d2; d1 = 40s/60, and "s" we have found out is 67.5. Therefore, d1 = 40 x 67.5 / 60 = 45. We know d2 = (90 x 45)/60 = 67.5. Therefore d1 + d2 = 45 + 67.5 = 112.5 kilometers.
The trains meet after "t" hours after starting. Take any of the equations involving "t" to find it. Let's take t = d2/s. Thus, t = 67.5 / 67.5 = 1. So, the trains meet one hour after starting.
I hope I have got it right!