Starting at home, `person( 1 )` traveled uphill to the `store( 1 )` store for `TIME_UP` minutes at just `RATE_UP` mph. `He( 1 )` then traveled back home along the same path downhill at a speed of `K * RATE_UP` mph.

What is `his( 1 )` average speed for the entire trip from home to the `store( 1 )` store and back?

The average speed is not just the average of `RATE_UP` mph and `RATE_DOWN` mph.

`He( 1 )` traveled for a longer time uphill (since `he( 1 )` was going slower), so we can estimate that the average speed is closer to `RATE_UP` mph than `RATE_DOWN` mph.

To calculate the average speed, we will make use of the following:

`\text{average speed} = \dfrac{\color{`

`KhanUtil.BLUE`}{\text{total distance}}}{\color{`KhanUtil.ORANGE`}{\text{total time}}}

`\text{distance uphill} = \text{distance downhill}`

What was the total distance traveled?

`\color{`

`KhanUtil.BLUE`}{\begin{align*}\text{total distance} &= \text{distance uphill} + \text{distance downhill}\\
&= 2 \times \text{distance uphill}\end{align*}}

```
\begin{align*}\text{distance uphill} &= \text{speed uphill} \times \text{time uphill} \\\
&=
```

`RATE_UP`\text{ mph} \times `TIME_UP`\text{ minutes}\times\dfrac{1 \text{ hour}}{60 \text{ minutes}}\\
&= `DISTANCE`\text{ miles}\end{align*}

Substituting to find the total distance:

`\color{`

`KhanUtil.BLUE`}{\text{total distance} = `2 * DISTANCE`\text{ miles}}

What was the total time spent traveling?

`\color{`

`KhanUtil.ORANGE`}{\text{total time} = \text{time uphill} + \text{time downhill}}

```
\begin{align*}\text{time downhill} &= \dfrac{\text{distance downhill}}{\text{speed downhill}}\\
&= \dfrac{
```

`DISTANCE`\text{ miles}}{`RATE_DOWN`\text{ mph}}\times\dfrac{60 \text{ minutes}}{1 \text{ hour}}\\
&= `TIME_DOWN`\text{ minutes}\end{align*}

`\color{`

`KhanUtil.ORANGE`}{\begin{align*}\text{total time} &= `TIME_UP`\text{ minutes} + `TIME_DOWN`\text{ minutes}\\
&= `TIME_UP + TIME_DOWN`\text{ minutes}\end{align*}}

Now that we know both the total distance and total time, we can find the average speed.

`\begin{align*}\text{average speed} &= \dfrac{\color{`

`KhanUtil.BLUE`}{\text{total distance}}}{\color{`KhanUtil.ORANGE`}{\text{total time}}}\\
&= \dfrac{\color{`KhanUtil.BLUE`}{`2 * DISTANCE`\text{ miles}}}{\color{`KhanUtil.ORANGE`}{`TIME_UP + TIME_DOWN`\text{ minutes}}}\times\dfrac{60 \text{ minutes}}{1 \text{ hour}}\\
&= `RATE_AVG`\text{ mph}\end{align*}

The average speed is `RATE_AVG` mph, and which is closer to `RATE_UP` mph than `RATE_DOWN` mph as we expected.

It takes `TIME_INIT` minutes for `PEOPLE_INIT` people to paint `WALL_INIT` walls.

How many minutes does it take `PEOPLE_FINAL` people to paint `WALL_FINAL` walls?

Imagine that each person is assigned one wall, and all `PEOPLE_INIT` people begin painting at the same time.

Since everyone will finish painting their assigned wall after `TIME_INIT` minutes, it takes one person `TIME_INIT` minutes to paint one wall.

If we have `PEOPLE_FINAL` people and `WALL_FINAL` walls, we can again assign one wall to each person.

Everyone will take `TIME_FINAL` minutes to paint their assigned wall.

In other words, it takes `TIME_FINAL` minutes for `PEOPLE_FINAL` people to paint `WALL_FINAL` walls.

`PEOPLE_INIT` people can paint `WALL_INIT` walls in `TIME_INIT` minutes.

How many minutes will it take for `PEOPLE_FINAL` people to paint `WALL_FINAL` walls? Round to the nearest minute.

the number of minutes, rounded to the nearest minute

We know the following about the number of walls `w`

painted by `p`

people in `t`

minutes at a constant rate `r`

.

`w = r \cdot t \cdot p`

`\begin{align*}w &= `

`WALL_INIT`\text{ walls}\\
p &= `PEOPLE_INIT`\text{ people}\\
t &= `TIME_INIT`\text{ minutes}\end{align*}

Substituting known values and solving for `r`

:

`r = \dfrac{w}{t \cdot p}= \dfrac{`

`WALL_INIT`}{`TIME_INIT` \cdot `PEOPLE_INIT`} = `fractionReduce( WALL_INIT, TIME_INIT * PEOPLE_INIT )`\text{ walls painted per minute per person}

We can now calculate the amount of time to paint `WALL_FINAL` walls with `PEOPLE_FINAL` people.

`t = \dfrac{w}{r \cdot p} = \dfrac{`

`WALL_FINAL`}{`fractionReduce( WALL_INIT, TIME_INIT * PEOPLE_INIT )` \cdot `PEOPLE_FINAL`} = \dfrac{`WALL_FINAL`}{`fractionReduce( WALL_INIT * PEOPLE_FINAL, TIME_INIT * PEOPLE_INIT )`} = `fractionReduce( WALL_FINAL * TIME_INIT * PEOPLE_INIT, WALL_INIT * PEOPLE_FINAL )`\text{ minutes}`= `

`mixedFractionFromImproper( WALL_FINAL * TIME_INIT * PEOPLE_INIT, WALL_INIT * PEOPLE_FINAL, true, true )`\text{ minutes}

Round to the nearest minute:

`t = `

`TIME_FINAL`\text{ minutes}