Can you please help with correct format for the following?: re: d = rt equation

A boat traveled 40 miles down a river in 2 1/2 hours. The return trip going upstream took twice as long. What is the rate of the boat in still water?

Appreciate any help on the set up.

Thank you,

Easiest way is to use 2 variables

let x be the speed of the boat in still water
let y be the speed of the current

so going downstream the boat is going x+y mph
going against the current it is x-y mph

now use your formula, we need t = d/r

time upstream = 40/(x-y)
time downstream = 40/(x+y)

then 40/(x-y) + 40/(x+y) = 5/2

I would multiply each term by 2(x+y)(x-y)
or 2(x^2 - y^2)

80(x+y) + 80(x-y) = 5(x^2 - y^2)
80x + 80y + 80x - 80y = 5x^2 - 5y^2
simplify and divide by 5
32x = x^2 - y^2

but we are also told that
40/(x-y) = 2(40/(x+y))
1/(x-y) = 2/(x+y)
2x-2y = x+y
x = 3y

sub back in:
32(3y) = 9y^2 - y^2
96y = 8y^2
12y = y^2
y = 12
then x = 36

the boat can go 36 mph in still water, the current is 12 mph

check:
time to go upstream = 40/24 = 5/3
time to go downstream = 40/48 = 5/6

5/3 + 5/6 = 5/2 , as required