One important application of differential calculus is to find the maximum (or minimum) value of a function. This often finds real world applications in problems such as the following.

A farmer has 400m of fencing materials. What is the largest rectangular paddock that can be enclosed?

*Solution* We will describe a general approach to these sorts of problems in Sections 3.5.2 and 3.5.3 below, but here we can take a stab at starting the problem.

- Begin by defining variables and their units (more generally we might draw a picture too); let the dimensions of the paddock be \(x\) by \(y\) metres.
- The area enclosed is then \(A m^2\) where
\begin{align*}
A &= x \cdot y
\end{align*}
At this stage we cannot apply the calculus we have developed since the area is a function of two variables and we only know how to work with functions of a single variable. We need to eliminate one variable.
- We know that the perimeter of the rectangle (and hence the dimensions \(x\) and \(y\)) are constrained by the amount of fencing materials the farmer has to hand:
\begin{align*}
2x+2y &\leq 400 \\
\end{align*}
and so we have
\begin{align*}
y &\leq 200-x
\end{align*}
Clearly the area of the paddock is maximised when we use all the fencing possible, so
\begin{gather*}
y = 200-x
\end{gather*}
- Now substitute this back into our expression for the area
\begin{align*}
A &= x \cdot (200-x)
\end{align*}
Since the area cannot be negative (and our lengths \(x,y\) cannot be negative either), we must also have
\begin{gather*}
0 \leq x \leq 200
\end{gather*}
- Thus the question of the largest paddock enclosed becomes the problem of finding the maximum value of
\begin{align*}
A &= x \cdot (200-x) &\text{ subject to the constraint $0 \leq x \leq 200$.}
\end{align*}

The above example is sufficiently simple that we can likely determine the answer by several different methods. In general, we will need more systematic methods for solving problems of the form

Find the maximum value of \(y = f(x)\) subject to \(a \leq x \leq b\)

To do this we need to examine what a function looks like near its maximum and minimum values.