CoCalc Public Files08 - Related Rates Assignment / Related Rates Notes.sagews
Author: Aaron Tresham
Views : 92
Compute Environment: Ubuntu 20.04 (Default)
This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is

### Prerequisites:

• Intro to Sage
• Differentiation
• Implicit Differentiation

# Related Rates

Related rates problems involve two or more changing quantities. The quantities are related to each other, and you know the rate of change of all but one quantity. The goal is to find the rate of change of the last quantity.

The computations are similar to implicit differentiation.

## Example 1

The length of a rectangle is increasing at a rate of 8 cm/s and its width is increasing at a rate of 3 cm/s. At what rate is the area of the rectangle increasing when the length is 20 cm and the width is 10 cm?

Solution

This example involves three quantities: length, width, and area of a rectangle. Let's call these $l$, $w$, and $A$.

We know from geometry that these three quantities are related: $A=l\cdot w$.

We know the rate of change of two of the three quantities with respect to time ($t$):

$\displaystyle\frac{dl}{dt}=8$ cm/s

$\displaystyle\frac{dw}{dt}=3$ cm/s

The question asks us about the third rate of change, $\displaystyle\frac{dA}{dt}$.

The idea is to take the derivative of the equation $A=l\cdot w$ with respect to $t$ (all three quantities are functions of time).

Similar to what we did with implicit differentiation, we must tell Sage that $l$, $w$, and $A$ are functions of $t$, and then we can take the derivative.

## Caution: Always take the derivative before plugging in values for any variables.

%var t
l=function('l')(t)  #l is a function of t
w=function('w')(t)  #w is a function of t
A=function('A')(t)  #A is a function of t
derivative(A==l*w,t)  #don't forget the double equal sign ==
show(_)

diff(A(t), t) == w(t)*diff(l(t), t) + l(t)*diff(w(t), t)
$\displaystyle \frac{\partial}{\partial t}A\left(t\right) = w\left(t\right) \frac{\partial}{\partial t}l\left(t\right) + l\left(t\right) \frac{\partial}{\partial t}w\left(t\right)$

Notice that Sage writes $l$, $w$, and $A$ as functions of $t$.

Usually we don't write all of these as functions of $t$, but we will use Liebniz's notation to make it clear that the derivatives are with respect to time:

$\frac{dA}{dt}=w\frac{dl}{dt}+l\frac{dw}{dt}$

Notice that this equation gives us a formula for the rate of change of area (what the question asks for) in terms of things we know (length, width, and their rates of change).

Although the rates of change of both length and width are constants, notice that the rate of change of area is not a constant.

Now that we have the derivative, we can start plugging in values. The question asks for $\displaystyle\frac{dA}{dt}$ when $l=20$ and $w=10$.

$\frac{dA}{dt}=10\cdot8+20\cdot3=140$

So at the time specified, the area is changing at a rate of $140\ \textrm{cm}^2/\textrm{s}$.

10*8+20*3

140

## Example 2

A 12 m ladder rests on horizontal ground and leans against a vertical wall. The foot of the ladder is pulled away from the wall at the rate of $\frac{1}{10}$ m/s. How fast is the top sliding down the wall when the foot of the ladder is 4 m from the wall?

Solution

Let $y$ be the vertical distance from the top of the ladder to the ground, and let $x$ be the horizontal distance from the wall to the foot of the ladder.

We are told $\frac{dx}{dt}=\frac{1}{10}$, and we are asked to find $\frac{dy}{dt}$ when $x=4$.

Since the ladder, wall, and ground form a right triangle, the Pythagorean Theorem relates $x$ and $y$:

$x^2+y^2=12^2$

We now take the derivative of this equation with respect to time.

[Note: 12 is a constant, so we can plug it in now. But $x$ and $y$ are changing, so do not plug in values for these until after you have found the derivative.]

%var t
x=function('x')(t)
y=function('y')(t)
derivative(x^2+y^2==12^2,t)  #don't forget ==
show(_)

2*x(t)*diff(x(t), t) + 2*y(t)*diff(y(t), t) == 0
$\displaystyle 2 \, x\left(t\right) \frac{\partial}{\partial t}x\left(t\right) + 2 \, y\left(t\right) \frac{\partial}{\partial t}y\left(t\right) = 0$

Let's rewrite this:

$2x\frac{dx}{dt}+2y\frac{dy}{dt}=0$

We want $\frac{dy}{dt}$, so let's have Sage solve for this:

solve(derivative(x^2+y^2==12^2,t),derivative(y,t))
show(_)

[diff(y(t), t) == -x(t)*diff(x(t), t)/y(t)]
[$\displaystyle \frac{\partial}{\partial t}y\left(t\right) = -\frac{x\left(t\right) \frac{\partial}{\partial t}x\left(t\right)}{y\left(t\right)}$]

$\frac{dy}{dt}=-\frac{x}{y}\frac{dx}{dt}$

We are given $\frac{dx}{dt}$ and $x$, but we also need to know $y$.

When $x=4$, what is $y$?

solve(4^2+y^2==12^2,y)
show(_)

[y(t) == -8*sqrt(2), y(t) == 8*sqrt(2)]
[$\displaystyle y\left(t\right) = -8 \, \sqrt{2}$, $\displaystyle y\left(t\right) = 8 \, \sqrt{2}$]

We don't care about the negative solution ($y>0$ since it is a distance). So when $x=4$ we have $y=8\sqrt{2}$.

Now let's plug in all the given information:

$\frac{dy}{dt}=-\frac{4}{8\sqrt{2}}\cdot \frac{1}{10}=-\frac{\sqrt{2}}{40}\approx-0.0354$

Notice that the derivative is negative, since the distance is decreasing (top of ladder sliding down the wall).

The top of the ladder is sliding down the wall at a rate of about 0.0354 m/s.

-4/(8*sqrt(2))*1/10
N(_)

-1/40*sqrt(2) -0.0353553390593274

## Example 3

A cylindrical tank standing upright (with one circular base on the ground) has radius 20 cm. How fast does the water level in the tank drop when the water is being drained at a rate of 25 cm$^3$/s?

Solution

Let $r$ be the radius of the tank, $h$ be the water level, and $V$ the volume of the water. We are given that $r=20$ and $\frac{dV}{dt}=-25$ [the derivative must be negative, since $V$ is decreasing].

The relationship of these three quantities is given by the volume formula for a cylinder: $V=\pi r^2h$.

In this case $r=20$, so $V=400\pi h$.

Let's take the derivative:

%var t
V=function('V')(t)
h=function('h')(t)
derivative(V==400*pi*h,t)
show(_)

diff(V(t), t) == 400*pi*diff(h(t), t)
$\displaystyle \frac{\partial}{\partial t}V\left(t\right) = 400 \, \pi \frac{\partial}{\partial t}h\left(t\right)$

So we see

$\frac{dV}{dt}=400\pi\frac{dh}{dt}$

We want to solve this for $\frac{dh}{dt}$, so divide both sides by $400\pi$ and plug in the given value of $\frac{dV}{dt}$:

$\frac{dh}{dt}=\frac{\frac{dV}{dt}}{400\pi}=\frac{-25}{400\pi}=-\frac{1}{16\pi}\approx-0.01989$

Thus, the water level is falling at a rate of about 0.02 cm/s.

-25/(400*pi)
N(_)

-1/16/pi -0.0198943678864869