Let's say you're going to see the doctor, and you don't want to be late for your appointment.
The fastest way to get there is to take the bus. So you go to the bus stop, but see no bus coming. You have no information about when the bus will arrive, except that a bus is supposed to pass by every $15$ minutes at that time of day.
The doctor is $20$ minutes away if you walk, and you have $25$ minutes left before your appointment. So you wonder, should you wait for the bus or start walking?
You walk at $4km/h$ while the bus goes at $16km/h$.
But since you can still catch the bus if it catches up on you, an even better question would be: How long can you walk without a bus catching up on you?
## Describing the Situation
Your first step is to model the system you're dealing with.
To do so, you need to describe both your position and that of the bus as a function of the time elapsed since you made it to the bus stop, which will be $t=0$.
There is nothing fancy here, you really just need to leverage the classic $distance = speed \times time$ formula.
Your distance, as you start walking, can be expressed as $4 \times t$, provided $t$ is expressed in hours.
The bus is a little trickier, because you don't know when it leaves. You know you'll have to wait for it, you just don't know how much. Let us call that wait time $w$. Then the bus' distance from the stop can be expressed as $(t-w)\times 16$.
## Modeling the Situation
You're really interested by the time a bus will catch up with me while you walk.
Translating that into maths, you want to know when your distance from the bus stop will be equal to that of the bus, when you will be at the same place at the same time.
To express that, you can set the functions from your model equal to each other, where you want to express $t$ in terms of the wait time.
$
\begin{align}
4t = (t-w)\times 16
\\
t = (t-w)\times 4
\\
t = 4t-4w
\\
3t = 4w
\\
t = \frac{4}{3}w
\end{align}
$
## Finding the Maximum
Now that you've got a model of the situation you're interested in, you want to find the $t = \frac{4}{3}w$ maximum of that function.
In Calculus, this is usually done by finding the point where the [[Functions#Average Rate of Change|average rate of change]] (its slope) of a function is equal to $0$. In the case of a linear function like here, however, the slope is constant and represented by the coefficient of $x$, which, in this case, is $\frac{4}{3}$. Its graph is really just a straight line that endlessly goes up.
How do you find the maximum then? Well, let's take a step back and think about it for a second. What's happening here? You expressed the maximum time you will be walking as a function of the time the bus will have taken to reach the bus stop.
But the maximum wait time, or worst-case scenario is a given in this problem: it is $15$min, or $0.25$ hours. Meanwhile, the minimum amount of time the bus can take to reach the stop is, of course, $0$ minutes. This is the function's [[Functions#Domain of Functions|domain]], which we can write as $[0,\frac{1}{4}]$.
Because this is a linear function that only goes up until $\infty$, the maximum output value occurs at the maximum input value, $\frac{1}{4} =0.25$ hours in this case.
So, let's plug the two extremes of the domain you defined earlier into your model.
Doing so, you find that the smallest amount of time you can walk without the bus catching up on you is $\frac{4}{3}\cdot 0= 0$ minutes. The maximum, on the other hand, is $\frac{4}{3}\cdot \frac{1}{4}=\frac{4}{12}=\frac{1}{3}$ of hours, so $20$ minutes.
## Conclusion
In conclusion, waiting for the bus and walking to the doctor's office are strictly equivalent, and no solution outweighs the other.
Bear in mind that's all under the assumption there is no uncertainty attached the bus' arrival within the announced time frame of $15$ minutes, which, like with any form of public service, can be a risky bet. But we'll learn to include that uncertainty while describing systems in later steps.
For now, you have solved a real-world problem using basic notions from Calculus.
Congratulations 🎉