\chapter{Binary Logic}

The basic idea of binary logic is that a particular statement or questions has one of two possible values assigned to it. It is called binary because the two possibilities form a pair, like a pair of wheels on a bicycle. However, a statement can only be assigned one value at a time: It is either \textcolor{blue}{true}, or it is \textcolor{red}{false}. As a flowchart, this allows a branching of a program based on the truth value.\\

\begin{center} \imagegraphic[0.3]{flowchart_true.png}\end{center}

We will also use what is called a Venn diagram to understand when certain combinations of statements are true or false. In the following diagram there is only one statement. The circle is colored blue because inside the circle represents when the questions "Is A true?" is a true statement. Outside the circle represents when the answer to that question is false.\\

\begin{center} \imagegraphic[0.5]{A_venn.png}\end{center}

\section{Logical Operators}

The logical operators (AND, OR, NOT) are ways of combining truth values of multiple statements, resulting in a new truth value. You can think of them kind of like arithmetic operations, except for boolean values (true or false) instead of numbers.\\

\section{The OR Operator}

To illustrate how they work, imagine someone is trying to get into a locked room full of gold. The room has some set of doors that leads to the room, and each door requires a key to open. In this first scenario, the room has two doors either one of which will let the person in. If they have at least one of the keys, they can get in. This is like the OR operation.\\

\begin{center} \imagegraphic[1.0]{OR.png}\end{center}

Now to put this in more mathematical terms, the truth values of A and B are referring to whether that person has the key for that door. And the resulting truth value is whether they are able to get the gold. So, if I say \(A=true\), then I am saying they have the key for door A. \(A=false\) would mean that they don't have that key. And \(B=true\) means they have the key for door B, etc.\\

When I say \(A\: OR \: B\), the result is true if they have either key, even if they have both keys at the same time. The result is false only if they have neither key. There are two keys, and there are two truth values for each one (do they have it or not). \(2 \times 2 = 4\) possible combinations. If it helps you, every possible result can be listed in a table\\

\begin{center}
	\begin{tabular}{c | c | c}
		has key A & has key B & A OR B = gets the gold\\ \hline
		\textcolor{red}{false} & \textcolor{red}{false} & \textcolor{red}{false}\\ \hline
		\textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{blue}{true} \\ \hline
		\textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{blue}{true} \\ \hline
		\textcolor{blue}{true} & \textcolor{blue}{true} &\textcolor{blue} {true} \\ \hline
	\end{tabular}
\end{center}

We can also view the OR operations as the result of a flowchart. You can see below why there is only one way of getting a false result with the OR operation: both A and B have to be false to get false. But there is more than one way to get true.

\begin{center} \imagegraphic[0.5]{flowchart_OR.png}\end{center}

Yet another way of visualizing an OR operation is in a Venn diagram. The idea of a Venn diagram is to look at all the ways a statement is true. The points inside the A circle represents when A is true, and the points outside of that circle are when A is false. The same is true for the B circle and the truth of B. The combination of both circles is a collection of points representing when either A is true or B is true, which is the same as the statement A OR B.

\begin{center} \imagegraphic[0.5]{OR_venn.png}\end{center}

\section{The AND Operator}

In the next scenario, the one door is behind the other door. If the person has key A, but not key B, they cannot get in. If they have key B but not key A, they still cannot get in. \\

\begin{center} \imagegraphic[1.0]{AND.png}\end{center}

So, the result of A AND B is only true if they have both keys; that is, both A and B are true. If either A or B are false, or both, then the result is false.

\begin{center}
	\begin{tabular}{c | c | c}
		has key A & has key B & A AND B = gets the gold \\ \hline
		\textcolor{red}{false} & \textcolor{red}{false} & \textcolor{red}{false}\\ \hline
		\textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{red}{false} \\ \hline
		\textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{red}{false} \\ \hline
		\textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true} \\ \hline
	\end{tabular}
\end{center}

We can also view the AND operation as the result of a flowchart, and why there is only one way of getting a true result from an AND operation; both A and B have to be true. But there is more than one way to get false.

\begin{center} \imagegraphic[0.3]{flowchart_AND.png}\end{center}

As a Venn diagram, the AND operation selects only the area that is common to both A and B.

\begin{center} \imagegraphic[0.5]{AND_venn.png}\end{center}

\section{Order of Operations}

Logical operators can be combined just like arithmetic operators can. Parenthesis can be used to specify the order of the operations. In this example, the operation A or B is performed first. The result of that is then used with the AND operation. To get into the first room, they only need one key: either A OR B. But to get into the gold room, they also need key C no matter what.\\

\begin{center} \imagegraphic[1.0]{AorBandC.png}\end{center}

This time there are 8 total possible outcomes because there are three keys, each with two possible states (has it or doesn't have it): \(2 \times 2 \times 2 = 8 \). But since they can only get in if they also have key C, then only those times can they get the gold.

\begin{center}
	\begin{tabular}{c | c | c | c | c}
		A & B & C & A OR B & (A OR B) AND C = gets the gold\\ \hline
		\textcolor{red}{false} & \textcolor{red}{false} & \textcolor{red}{false} & \textcolor{red}{false} & \textcolor{red}{false}\\ \hline
		\textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{red}{false}\\ \hline
		\textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{red}{false}\\ \hline
		\textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{red}{false}\\ \hline

		\textcolor{red}{false} & \textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{red}{false}\\ \hline
		\textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true}\\ \hline
		\textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true}\\ \hline
		\textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true}\\ \hline
	\end{tabular}
