# Calculus

Graphical Analysis

In order to understand optimization, we must first understand what the first and second derivative tell us about the parent graph
The first derivative ($\frac{d}{dx}$) represents the slope of the parent function
The zeroes of the first derivative represent the extrema of a function (points where slope changes): the minima (when derivative changes from negative to positive) and the maxima (when derivative changes from positive to negative)
The second derivative ($\frac{d^2}{dx^2}$) represents the concavity of the parent function; that is, when the second derivative is positive, the parent function is concave up (looks like $\cup$), and when the second derivative is negative, the parent function is concave down (looks like $\cap$)
The zeroes of the second derivative represent the points of inflection (points where concavity changes) of the parent function
Notice that when a function is positive or negative on an interval, this means that its curve lies above or below the $x$-axis on that interval. Whether the function is increasing or decreasing has no effect on whether it is positive or not
On the following page you will find a labeled graph of a cubic function (red), a quadratic function (blue), and linear function (green). The cubic function is the parent function while the quadratic and linear equations are the first and second derivatives respectively

The first derivative (blue) tells us that the slope of the red function for $(-\infty, -2.5)$ and $(1.5, \infty)$ is positive since the blue function remains above the $x$-axis on that interval. However, on the interval (-2.5, 1.5), the blue function is below the $x$-axis, meaning that the slope of the red function must be negative on this interval. At the points $x=-2.5$ and $x=1.5$ the blue equation has zeros. When $x=-2.5$, the blue graph is changing from positive to negative, and so the red graph has a relative maximum at that point. At $x=1.5$, the blue graph is changing from negative to positive, so the red graph has a relative minimum at that point.
The second derivative (green) tells us that on the interval $(-\infty, -0.5)$, the red graph is concave down, since the second derivative is below the $x$-axis. At the point $x=-0.5$, the green graph has a zero, which means that the red graph has a point of inflection at that same point. Finally, on the interval $(-0.5, \infty)$, the parent function is concave up since the second derivative is positive.

Logarithmic Differentiation

Phew! Now that that's out of the way, you're almost ready to try your hand at optimization. Almost. First, you have to know all of the most common derivatives and the methods we often use to derive them.
Logarithmic differentiation refers to first taking the logarithm of both sides of a function, then differentiating accordingly (we usually do this with the natural log, ln). As you may have guessed, since we are working with logs we will also be using log and power properties. Here is a quick refresher of the main ones:

The log of a product is the sum of the logs: $\log_b{m\cdot n}=\log_b {m}+\log_b {n}$
The log of the quotient is the difference of the logs: $\log_b {\frac{m}{n}}=\log_b {m}-\log_b {n}$
You can “shake the cat from the tree": $\log_b {m^n}=n\log_b {m}$
$\ln x=\log_e x$
Change of base rule: $\log_b{a}=\frac{\log_c a}{\log_c b}$. Remember: once a base, always a base, the base stays on the bottom
$b^m\cdot b^n=b^{m+n}$
$\frac{b^m}{b^n}=b^{m-n}$
$(b^m)^n=b^{m\cdot n}$

We usually differentiate logarithmically for exponential functions, and we do so as follows: take the ln (since it is the most familiar log) of both sides of the function, differentiate, and solve! Here is an example:
$$y=2^x$$ Taking the ln of both sides, we get $$\ln y= x \ln 2$$ Now taking the derivative with respect to $x$, using implicit differentiation $$\frac{y'}{y}=\ln2$$ Now solving for $y'$ by multiplying both sides by $y$ $$y'=y\cdot \ln2=2^x\ln2$$ In fact, we see that this is true for any exponential function; that is $\frac{d}{dx}a^x=a^x\ln a$ (this is why the derivative of $e^x$ is $e^x$: the $\ln e$ is just 1!).
Finally, using what we know about implicit and logarithmic differentiation, we can define the following derivatives. Notice the patterns between the related functions.

Table of Common Derivatives
\begin{array}{|c|c|} \hline y & \frac{dy}{dx}\\ \hline \sin(x) & \cos(x)\\ \hline \cos(x) & -\sin(x)\\ \hline \tan(x) & \sec^2(x)\\ \hline \cot(x) & -\csc^2(x)\\ \hline \sec(x) & \sec(x)\tan(x)\\ \hline \csc(x) & -\csc(x)\cot(x)\\ \hline \sin^{-1}(x) & \frac{1}{\sqrt{1-x^2}}\\ \hline \cos^{-1}(x) & -\frac{1}{\sqrt{1-x^2}}\\ \hline \tan^{-1}(x) & \frac{1}{1+x^2}\\ \hline \cot^{-1}(x) & -\frac{1}{1+x^2}\\ \hline \sec^{-1}(x) & \frac{1}{\left|x\right|\sqrt{x^2-1}}\\ \hline \csc^{-1}(x) & -\frac{1}{\left|x\right|\sqrt{x^2-1}}\\ \hline a^x & a^x\ln a\\ \hline e^x & e^x\\ \hline \log_b{(x)} & \frac{1}{x\ln b}\\ \hline \ln(x) & \frac{1}{x}\\ \hline \end{array}

Optimization

We are finally ready to move on to the second application of the derivative: optimization
There is an acronym for the process of solving an optimization problem. This acronym is DEDS0JA

D iagram, Drawing, Description
E quation
D erivative
S olve
0 Zeroes
J ustify
A nswer

You will often not be required to justify, but it is still important to know how to do so for certain math classes
This acronym is self-explanatory; what you are doing when you are optimizing something is essentially finding its extrema. For example, you may be asked to solve for the maximum possible volume of a cone that changes dimensions, or for the minimum possible spending for a company. In essence, you are analyzing the derivatives to find the relative extrema of the parent function.
The hardest part of the process is formulating an equation, as it is often not provided and needs to relate all of the changing variables to one another.

Testing All Points

Don't forget - an extrema can occur at any critical point (including endpoints). If a function has more than 4 critical points, test all of them to see which produces the desired answer.
1st derivative test: when you take the derivative once, the zeroes of that derivative will tell you where there is a relative minimum or maximum, but does not specify which one. You can figure out which one it is using the second derivative test.
2nd derivative test: when you take the second derivative, if it is positive at the point where your first derivative was zero, then that point is a relative minimum. If the second derivative is negative when the first derivative equals 0, then it is a relative maximum.
DON'T FORGET TO CHECK THE ENDPOINTS!!!