When it comes to distance/speed/time problems, I find it helpful to make a table of the information we know and need to find.
We know that Castel and Dan were a total of 335 miles. So if Castel drove some x miles, then Dan had to have driven 335 - x miles. We also know Dan drove 40 mph slower than Castel, so if we represent Castel's speed as y, we can represent Dan's speed as x
- 40. And we know Dan drove for 3 hours, while Castel left an hour before him, so he drove for 4 hours.
DISTANCE SPEED TIME
Castel x y 4 hours
Dan 335 - x y - 40 3 hours
Now we can make two formulas using the one you were given, distance = speed x time.
x = 4y
335 - x = 3(y - 40)
Since we are solving for y (Castel's speed), I'm going to plug 4y in for x (since they are equal based on the first equation) in the second equation.
335 - 4y = 3(y - 40) Now I'm going to simplify and solve for y.
335 - 4y = 3y - 120
455 = 7y
y = 455 / 7 = 65 mph