\end{center}

As a flowchart, I simply added an AND using the result of the OR operation.

\begin{center} \imagegraphic[0.5]{flowchart_ORAND.png}\end{center}

Logical operations can usually be thought of in different ways. We could have also thought about the above problem as having two different ways of getting into the gold room. Either having keys A AND C, or having keys B AND C. So, we could write the same result as:\\

\begin{center}
	(A AND C) OR (B AND C) = (A OR B) AND C
\end{center}

\begin{center} \imagegraphic[0.5]{ORAND_venn.png}\end{center}

In the following scenario the AND operation is done first, however, so that means that even if they don't have either key B or key C, they can still get in if they have key A. But if they don't have key A, then they have to have both keys B and C to get in.\\

\begin{center} \imagegraphic[1.0]{AorBandC2.png}\end{center}

\begin{center}
	\begin{tabular}{c | c | c | c | c}
		A & B & C & B AND C & A OR (B AND C) = gets the gold\\ \hline
		\textcolor{red}{false} & \textcolor{red}{false} & \textcolor{red}{false} & \textcolor{red}{false} & \textcolor{red}{false}\\ \hline
		\textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{red}{false} & \textcolor{red}{false}\\ \hline
		\textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{red}{false} & \textcolor{red}{false} & \textcolor{blue}{true}\\ \hline
		\textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{red}{false} & \textcolor{blue}{true}\\ \hline

		\textcolor{red}{false} & \textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{red}{false}\\ \hline
		\textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true}\\ \hline
		\textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{blue}{true} & \textcolor{red}{false} & \textcolor{blue}{true}\\ \hline
		\textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true} & \textcolor{blue}{true}\\ \hline
	\end{tabular}
\end{center}

Now that the AND is performed first, and OR is second, it causes a minor difference in the flowchart. See if you can spot the difference, and why that means there are more ways for it to result in true than when the OR was done first.

\begin{center} \imagegraphic[0.5]{flowchart_ANDOR.png}\end{center}

If there are no parenthesis, then AND is done first. So:

\begin{center}A OR B AND C = A OR (B AND C)\end{center}

since AND gets higher precedence anyway. However, always using parenthesis has the added benefit of always making you think about want you \textit{intend} to do, which helps prevent mistakes.

\begin{center} \imagegraphic[0.5]{ANDOR_venn.png}\end{center}

\section{The NOT Operator}

