Let take that Kate will add x gallons of hot water at 70 degrees to 2 gallons of cold water at 10 degrees if she wants to receive warm water at 40 degrees. Than we will have next equation:
70⋅x+10⋅2=40⋅(2+x)⇒⇒70⋅x+20=80+40⋅x⇒⇒70⋅x−40⋅x=80−20⇒⇒30⋅x=60⇒⇒x=2
So, she needs to add 2 gallons of hot water for receive warm water.
Answer: 2 gallons.