(*Video 1: Related rates problem 1*)

(*A spherical balloon is being inflated at a rate of 16 cm^3 / sec. At what rate is the radius of the baloon increasing when it reaches r = 20 cm ?  *)

Manipulate[
Grid[{{Row[{"Radius = ",r," Volume = ",4/3 Pi r^3}]},
{Graphics[{Hue[.5],Disk[{0,0},r]},PlotRange->{{-1,1},{-1,1}},ImageSize->300,Axes->True]}},Spacings->{1,1},Frame->All],{r,0,1}]

(*Step 1: Volume V, Radius r. Both depend on time t.*)
(*Step 2: What are the relations between these quantities:*)
V[t_]:=4/3 Pi r[t]^3(*cm^3*)

(*Step 3: What is the information given in the problem?*)
V'[t]=16 (*cm^3/sec*)

(*Step 4: What is the information asked in the problem?*)
(*r'[t0]=? for t0 such that r[t0]=20 cm*)

(*Step 5: Solve by taking derivatives, possibly implicitly:*)

V'[t]==16

4 π ((r[t0])^2) r'[t0]==16/.r[t0]->20

Solve[1600 π r'[t0]==16,r'[t0]]

(*The rate of change of radius when it reaches 20 cm is (1/(100 π)) cm / sec*)

(*Step 6: Check units!*)

(*Video 2: Related rates problem 2*)

(*A 15ft ladder is resting against a wall and starts to slide down and eventually falls to the ground. At the moment in which the top of the ladder touches the wall at 10ft from the ground it is moving down at a rate of 30ft/sec. Find how fast the bottom of the ladder is moving away from the wall at that moment.*)

Manipulate[
Grid[{{Row[{"x = ",x," y = ",Sqrt[15^2-x^2]}]},
{Graphics[{Hue[.5],Triangle[{{0,0},{x,0},{0,Sqrt[15^2-x^2]}}]},PlotRange->{{0,16},{0,16}},ImageSize->300,Axes->True]}},Spacings->{1,1},Frame->All],{x,0,15}]

(*Step 1 (Quantities): x[t]=distance from bottom of ladder to wall, y[t]=height where ladder touches the wall. Both depend on time t.*)
(*Step 2: What are the relations between these quantities:*)
x[t]^2+y[t]^2==15^2

(*Step 3: What is the information given in the problem?*)
y[t0]->10,y'[t0]->-30

(*Step 4: What is the information asked in the problem?*)
(* x'[t0]=?*)

(*Step 5: Solve by taking derivatives, possibly implicitly:*)

D[x[t]^2+y[t]^2==15^2,t]

2 x[t] x'[t]+2 y[t] y'[t]==0/.t->t0

2 x[t0] x'[t0]+2 y[t0] y'[t0]==0/.{y[t0]->10,y'[t0]->-30}

-600+2 x[t0] x'[t0]==0/.x[t0]->5 (Sqrt[5])

Solve[-600+10 (Sqrt[5]) x'[t0]==0,x'[t0]]

(*Can find x[t0] by using the relation x[t]^2+y[t]^2==15^2*)
x[t0]^2+y[t0]^2==15^2/.y[t0]->10

Solve[100+((x[t0])^2)==225,x[t0]]

(*The bottom of the ladder is moving away from the wall at a rate of 12 (Sqrt[5]) ft/sec.*)

(*Step 6: Check units!*)