A tub can be filled in 15 minutes by the hot water faucet and in 12 minutes by the cold water faucet. The drain can empty the tub in 20 minutes. How long will it take the tub to fill if both of the faucets and the drain are open?

rate of hot = 1/15

rate of cold = 1/12
combined rate = 1/15 + 1/12 = 3/20
rate of drain = -1/20

3/20 - 1/20 = 1/x
2/20 = 1/x
x = 10

it will take 10 minutes.

check:
in 10 minutes the amount of hot = 10(1/15) = 2/3 units of the tub
in 10 minutes the amount of cold = 10(1/12) = 5/6 units of the tub
in 10 minutes the amount drained = 10(1/20) = 1/2 units of the tub

combined effect = 2/3 + 5/6 - 1/2
= 1 unit of the tub, i.e. , the tub is full

drain = -1 tub/20 min

hot = 1 tub/15 min
cold = 1 tub/12

1 tub = (1 tub/12min + 1 tub/15 min - 1 tub/20 min)( x min)
1 = (5/60 + 4/60 - 3/60) x
1 = 6 x/60 = x/10
x = 10 min

Now

How much hot water did you waste?

What is 10min*1/20 min? answer, 1/2 tub. That is how much went down the drain.

how much of that was hot water? 1/2 tub* 15/(12+15)=....

or how much hot water did you run?

10 min * 1 tub/15 min = 2/3 tub
How much did you need:
hot = 12 hots for every 15 colds or 12/27 is hot (note more cold than hot)
2/3 - 12/27 = 18/27 - 12/27 = 6/27 = 3/9 of a tub

or about 1/3 tub hot wasted :)

To determine how long it will take the tub to fill if both faucets and the drain are open, we need to calculate the rate at which water is being added and subtract the rate at which water is being drained.

Let's first find the rate at which water is being added by both faucets. The hot water faucet can fill the tub in 15 minutes, so its rate is 1 tub / 15 minutes. Similarly, the cold water faucet can fill the tub in 12 minutes, so its rate is 1 tub / 12 minutes.

Now let's find the rate at which water is being drained. The drain can empty the tub in 20 minutes, so its rate is 1 tub / 20 minutes, but since it is draining the water, we consider this as a negative rate: -1 tub / 20 minutes.

To find the net rate at which water is being added or subtracted, we add the rates of the faucets and subtract the rate of the drain:

Net rate = (Rate hot water faucet + Rate cold water faucet) - Rate drain

Net rate = (1 tub / 15 minutes + 1 tub / 12 minutes) - (1 tub / 20 minutes)

To simplify this, we need to find a common denominator:

Net rate = (20/300 tub/minute + 25/300 tub/minute) - 15/300 tub/minute

Net rate = (45/300 tub/minute) - 15/300 tub/minute

Net rate = 30/300 tub/minute

Net rate = 1/10 tub/minute

Finally, to find the time it will take to fill the tub, we need to divide 1 tub by the net rate:

Time = 1 tub / (1/10 tub/minute)

Time = 1 tub * (10/1) minute/tub

Time = 10 minutes

Therefore, it will take the tub 10 minutes to fill if both faucets and the drain are open.