Incorrect. Using the formula d=rt, you can create a chart that generates the system of equations:
Distance | = | Rate | * | Time | |
Train A | d | = | 30 | * | t |
Train B | 40 - d | = | 50 | * | t |
At the moment that the trains pass each other, they will have traveled a total of 40 miles, since they began 40 miles apart. This is why the distance of Train A is labeled d and the distance of Train B is labeled 40 - d.