The NOT operation simply takes a truth value, and gives whatever the opposite value would be. For example, if A = false (they don't have key A), then that means that NOT A = true. It is just like saying "they don't have key A" (which is true if A = false). If A = true, then NOT A = false, since "they don't have key A" is a false statement in that case.\\

We can also view the NOT operation as the result of a flowchart.

\begin{center} \imagegraphic[0.3]{flowchart_NOT.png}\end{center}

This leads to several important identities. Take the first example where we have A OR B. So, lets say A OR B = G, where G is true when they can get the gold. But say we want to know when NOT G, when do they not get the gold? Well logically they don't get the gold if they don't have either key: NOT G = (NOT A) AND (NOT B). But if we replace the G with the original thing we get the following identity:

\begin{center}
	NOT (A OR B) = (NOT A) AND (NOT B)
\end{center}

In the view of the flowchart, it is as simple as flipping the results. True becomes false, and false becomes true.

\begin{center} \imagegraphic[0.5]{flowchart_NOTOR.png}\end{center}

But then where does AND factor in on the right hand side? It's there because it's doing an AND on the 'no' branches now, instead of the 'yes'. I'll rearrange it a little by flipping the no/yes branches coming out of each condition so you can see it really does mean AND.

\begin{center} \imagegraphic[0.3]{flowchart_NOTOR2.png}\end{center}

Now lets do the same thing for the second case where G = A AND B. Logically, they won't get the gold if they don't have one of the keys. So, NOT G = (NOT A) OR (NOT B). Now replacing G with A AND B we get:

\begin{center}
	NOT (A AND B) = (NOT A) OR (NOT B)
\end{center}

\begin{center} \imagegraphic[0.3]{flowchart_NOTAND.png}\imagegraphic[0.47]{flowchart_NOTAND2.png}\end{center}

You may notice a pattern here. When you negate an OR, you negate both sides of the OR and then switch the OR to an AND. Also, when you negate an AND, you negate both sides and switch it to an OR.\\

To negate more complicated expressions, like (A OR B) AND C, you could do one of two things. One, you cold look at the problem and figure out the case where they don't get the gold. Here they can't get it if they're missing both the A key and the B key, or they're missing the C key. So:

\begin{center}
	NOT((A OR B) AND C) = ((NOT A) AND (NOT B)) OR (NOT C)
\end{center}

If you notice though, once you have the identities for AND and OR by themselves, you can apply the NOT starting from the 'outside' and working in. For the case G = A OR (B AND C), the last operation to be done is the OR. So, negate the OR first, which causes B AND C to be negated, so you can use the other identity to negate that one.

\begin{center}
	NOT(A OR (B AND C)) = (NOT A) AND (NOT (B AND C))\\

	NOT(A OR (B AND C)) = (NOT A) AND ((NOT B) OR (NOT C))
\end{center}

So, for the case of G = A OR (B AND C), we can see they don't get the gold if don't have key A, and they also don't have just one of key B or key C.\\


\documentclass[oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage{authblk}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{geometry}
\usepackage{amsthm}
\usepackage{runic}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{mathrsfs}
\usepackage[breaklinks=true,a4paper=true,pagebackref=true]{hyperref}
\graphicspath{ {figures/} }
\geometry{
 a4paper,
 total={170mm,257mm},
 left=20mm,
 top=20mm,
}
\hypersetup{
    colorlinks=true,
    linktoc=true,
    linkcolor=blue,
}
\title{Libraria Calculosis}
\author{Liam Gardner}
\date{\today}
%\doublespacing
\newcommand\tab[1][1cm]{\hspace*{#1}}
\newcommand\nextline{\newline\tab}
\newcommand\nextquestion{\newline\newline}
\newcommand\soln{$\text{sol}^\text{n}\text{ }$}
\newcommand\fs{\mbox{\large $\mathrlap{f}s\,$}\,}
\newcommand\thm[2]{\section*{Theorem: #1}\label{sec:#2}\addcontentsline{toc}{section}{Theorem: #1}}
\newcommand\propn[2]{\section*{Proposition: #1}\label{sec:#2}\addcontentsline{toc}{section}{Proposition: #1}}
\newcommand\ddx[1]{\frac{\text{d}}{\text{dx}}\left[#1\right]}
\newcommand\dydx{\frac{\text{dy}}{\text{dx}}}
\newcommand{\Lim}[1]{\raisebox{0.5ex}{\scalebox{0.8}{$\displaystyle \lim_{#1}\;$}}}
\newcommand{\dfdx}{\frac{\text{df}}{\text{dx}}}
\newcommand \interval[1]{\,^a_b\mathcal{I}_{#1}}
\begin{document}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}

\maketitle
\tableofcontents
\chapter{Approximating $\sqrt{95}$ Using Newton's Method}
\tab
Let $f(x)=x^2-95$, then $f^\prime(x) = 2x$. Newton's Update Function then produces
$$x-\frac{f(x)}{f^\prime(x)}$$
$$=x\frac{x^2-95}{2x}$$
$$=\frac{2x^2}{2x} - \frac{x^2-95}{2x}$$
$$=\frac{x^2+95}{2x}$$
\tab
Thus, we can define a recursive sequence $x_{n+1} = \frac{x_n^2 + 95}{2x_n}$. Using a starting point of $x_0=10$, since $\sqrt{95}$ is close to $\sqrt{100}=10$. we get the following
\nextline
\begin{center}
\begin{tabular}{|c|c|}
\hline
$x_0$ & 10 \\
$x_1$ & 9.75 \\
$x_2$ & 9.764764 \\
\hline
\end{tabular}
\end{center}
\tab
Notice that even for $x_2$, we get an approximation correct to 6 digits.
\subsection{If Newton's method converges, does it always converge to a root?}
\tab
Another way of phrasing this is if $\{x_n\}\rightarrow L$, is $f(L)=0$?.
\nextline
Since the sequence is convergent, we can replace $x_{n+1}$ and $x_n$ with L, and solve $L=L-\frac{f(L)}{f^\prime(L)}$ which implies that $f(L)=0$. Therefore, if Newton's Method converges, we're guaranteed that it converges to a root.
\chapter{Derivatives of Inverse Functions}
\tab
We still haven't seen $\ddx{\ln(x)}$. Our goal is to relate the derivative of a function with the derivative of its inverse.
Given a function $f(x)$, we can define the linearization at a point $a$ as $\mathcal{L}_a^{f}$. Then, if we invert the linearization function, we get $\left(\mathcal{L}_a^{f}\right)^{-1} = a+\frac{1}{f^\prime(a)}(x-f(a))$. If we take a point $f(a)=b$, then we get that $a= f^{-1}(b)$. Thus $\left(\mathcal{L}_a^f\right)^{-1} = f^{-1}(b) + \frac{x-b}{f^\prime\left(f^{-1}(b)\right)}$. Therefore, we know that the inverse linearization of $f(x)$ at a point $x=a$, is the same as $\mathcal{L}_b^{f^{-1}}$. That is to say, the inverse linearization of a function at a point $a$ is the same as the linearization of the inverse function at a point $f(a)$. Thus, $\mathcal{L}_b^{f^{-1}} = f^{-1}(b) + \ddx{f^{-1}}\lvert_{x=b} \cdot (x-b)$. Thus, by equality we know that $\ddx{f^{-1}}\lvert_{x=b} = \frac{1}{f^\prime(f^{-1}(b))}$
\thm{Inverse Function Theorem}{ift}
\tab
If $f$ is an invertible function on $[c,d]$, differentiable on $(c,d)$, and that $f^\prime(a)\neq0$, then $f^{-1}$ is differentiable at $x=f(a)$ with the derivative $\ddx{f^{-1}}\lvert_{x=b} = \frac{1}{f^\prime(f^{-1}(b))}$. Along with that $\left(\mathcal{L}_a^f\right)^{-1} = \mathcal{L}_{f(a)}^{f^{-1}}$
\subsection{Proof sketch}
\tab
If $f$ is an invertible function, then $f(f^{-1}(x)) = x$. Thus, since they're equal $\ddx{f(f^{-1}(x))} = \ddx{x}$
$$\ddx{f(f^{-1}(x))} = f^\prime(f^{-1}(x))\cdot \ddx{f^{-1}(x)} = 1$$
$$\ddx{f^{-1}(x)} = \frac{1}{f^\prime(f^{-1}(x))}$$
\newline
\null\hfill$\mathcal{QED}$
\subsection{Testing Inverse Function Theorem}
\tab Let $f(x)=x^5$, then $f^{-1}(x)=\sqrt[5]{x}=x^{\frac{1}{5}}$. Thus, we know that $\ddx{f^{-1}(x)} = \frac{1}{5}x^{-4}{5} = \frac{1}{5\cdot\sqrt[5]{x^4}}$.
\nextline
Using IFT, we get that the derivative is $\frac{1}{f^\prime(f^{-1}(x))} = \frac{1}{5(f^{-1}(x))^4}  = \frac{1}{5(x)^\frac{4}{5}}$
\subsection{Derivative of $\ln(x)$}
Using IFT, we can now calculate the derivative of $\ln(x)$.
$$\ddx{\ln(x)} = \frac{1}{f^\prime(f^{-1}(x))} = \frac{1}{e^{\ln(x)}} = \frac{1}{x}$$
\nextline
Furthermore, we can generalize this to know that $\ddx{\log_a(x)} = \frac{1}{x\ln(a)}$
\subsection{Derivative of Inverse Trig Functions}
\tab
We know that $\ddx{\sin(x)} = \cos(x)$.
$$\ddx{\arcsin{x}}=\frac{1}{\cos(\arcsin(x))}$$
Let $\theta=\arcsin(x)$, then $\sin(\theta)=x$. Using a triangle with a hypotenuse of $1$ and an opposite side to $\theta$ of $x$. Then by the pythagorean theorem, we know the final side $a$ can be found as $a=\sqrt{1-x^2}$. Thus, $\cos(\arcsin(x)) = \cos(\theta) = \sqrt{1-x^2}$
\nextline
Therefore, the derivative of the $\arcsin(x)$ function is $\frac{1}{\sqrt{1-x^2}}$. Similarly, $\ddx{\arccos(x)} = \frac{-1}{\sqrt{1-x^2}}$ and $\ddx{\arctan(x)}=\frac{1}{x^2+1}$.
\chapter{Implicit Differentiation}
\tab
We understand how to take the derivative of explicitly defined functions, as in $y=f(x)$. However, there are ways to differentiate implicitly defined functions, such as $x^2+y^2=1$. That expression implicitly defines two functions. An implicit function is an equation where $y$ is a function of $x$, thus we can (poorly) rewrite the equation for the unit circle as $x^2+f(x)^2 = 1$.
\nextline
To take the derivative of an implicit function, we take the derivative of both sides
$$\ddx{x^2+y^2=1}$$
$$\implies \ddx{x^2+y^2} = \ddx{1}$$
$$\implies \ddx{x^2}+\ddx{y^2} = 0$$
$$\implies 2x + 2y\dydx = 0$$
$$\implies \dydx=\frac{-x}{y}$$
\tab
Often with implicitly defined functions, the result of differentiation will also be implicit.
\nextline
If we wanted to know the slope(s) of the unit circle when $x=\frac{1}{2}$, we can that the two points we get are
$$\left(\frac{1}{2}\right)^2 + y^2 = 1$$
$$\implies y^2 = \frac{3}{4}$$
$$\implies y=\sqrt{\frac{3}{4}}=\frac{\pm\sqrt{3}}{2}$$
\tab
From this, we can use the implicit derivative on both points to get
$$\dydx=\frac{\frac{1}{2}}{\frac{\sqrt{3}}{2}} = \frac{-1}{\sqrt{3}}$$
$$\dydx=\frac{\frac{1}{2}}{\frac{-\sqrt{3}}{2}} = \frac{1}{\sqrt{3}}$$
\tab
Thus, we see that the two slopes of the unit circle at $x=\frac{1}{2}$ are $\frac{\pm1}{\sqrt{3}}$.
\newline
\begin{figure}[h]
\centering
\includegraphics[width=0.35\textwidth]{l24f0}
\caption{Slopes of the unit circle at $x=\frac{1}{2}$}
\end{figure}
\newpage
Trying this again using $x^2+y^2=-1$, we see that the implicit derivative is the same as $x^2+y^2=1$, however, the derivative doesn't actually make sense, as the sum of two squares is always nonnegative. Thus, $x^2+y^2=-1$ does not define a function in $\mathbb{R}^2$, as there are no pairs of real numbers $(x,y)$ that satisfy $x^2+y^2=-1$.
\nextline
Similarly, the relation $2x=x$ defines a point rather than a function, and thus differentiating doesn't yield anything reasonable, as the result is $2=1$.
\section{Example}
\tab
Find $\dydx$ if $x^3y^5+3x=8y^3+1$
$$\ddx{x^3y^5+3x=8y^3+1}$$
$$\implies \ddx{x^3y^5+3x} = 24y^2\dydx$$
$$\implies \ddx{x^3y^5} + 3 = 24y^2\dydx$$
$$\implies 3x^2y^5 + 5y^4x^3\dydx + 3 = 24y^2\dydx$$
$$\implies \dydx\left(5x^3y^4-24y^2\right)=-3x^2y^5-3$$
$$\implies \dydx=\frac{-3x^2y^5-3}{5x^3y^4-24y^2}$$
\chapter{Logarithmic Differentiation}
\tab
Logarithmic Differentiation is a trick in which you take the natural logarithm of both sides before implicit differentiation.
\nextline
Differentiation with a logarithm gives means of dealing with things like $y=f(x)^{g(x)}$. Along with that, since $\ln(ab)=\ln(a)+\ln(b)$, using logarithmic differentiation allows us to skip using the product rule.
\subsection{Example 1}
Find $\dydx$ for $y=x^x$
\nextline
$$y=x^x$$
$$\implies \ln(y)=\ln(x^x)$$
$$\implies \ln(y)=x\ln(x)$$
$$\implies \ddx{\ln(y)=x\ln(x)}$$
$$\implies \ddx{\ln(y)}=\ddx{x\ln(x)}$$
$$\implies \frac{1}{y}\dydx = \ln(x)+1$$
$$\implies \dydx=y\left(\ln(x)+1\right)$$
\tab
Since the original function was defined explicitly, the derivative should be explicitly defined as well, thus we substitute $y=x^x$ to get
$$\dydx=x^x\left(\ln(x)+1\right)$$
\subsection{Example 2}
Find $\dydx$ for $y=\frac{\sin(x)e^xx^3}{\ln(x)}$
$$y=\frac{sin(x)e^xx^3}{\ln(x)}$$
$$\ln(y)=\ln\left(\frac{\sin(x)e^xx^3}{\ln(x)}\right)$$
$$\implies \ln(y)=\ln(\sin(x))+\ln(e^x)+\ln(x^3)-\ln(\ln(x))$$
$$\implies \ln(y)=\ln(\sin(x))+3\ln(x)-\ln(\ln(x)) + x$$
$$\implies \ddx{\ln(y)=\ln(\sin(x))+3\ln(x)-\ln(\ln(x)) + x}$$
$$\implies \frac{1}{y}\dydx = \frac{\cos(x)}{\sin(x)} + \frac{3}{x} + 1 - \frac{1}{x\ln(x)}$$
$$\implies \dydx=y\left(\frac{\cos(x)}{\sin(x)} + \frac{3}{x} + 1 - \frac{1}{x\ln(x)}\right)$$
\chapter{Extrema}
$\mathbf{\text{def}^{\text{n}}}$: A point $c$ is a local maximum of a function $f$ if there exists an open interval $\mathcal{I}$ containing the point $c$ such that $f(x)\leq f(c) \forall x \in \mathcal{I}$. Similarly, $c$ is a local minimum if $f(x)\geq f(c) \forall x\in\mathcal{I}$. If $f:\mathbb{R}\rightarrow\mathcal{I}$ then $c$ is a global extrema. Thus, all global extrema are also local extrema. It is also true that many local extrema can exist
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{l25f0}
\caption{Examples of local and global extrema}
\end{figure}

\thm{Local Extrema Theorem}{LET}
\tab
If $c$ is a local extrema and $f^\prime(c)$ exists, then we know $f^\prime(c)=0$.
\subsection{proof}
\tab
Notice that if $c$ is a local min of $f$, we can define a new function $g(x)=-f(x)$ and thus $c$ is a local max of $g$. Now, suppose WLOG suppose $c$ is a local max of $f$. Therefore, there exists an open interval $\mathcal{I}=(a,b)$ containing $c$, such that $f(x)\leq f(c)\forall x\in\mathcal{I}$. Furthermore, suppose that $f^\prime(c)$ exists. Therefore, the following is true:
$$f(c)=\lim_{h\rightarrow0^+}\frac{f(c+h)-f(c)}{h}=\lim_{h\rightarrow0^-}\frac{f(c+h)-f(c)}{h}$$
\tab
If $h>0$ but is small enough that $a<c+h<b$ then we know that $f(c+h)\leq f(c)$ because $c$ is a max of $f$ in the interval $\mathcal{I}$. Therefore, we get that$\frac{f(c+h)-f(x)}{h}\leq 0$ and thus $f^\prime(c)\leq0$
\nextline
If $h<0$ but small ehough that $a<c+h<b$ then we know that $\frac{f(c+h)-f(c)}{h}\geq 0$ since division by a negative flips the inequality sign. Therefore, we get that $f^\prime(c)\geq0$\nextline
Therefore, since $f^\prime(c)\leq0$ and $f^\prime(c)\geq0$ we get that $f^\prime(c)=0$
\newline
\null\hfill$\mathcal{QED}$
\subsection{Converse}
\tab Consider $f(x)=x^3$. Notice now that $f^\prime(x)=3x^2$ and thus $f^\prime(0)=0$, and $f(0)$ isn't a local extrema. Therefore, the converse isn't true. If we also look at $f(x)=\abs{x}$, we know that $f(0)$ is a global min, however the derivative at $x=0$ doesn't exist, and thus the theorem doesn't apply.
\section{Finding Global Extrema}
$\mathbf{\text{def}^{\text{n}}}$: A point $c$ is a critical point of $f^\prime(c)=0$ or $f^\prime(c)$ doesn't exist.\nextline
Let's say that all max/mins occur at critical points. Combining this with the extreme value theorem gives us an algorithm for finding extrema. \nextline
Consider a differentiable function $f$ on the closed interval $[a,b]$. To find all global extrema, we do the following:
\begin{enumerate}
\item find all critical points of $f$ on $[a,b]$, let $\mathcal{C}$ be the set of all $x$-values of critical points.
\item Evaluate $f(a)$, $f(b)$ and $f(c) \forall c\in\mathcal{C}$.
\item Choose the biggest and smallest values of $f(a)$, $f(b)$ and $f(c) \forall c\in\mathcal{C}$ \\
The biggest is the global max, and the smallest is the global min.
\end{enumerate}
\subsection{Example}
Find the max/min of $f(x)=e^{x^3-2x^2-7x}$ on $[0,4]$
\nextline
Finding critical points: We know that $\dfdx$ is defined everywhere, and thus there will be no places on the interval where the derivative is undefined.
\nextline
By the chain rule we know $\dfdx=e^{x^3-2x^2-7x}(3x^2-4x-7)$. Since $e^{p(x)}$ will never be zero, we know that $\dfdx$ will be zero only when the quadratic term is 0. Since the quadratic factors to $(x+1)(3x-7)$, and since we know that $-1\not\in[0,4]$, we know that the only critical point will be $\frac{7}{3}$.
\nextline
$\left\{f(0), f(4), f\left(\frac{7}{3}\right) \right\} = \left\{1, e^4, e^\frac{-392}{27} \right\}$
\nextline
From here, we can see that the global max and min are given by the points $(4,e^4)$, $\left(\frac{7}{3}, e^\frac{-392}{27}\right)$. Therefore, the global max is $4$ and the global min is $\frac{7}{3}$.
\nextline
This topic will be revisited upon the genesis of the curve sketching unit.
\chapter{The Mean Value Theorem}
\thm{Rolle's Theorem}{RT}
\tab
If $f$ is a continuous function on $[a,b]$ and differentiable on $(a,b)$, and if $0=f(a)=f(b)$, then $\exists c\in (a,b)$ such that $f^\prime(c)=0$.
\subsection{Proof}
\tab
Suppose that $f$ is continuous on $[a,b]$ and differentiable on $(a,b)$ with $f(a)=f(b)=0$.
\subsection*{Case 1}
\tab $\exists x_0\in(a_b)$ with $f(x_0)>0$. The Extreme Value Theorem, shows that $f(x)$ achieves a max value on $[a,b]$. We know that the maximum point $c\in (a,b)$  is thus not at the endpoints. Hence, since $f^\prime(c)$ exists, by the \hyperref[sec:LET]{Local Extrema Theorem} we know that $f^\prime(c)=0$.
\subsection*{Case 2}
\tab $\exists x_0\in(a,b)$ with $f(x_0)<0$. The Extreme Value Theorem shows that $f(x)$ achieves a min value on $[a,b]$. We know that the minimum point $c\in(a,b)$ is thus not at the endpoints. Hence, since $f^\prime(c)$ exists, by the \hyperref[sec:LET]{Local Extrema Theorem} we know that $f^\prime(c)=0$.
\subsection*{Case 3}
\tab $f:[a,b]\rightarrow 0$, hence $f^\prime:(a,b)\rightarrow 0$ and thus there are lots of choices for $c$.
\thm{The Mean Value Theorem}{MVT}
\tab
Suppose $f$ is continuous on $[a,b]$ and differentiable on $(a,b)$. Then, $\exists c\in(a,b)$ such that $f^\prime(c)=\frac{f(b)-f(a)}{b-a}$. Rolle's Theorem is a special case of Mean Value Theorem.
\subsection{Proof}
\tab Let $h(x)=f(x)-f(a)-\left(\frac{f(b)-f(a)}{b-a}\right)(x-a)$. Notice that $h(a)=h(b)=0$. Since $h$ is continuous on $[a,b]$ and differentiable on $(a,b)$. Thus, since the conditions of Rolle's Theorem are met, we know that $\exists c\in(a,b)$ such that $h^\prime(c)=0$.\nextline
$$\ddx{h^\prime(x)}\lvert_{x=c}=f^\prime(c)-\frac{f(b)-f(a)}{b-a}=0$$
\tab
Therefore, we get that $f^\prime(c)=\frac{f(b)-f(a)}{b-a}$.
\subsection{Examples}
\tab\textit{Find all points $c$ that satisfy the mean value theorem for} $f(x)=x^3+2x^2-x$ on $[-1,2]$\nextline
By MVT we know that $f^\prime(c)=\frac{f(2)-f(-1)}{2-(-1)} = \frac{14-2}{3} = 4$. Therefore, there is a point $c$ where the derivative is equal to 4. $f^\prime(x)=3x^2+4x-1$
$$f^\prime(x)=3x^2+4x-1=c$$
$$x=\frac{-4\pm\sqrt{76}}{6}$$
\tab Since $\frac{-4-\sqrt{76}}{6}\not\in [-1,2]$, we know that it is not a proper value of $c$. Therefore, the only value of $c$ for this interval is $c=\frac{\sqrt{76}-4}{6}$
\newline
\nextline
\textit{Suppose that a function $f$ is continuous and differentiable everywhere. Furthermore, suppose $f$ has two roots. Then show $f^\prime$ has at least one root}
\nextline
Let $a,b$ be distinct roots of $f$, then $f(a)=f(b)=0$. Thus, by Rolle's Theorem, we know that $\exists c\in(a,b)$ such that $f^\prime(c)=\frac{f(b)-f(a)}{b-a}=0$ and thus there is at least one root of $f^\prime$.
\section{Applications of MVT}
\tab
$\text{Def}^{\text{n}}$: A function $F$ is called an antiderivative of $f$ is $F^\prime(x)=f(x) \forall x\in\mathbb{R}$
\nextline
$F(x)=\frac{x^2}{2}$ is an antiderivative of $f(x)$, since $F^\prime(x)=\frac{2x}{2}=x=f(x)$

\thm{The Constant Function Theorem}{CFT}
\tab
If $f^\prime(x)=0$ $\forall x\in\mathcal{I}$ then $f(x)=c$ $\forall x\in\mathcal{I}$.
\subsection{Proof}
\tab
Let $\mathcal{I}$ be some interval, then suppose $f^\prime(x)=0$ $\forall x\in\mathcal{I}$. Note that $f$ is continuous on $\mathcal{I}$. Let $x_1, x_2\in \mathcal{I}$ where $x_1\neq x_2$. Then, let $f(x_1)=k$. By the Mean Value Theorem, $\exists c\in(x_1,x_2)$ such that $f^\prime(c)=\frac{f(x_2)-f(x_1)}{x_2-x_1}$. Since $(x_1,x_2)\subseteq \mathcal{I}$, we know that $f^\prime(c)=0$ and thus $\frac{f(x_2)-f(x_1)}{x_2-x_1}=0\implies f(x_2)-f(x_1)=0\implies f(x_2)=f(x_1)=k$.
\nextline
Since both $x_1$ and $x_2$ were arbitrary, we conclude that $f(x)=k$ $\forall x\in\mathcal{I}$
\thm{Uniqueness of Antiderivatives}{UA}
\tab
Antiderivatives are not unique, since if we take $F(x)=h(x)+c$ and $f(x)=h^\prime(x)$ then $F^\prime(x)=h^\prime(x)=f(x) \forall c\in\mathbb{R}$. However, outside of adding constants, antiderivatives are unique (although it is not straightforward). This can be shown using the Mean Value Theorem.
\nextline
If $f^\prime(x)=g^\prime(x)$ $\forall x\in\mathcal{I}$, and thus $f(x)$ and $g(x)$ are antiderivatives of the same function, then $\exists k\in\mathbb{R}$ such that $f(x)=g(x)+k$ $\forall x\in\mathcal{I}$.
\subsection{Proof}
Let $h(x)=f(x)-g(x)$ and thus $h^\prime(x)=f^\prime(x)-g^\prime(x)=0$ $\forall x\in\mathcal{I}$. Hence, by \hyperref[sec:CFT]{The Constant Function Theorem}, $\exists k\in\mathbb{R}$ such that $h(x)=k$ $\forall x\in\mathcal{I}$. Therefore, $h(x)=f(x)-g(x)=k$ $\forall k\in\mathcal{I}\implies f(x)=g(x)+k$ $\forall x\in\mathcal{I}$.
\subsection{Notation}
The family of antiderivatives for a function $f(x)$ is denoted as follows, where $f(x)$ is referred to as the ``integrand'' and the dx is referred to as the ``variable of integration''.
$$F(x)=\int f(x)\text{ dx}$$
\tab As an example, $\int x^2\text{ dx} = \frac{x^2}{2}$
\thm{Increasing/Decreasing Function Theorem}{IncFT}
\tab
Let $\mathcal{I}$ be some interval with $x_1,x_2\in\mathcal{I}$ where $x_1< x_2$.
\begin{enumerate}
\item If $f^\prime(x)>0 \,\forall x\in\mathcal{I}$ then, $f(x_2)>f(x_1)$ and we say $f$ is \textit{increasing} on $\mathcal{I}$
\item If $f^\prime(x)\geq0 \,\forall x\in\mathcal{I}$ then, $f(x_2)\geq f(x_1)$ and we say $f$ is \textit{non-decreasing} on $\mathcal{I}$
\item If $f^\prime(x)<0 \,\forall x\in\mathcal{I}$ then, $f(x_2)<f(x_1)$ then we say $f$ is \textit{decreasing} on $\mathcal{I}$
\item If $f^\prime(x)\leq0 \,\forall x\in\mathcal{I}$ then, $f(x_2)\leq f(x_1)$ and we say $f$ is \textit{non-increasing} on $\mathcal{I}$
\end{enumerate}
\subsection{Proof of (1)}
\tab
Let $\mathcal{I}$ be an interval such that $x_1<x_2 \in\mathcal{I}$. Suppose that $f^\prime(x)>0\,\forall x\in\mathcal{I}$. Since $f^\prime$ exists, we know that $f$ is continuous $\forall x\in\mathcal{I}$. We can thus apply \hyperref[sec:MVT]{The Mean Value Theorem} to $[x_1, x_2]$.\nextline
$\exists c\in(x_1,x_2)$ such that $\frac{f(x_2)-f(x_1)}{x_2-x_1} = f^\prime(c)$. Since we know $f^\prime(c)>0$ and $x_2-x_1>0$, we know that $f(x_2)-f(x_1)>0$. Thus, $f$ is increasing over $\mathcal{I}$.
\subsection{Converses}
\tab
The converse of (2) and (4) are true (if $f(x)$ is non-increasing/non-decreasing on $\mathcal{I}$ then $f^\prime(x) >0 \,\forall x\in\mathcal{I}$).
\nextline
The converse of (1) and (3) are false. Consider $f(x)=x^3$. Where $f(x_2)>f(x_1) \forall x_2>x_1$ However, $f^\prime(0)=0$.
\section{Functions with Bounded Derivatives}
What information can we derive from a function $f$ if we know the bounds of $\dfdx$?
\nextline
Suppose $m\leq \dfdx \leq M$ $\forall x\in(a,b)$. If $f$ is continuous on $[a,b]$ then we can use \hyperref[sec:MVT]{Mean Value Theorem}.
\nextline
Let $x\in(a,b)$. Applying MVT we get $\exists c\in(a,x)$ with $f^\prime(c) = \frac{f(x)-f(a)}{x-a}$.
$$m \leq f^\prime(c) =\frac{f(x)-f(a)}{x-a} \leq M$$
$$m(x-a) \leq f(x)-f(a) \leq M(x-a)$$
$$f(a) + m(x-a) \leq f(x) \leq f(a) + M(x-a)$$
\tab
This implies that $f(x)$ is bounded between two lines.
\thm{Bounded Derivative Theorem}{BDT}
\tab
If a function $f$ is continuous on $\interval{o}$ and differentiable on $\interval{c}$ with $m\leq f^\prime(x)\leq M$ $\forall x\in\interval{o}$ then $f(a)+m(x-a)\leq f(x)\leq f(a)+M(x-a)$ $\forall x \in\interval{c}$.
\subsection{Example}
Show that $\ln(3)\in\left[\frac{7-e}{4}, \frac{3}{e}\right]$\nextline
Let $f(x)=\ln(x)$. Hence, $f^\prime(x)=\frac{1}{x}$. We need to bound $f^\prime(x)$ to use the theorem. Thus, we need some interval $\interval{c}$ with $a<3<b$. We also need $f(a)$ to be easily computable. If we take $a=e$ then $\ln(a)=1$. and $1<3$. Since we don't need $f(b)$ to be easily computable, we can take $b=4$.
\nextline
Note that $\ddx{\frac{1}{x}} = \frac{-1}{x^2}$. Thus, from the \hyperref[sec:IncFT]{Increasing Function Theorem} we know that $f^\prime(x)$ is decreasing. Thus, $f^\prime(4) \leq f^\prime(x) \leq f^\prime(e)$. Since the derivative can be bound between $\frac{1}{4}$ and $\frac{1}{e}$, the natural choice for a range would be $f^\prime(x)\in\left[\frac{1}{4}, \frac{1}{e}\right]$.
\nextline
$$f(a) + m(x-a) \leq f(x) \leq f(a)+M(x-a)$$
$$1 + \frac{1}{4}(x-e) \leq f(x) \leq f(a)+\frac{1}{e}(x-a)$$
$$1 + \frac{1}{4}(3-e) \leq f(x) \leq 1 + \frac{1}{e}(x-e)$$
$$\frac{7-e}{4} \leq f(x) \leq \frac{3}{e}$$
\newline
\null\hfill$\mathcal{QED}$
\nextline
Check out the example in the textbook that uses Bounded Derivative Theorem to show the following;
$$\lim_{n\rightarrow\infty} \left(1+\frac{1}{n}\right)^n = e$$
\section{Comparing Functions Using Derivatives}
Suppose $f$ and $g$ are continuous at $x=a$ and $f(a)=g(a)$
\begin{enumerate}
\item If $f^\prime(x) < g^\prime(x)$ $\forall x>a$ then $f(x)<g(x)$ $\forall x>a$
\item If $f^\prime(x) > g^\prime(x)$ $\forall x>a$ then $f(x)>g(x)$ $\forall x>a$
\item If $f^\prime(x) \leq g^\prime(x)$ $\forall x>a$ then $f(x)\leq g(x)$ $\forall x>a$
\item If $f^\prime(x) \geq g^\prime(x)$ $\forall x>a$ then $f(x)\geq g(x)$ $\forall x>a$
\end{enumerate}
\subsection{Proof of (3)}
\tab
Suppose $f$ and $g$ are continuous at $x=a$ with $f(a)=g(a)$ and $f^\prime(x) \leq g^\prime(x)$ $\forall x>a$.
\nextline
Let $h(x)=f(x)-g(x)$. Then $h(a)=f(a)-g(a)=0$. Let $x>a$, $h^\prime(x)=f^\prime(x)-g^\prime(x)$. By the hypothesis, we know that when $x>a$ that $f^\prime(x)\leq g^\prime(x)$, thus, by the \hyperref[sec:IncFT]{Decreasing Function Theorem}. Hence, $h(x)\leq 0\implies f(x)-g(x)\leq 0\implies f(x)\leq g(x)$ $\forall x>a$.
\end{document}