\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{graphicx}


\begin{document}

Your friend is working on the following homework problem:

Suppose that Farmer Brown decides to use 80 feet of fence to make a rectangular pen to fit a 20-foot by 40-foot corner, as shown below (all of the corner must be used and does not require fence). What dimensions give the pen a maximum area?

\begin{center}
    \includegraphics[width=0.5\textwidth]{mcr4.png}
\end{center}

Here is your friend's work:

\vspace{15pt}

The area of the pen is $A = xy$.

The total amount of fencing used is $x+y+(x-20)+(y-40) = 2x+2y-60$.

Because he is using 80 feet of fence, we see that we must have $2x+2y-60=80$.

Solving for $y$ in terms of $x$ gives $y = x-70$.

Thus, we are being asked to maximize $A(x) = x(x-70) = x^2 - 70x$.

This is maximized when $A'(x) = 0$, so we calculate $A'(x) = 2x-70$.

Solving $2x-70=0$ gives $x=35$, so our function is maximized at $x=35$.

Then $y = 70-x = 35$. 

So, then pen should be 35 feet by 35 feet.

\vspace{15pt}

Is your friend's work correct? If not, identify the error(s) and provide a correct solution.

\end{document}