\documentclass[11pt,a4paper,twoside]{book}
\renewcommand\familydefault{iwona}\selectfont
\renewcommand\sldefault{it}
\usepackage[T1]{fontenc}
\usepackage{a4wide,theorem,amsmath,amssymb,tikz,multicol}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\exofont}{}%\fontfamily{cmbr}\selectfont}
\usepackage{fancyhdr}
\usepackage{ifthen}
\newboolean{proofs}
%\setboolean{proofs}{true}
\setboolean{proofs}{false}
\newcommand{\tproof}[1]%teacher proof
{\ifthenelse{\boolean{proofs}}{

\medskip
\hfill\fbox{\fbox{\begin{minipage}{0.9\linewidth}
{
\normalfont
#1
}\end{minipage}}}

\medskip
}{}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{quotchap}
\renewcommand\chapterheadstartvskip{\vspace{-2cm}}
\usepackage{hyperref} 
\hypersetup{colorlinks=true,linkcolor=black} 
\headheight=16pt
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\footskip}{60pt}
%---------------------------------------------------------
\theoremstyle{break}
\newtheorem{Theo}{Theorem}
\newtheorem{Def}{Definition}
\newtheorem{Rul}{Rule}
\newtheorem{Lemma}{Lemma}
%------------------------------------------------------------
\newcommand{\definition}[1]{%
   \par
    \bigskip    
\noindent\begin{minipage}{\textwidth}%
    \begin{Def}%
    #1%
    \end{Def}%
    \end{minipage}
    \par
    \bigskip
}
%------------------------------------------------------------
\newcommand{\Definition}[2]{%
   \par
    \bigskip
    \noindent\begin{minipage}{\textwidth}%
    \begin{Def}[#1]%
    #2%
    \end{Def}
    \end{minipage}
    \par
    \bigskip
}
%-------------------------------------------
\newcommand{\theorem}[1]{%
    \par
    \bigskip	
   \noindent\begin{minipage}{\textwidth}%
   \par
    \begin{Theo}%
    #1%
    \end{Theo}
    \end{minipage}
    \par
    \bigskip
}
%------------------------------------------------------------
\newcommand{\Theorem}[2]{%
    \par
    \bigskip
    \noindent\begin{minipage}{\textwidth}%
    \par
    \begin{Theo}[#1]%
    #2%
    \end{Theo}
    \end{minipage}
    \par
    \bigskip
}

%-------------------------------------------------------
\newcommand{\example}[1]{%
    
   \bigskip
   \noindent\textbf{Example:} #1%
   \par
}
%------------------------------------------------------------
\newcommand{\qed}{%
   ~\hfill\fbox{\null}%\ensuremath{\square}
   \par
   \bigskip
}
%------------------------------------------------------------
\newcommand\bonnecoupe{\addpenalty{-500}}%
\newcommand\pasdecesure{\addpenalty{10000}}
\newcounter{exxo}
\setcounter{exxo}{0}
\newcommand{\exo}[1]{%
   \refstepcounter{exxo}
   \par\medskip{\exofont
   \bonnecoupe
   \noindent
   \textbf{Exercise \theexxo} 
    \par
    \pasdecesure
   #1%
   \par
   \hfill\hrulefill\hfill\null}%\deffont
   \medskip
}

\newcounter{pract}
\setcounter{pract}{0}
\newcommand{\Pract}[2]{%
   \refstepcounter{pract}%\label{#1}
   \par\bigskip
   \bonnecoupe
   \noindent
   \textbf{Practice exercise \thepract\label{#1}} \quad Answer page \pageref{{sol#1}}
    \par
    \pasdecesure
   #2%
   \par
   \medskip
}
\newcommand{\sol}[2]{%
     \par
    \bonnecoupe
    \bigskip\noindent{\textbf{Answers to practice exercice \ref{#1}}, page \pageref{#1}} \label{{sol#1}}
    \par
    \pasdecesure
    #2%
    \par
%     \vspace{1\baselineskip}
}
%------------------------------------------------------------
%------------------------------------------------------------
\renewcommand\labelenumi{(\theenumi)}
\renewcommand\labelenumii{(\theenumii)}
\newcommand{\ds}{\displaystyle}
\newcommand{\sgn}{\text{sgn}}
\newcommand{\simep}{\overset{\scriptscriptstyle{+}}{~\simeq}}
\newcommand{\caution}{{\Huge \ensuremath{\bigtriangleup}}\hspace{-13pt}\begin{minipage}{4pt}\vspace{-7pt}\textbf{!}\end{minipage}\qquad } 
%============================================================
%
\usepackage{ifthen}
\newcommand{\mypage}
{\null
\textbf{}

\ifthenelse{\isodd{\thepage}}{\newpage

\null
\newpage

}{\newpage}}
%
%

%============================================================


\begin{document}

\pagestyle{fancy}\thispagestyle{empty}
\null

\vfill
\begin{center}
\begin{Huge}\textbf{Analysis} \end{Huge}

with ultrasmall numbers

\vfill

Higher Level
%Student Handout
\end{center}
\vfill
\tproof{{\Huge This version has proofs and comments for the teacher}

These come in frames like this one, and for this reason, the page numbers are not the same as on the student handout version.

\textit{The proofs given must not be understood as ``the'' proofs, but as the ones which over the years, I feel most comfortable with. When a theorem does not need anything specific to ultracalculus, the proof is omitted.}
}

\hfill Coll\`ege Andr\'e-Chavanne

\hfill Gen\`eve


\vfill
\begin{minipage}{.5\textwidth}
\fontfamily{pzc}\selectfont
Infinity itself looks flat and uninteresting. [...] The chamber [...] was anything but infinite, it was just very very very big, so big that it gave the impression of infinity far better than infinity itself.

(Douglas Adams: The Hitchhiker's Guide to the Galaxy)
\end{minipage}

\newpage
This work is open content. It may be reproduced and adapted by others, in whole or in part, provided it remains open content under the same conditions, non commercial,  that the  name of the author is also included, and that it is made clear that it has been adapted and by whom. This is a creative commons copyleft license.


\tableofcontents

\chapter{Velocity and Position}
\exo{
Suppose the velocity 
\footnote{The velocity is speed with a direction. Speed is always
  positive (or zero); velocity can be negative.}
of a car is constant and equal to
  $60km/h$. 
\begin{enumerate}
\item 
Let $f$ be the function which describes the position of the car with respect to time.


Draw the graph $f$ for $t$ ranging from 0 to 3 hours.
\item Let $v$ be the function which describes the velocity of the car  with respect to time.

Draw the graph of $v$ for
$t$ ranging from 0 to 3 hours.

\item Given the position graph, how can one find the velocity of the
  car at any given time?
\item Given the velocity graph, how can one find the position of the
  car after any given time?
\end{enumerate}
}\index{velocity}\index{position}

\caution Note the difference: velocity (deduced from position) is \emph{local}. It is possible to give the velocity \emph{at} a given time. Position (deduced from velocity) is \emph{global}. It is only possible to find the \emph{variation} of the position over an \emph{interval} of time.

\exo{
The velocity of a car (in km/h) is given by the following
  function with respect to time (in~h):

(decimal division of hours for simplicity)

$$
v:t\mapsto
\begin{cases}
60  & \text{ if } 0\leq t\leq 0.5\\
120 & \text{ if } 0.5< t\leq 2\\
80 & \text{ if } 2< t\leq 2.5\\
60 & \text{ if } 2.5<t\leq 3
  \end{cases}
$$

 Calculate the positions at $t=1, \quad t=2$ and $t=3$.

Draw the velocity graph and indicate \emph{on the velocity graph}
where the position at $t=2$ can be drawn.
}

\newpage
The following curve can be approximated by a piecewise linear function whose slope is easily calculated by pieces. If this curve represents the position function of a moving body, the linear pieces may given approximate representation of the velocity function.


\begin{center}
\begin{tikzpicture}[scale = 1.5]
\draw[color=gray,dashed, step=0.5](0,0) grid (3,3);
\draw (0,1) -- (1,1.35)--(2,2.5)--(3,3.2) ;
 \draw (1,0) node[below]{1};
 \draw (2,0) node[below]{2};
 \draw (3,0) node[below]{3};
\draw (4,0) node[below]{t};
\draw (0,1) node[left]{10};
\draw (0,2) node[left]{20};
\draw (0,3) node[left]{30};
\draw (0,3.2) node[right]{km};
\draw[thick] (0,1) .. controls (0.75,1.2) and (1.25,1.3)..(1.75,2.1)..controls (1.8,2.2) and (2.2,3)..(3,3.2) ;
\draw[->](0,0)--(3.5,0);
\draw[->](0,0)--(0,3.2);
\end{tikzpicture}
\end{center}


The following area under a curve can be approximated by a ``staircase'' function whose area is calculated by adding the areas of the rectangles. If this curve represents the velocity function of a moving body,  the rectangles may give an approximate representation of the position function. 

\begin{center}
\begin{tikzpicture}[scale = 1.5]
\draw[color=gray, dashed, step=0.5](0,0) grid (3,3);
\draw (0,0)  rectangle (0.5,1.1);
\draw (0.5,0) rectangle (1,1.25);
\draw (1,0) rectangle (1.5,1.6);
\draw (1.5,0) rectangle (2,2.2);
\draw (2,0) rectangle (2.5,2.8);
\draw (2.5,0)  rectangle (3,3.1) ;
\draw (1,0) node[below]{1};
\draw (2,0) node[below]{2};
\draw (3,0) node[below]{3};
\draw (4,0) node[below]{t};
\draw (0,1) node[left]{10};
\draw (0,2) node[left]{20};
\draw (0,3) node[left]{30};
\draw (0,3.2) node[right]{km/h};
\draw[thick] (0,1) .. controls (0.75,1.2) and (1.25,1.3)..(1.75,2.1)..controls (1.8,2.2) and (2.2,3)..(3,3.2) ;
\draw[->](0,0)--(3.5,0);
\draw[->](0,0)--(0,3.2);
\end{tikzpicture}
\end{center}


\vfill
The main goal of the subject called \begin{large}\textbf{mathematical analysis} \end{large} will be to check when and how to approximate a curve by pieces of straight lines and when and how to approximate areas by rectangles and to understand what these can be used to calculate. Intuitively, it should seem clear that in order for the approximation to be good, the pieces of straight lines or the rectangles must be small -- or that the number of pieces is large. The crucial questions are: How small? and How large?


%========================================================
\chapter{Basic Principles}

\exo{Hold a pencil in your hand. Do not move. 

Now drop the pencil.

\bigskip
First the pencil was motionless. Then it was in motion.

How did the motion start? How is the transition from "not moving" to "moving"?
}



\exo{
If $\delta$ is a positive value which is extremely small (even smaller than that!),
\begin{enumerate}
\item  what can you say about the size of $\delta^2$, $2\cdot\delta$ and $-\delta$?
\item what can you say about $2+\delta$ and $2-\delta$?
\item what can you say about $\frac{1}{\delta}$?
\end{enumerate}
}

\tproof{Note for the teacher: there is no ``tending to''. $\delta$ \emph{is} tiny;  just as its reciprocal is huge. Note that ``tiny'' must be defined to be small in absolute value, since $-10^{10}$ is smaller that $5$...

\textit{``tending to'' yields an informal metaphor of $x$ moving towards $a$: recall that numbers do not move...}
}


\begin{center}
\begin{tikzpicture}[scale=2]
\draw(0,2)--(5,2);
\foreach \n in {0,1,...,5}
\draw(\n,2.2)node[above]{$\n$}--(\n,1.8);
\draw[-latex](2.4,3)node[above]{$2+\delta$}--(2.1,2.1);
\draw[out= 270, in=10, -latex](1.9,1.9) to (0.5,1) ;
\draw[out= 270, in=170, -latex](2.1,1.9) to (3.5,1); 
\draw(0,0)--(5,0);
\foreach \n in {0,1,...,5}
\draw(\n,0.2)--(\n,-0.2);
\draw(2,-0.2)node[below]{2};
\draw(3,-0.2)node[below]{$2+\delta$};
\draw(4,-0.2)node[below]{$2+2\delta$};
\draw(1,-0.2)node[below]{$2-\delta$};
\draw[-latex](4,0.5)--(6,0.5)node[right]{3};
\draw[-latex](1,0.5)--(-1,0.5)node[left]{1};
\end{tikzpicture}

Zooming in
\end{center}


\exo{
If $N$ is a positive huge number (really very huge!),
\begin{enumerate}
 \item what can you say about $N^2$, $2N$ and $-N$?
\item what can you say about $N+2$ and $N-2$?
\item what can you say about $\frac{1}{N}$?
\item what can you say about $\frac{N}{2}$?
\end{enumerate}
}





\exo{
Let $f:x\mapsto x^2$,  and let $\delta$ be "vanishingly small" and positive.

\begin{enumerate}
\item Draw  the result of a zoom on
$f$ centred on $\langle 2;4\rangle $  so that $\delta$ becomes visible.

Show, on the drawing, the values $2$ and $f(2)$,  $2+\delta$ and $f(2+\delta)$,  $2-\delta$ and
$f(2-\delta)$.

What does the curve look like?
\item For the same function, draw the result of a zoom centred on $\langle 1;1\rangle $ 

Show, on the drawing, the values $1$ and $f(1)$,  $1+\delta$ and $f(1+\delta)$,  $1-\delta$ and
$f(1-\delta)$.

\item Similar question for a zoom centred on $\langle 0;0\rangle $.
\end{enumerate}
}

\exo{
Draw  the result of zooms so that $\delta$ becomes visible for
 
$g:x\mapsto x^3$, and $h:x\mapsto |x|$ 

For $g$: centres are $\langle 1;1\rangle $, $\langle 2;8\rangle $ and $\langle 0;0\rangle $

For $h$: centres are $\langle 1;1\rangle $, $\langle 2;2\rangle $ and $\langle 0;0\rangle $
}

\exo{Draw a zoom centred on $\langle 0;0\rangle $  and
another zoom centred on $\langle 0;-1\rangle $
for $$k:x\mapsto 
  \begin{cases}
  -1 &\text{if $x< 0$}\\
  0 &\text{if $x= 0$}\\
  1 & \text{if $x>0$}
  \end{cases}$$
}

\clearpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

When we say that $\delta$ is ``tiny'', we want it to be tiny compared to all the parameters involved; this leads to the following definition:


\definition{The \textbf{context} of a property, function or set is the list of parameters used in  its definition. The context can be a single number.
}

\bigskip
A context is \textit{extended} if parameters are added to the list.

Before defining more precisely what it means to be ``tiny'' we must first clarify what it means to be observable:

\bigskip
\begin{center}
\fbox{\begin{minipage}{.97\textwidth}

{\large\textbf{Observability}}
\begin{enumerate}
\item Numbers defined without reference to observability are always observable -- or standard.
\item\label{observability} If $a$ is not observable in the context of $b$, then $b$ is be observable in the context of $a$. (the context from which both are observable is the common context).
\item\label{closure} \textbf{Closure:} If a number satisfies a given property, then there is an observable number satisfying that property.
\item\label{transfer} A property referring to observability is true if and only if it is true when its context is extended.
\end{enumerate}
\end{minipage}}
\end{center}


A consequence of (\ref{closure}) is that the results of operations between two numbers are in their common context.

The word "observable" , by convention,  refers to a context.  Informally: the context is the parameters, sets and functions the statement is about. Therefore to determine the context of a statement, one must be able to understand it and describe what it says and about what it says something.

But: a consequence of (\ref{transfer}) is that it does not matter what the context is precisely provided it contains at least all parameters involved.

\bigskip
All "familiar" numbers such as $1;\ 3;\ 10^{10};\ \sqrt{2}$ or $\pi$ are always observable, or standard, but also -- in general --

\theorem{
$f(a)$ is observable.
}

This refers to the context, by the word "observable".  The only parameters of this property are $f$ and $a$. This is the context.

\tproof{This is a consequence of closure: If there is a value $b$ such that $f(a)=b$ then there is an observable such value. Since the output of a function is unique, $f(a)$ is observable.}

Non observable values do not show up unless explicitly summoned.
\bigskip


\definition{
A real number is \textbf{ultrasmall} if it is nonzero and smaller in absolute value than any strictly positive observable number}

This definition makes an implicit reference to a context.

\caution Note that $0$ is not ultrasmall. 


\begin{center}
\fbox{\begin{minipage}{.97\textwidth}
{\large\textbf{Principle of ultrasmallness}}

\begin{itshape}
Relative to any context, there exist ultrasmall real numbers. 
\end{itshape}
\end{minipage}
}
\end{center}

Such an ultrasmall number is then part of an \textbf{extended context}.

Given a context, if $\varepsilon$ is ultrasmall then $\varepsilon$ is not observable.


\definition{
A real number is \textbf{ultralarge} if it is larger in absolute value than any strictly positive observable number}


\caution Note the asymmetry: if $h$ is ultrasmall relative to $x$, then it is not observable. But  $x$ is observable relative to $h$ (see the third item of the observability pricniple), hence $x$ \textbf{is not} ultralarge relative to $h$. 

\begin{center}
\begin{tikzpicture}%[scale=2]
\draw (-5.5,0) -- (3.5,0);
\draw  [->](-3,2)  .. controls(-2,0.5) and (-1.5,0.2) .. (-1.1,0.05);
\draw(-1,2.7) node{With respect to a given number};
\draw (-1,2) node[above]{ultrasmall numbers are somewhere here};
\draw [<-] (-0.9,0.05) .. controls(-0.5,0.2) and (0,0.5).. (1,2);
\draw (-1,0.2)--(-1,-0.2)node[below]{0};
% \draw (0,0.2)--(0,-0.2)node[below]{1};
\end{tikzpicture}
\end{center}


\begin{center}
\begin{tikzpicture}%[scale=2]
\draw (-6,0) -- (-4,0);
\draw [dotted] (-4,0)node{/}--(-3,0)node{/};
\draw (-3,0)--(1,0);
\draw [dotted](1,0)node{/}--(2,0)node{/};
\draw (2,0)--(4,0);
\draw(-1,2.7) node{With respect to a given number};
\draw (-1,2) node[above]{ultralarge numbers are somewhere over there};
\draw  (-0.5,2) .. controls(-0.4,1.5) and (0,1).. (1,1);
\draw [dotted] (1,1)node{/}--(2,1)node{/};
\draw [->] (2,1) .. controls (3,1) and (3.5,0.8)..(3.5,0.1);
\draw (-1.5,2) ..controls (-1.6,1.5) and (-2,1) ..(-3,1);
\draw [dotted] (-3,1) node{/} -- (-4,1) node{/};
\draw [->] (-4,1) .. controls (-5,1) and (-5.5,0.8) .. (-5.5,0.1);
\draw (-1,0.2)--(-1,-0.2)node[below]{0};
\end{tikzpicture}
\end{center}


\definition{Let $a,b$ be real numbers.  We say that $a$ is  
\textbf{ultraclose} to $b$, written
\[
a \simeq b,
\]
if $b-a$ is ultrasmall or if $a = b$.}

This definition makes an implicit reference to a context.

In particular, $x\simeq 0$ if $x$ is ultrasmall or zero.

\bigskip
If $a\simeq b$ then $a$ and $b$ are said to be neighbours. If $a$ is a neighbour of $b$ and is observable (relative to some context) then $a$ is the observable neighbour of $b$.

\theorem{\label{ab}Relative to a context:
If $a$ and $b$ are observable and $a\simeq b$, the $a=b$.
}

\exo{Prove the previous theorem. (you will need to refer to closure)}

\tproof{If $a\simeq b$ then $a-b\simeq 0$; which means that $a-b$ is ultrasmall or zero. By closure, it is observable, hence cannot be ultrasmall.}

A rational number may have an observable neighbour which is not rational.
The number $\sqrt{2}$ is always observable  because it is completely and uniquely defined by the parameter $2$. Relative to this context consider an ultralarge $N$ and take the first $N$ digits of $\sqrt{2}$. This is a rational number which is not observable. Yet it is ultraclose  to an observable number which is $\sqrt{2}$. 

The existence of an observable neighbour is given by the following

\begin{center}
\fbox{\begin{minipage}{.97\textwidth}
{\large\textbf{Principle of the observable neighbour}}

\begin{itshape}
Relative to a context, any real number $x$ which is not ultralarge can be written in the form $a+h$ \quad where $a$ is observable and $h\simeq 0$.
\end{itshape}\label{standardisation}

\end{minipage}
}
\end{center}


\exo{
Show that if $x$ has an observable part, then it is unique. 
}

\tproof{Assume $a$ and $b$ are observable neighbours, then $a\simeq x\simeq b\Rightarrow a\simeq b$ and by theorem \ref{ab}, $a=b$.}

\begin{center}
\fbox{This unique number is \textbf{the observable neighbour} of $x$.}
\end{center}




\exo{
Prove the following:

\theorem{\label{inside}
Let $[a;b]$ be an interval. 
Show that if $x$ is in $[a;b]$, then  the observable part of $x$ is not outside $[a;b]$.}

}

\tproof{Assume by contradiction that $x\in[a,b]$ and that $c\simeq x$ is outside, and larger than $b$. We then have $x\leq b\leq c$ with $x\simeq c$. But this implies $b\simeq c$ so $b=c$. (Same for $c\leq a$.)

\emph{The observability is given by $a$ and $b$.}
} 


\exo{
Prove the following:
\begin{enumerate}
\item
If $\varepsilon$ is ultrasmall relative to  $x$ then $\frac{1}{\varepsilon}$ is ultralarge relative to  $x$.
\item
If $M$ is ultralarge relative to $x$ then $\frac{1}{M}$ is ultrasmall relative to  $x$.
\end{enumerate}

}



\exo{
Prove the following theorems (together they give all the rules needed for analysis and will be referred to by "ultracomputation" or "ultracalculus"):

\theorem{\label{basics}
Let $\varepsilon$ and $\delta$ be ultrasmall relative to a context  and let $a$ be observable and not zero.

\begin{enumerate}
  \item Then: $a\cdot \varepsilon$ is ultrasmall.
  
  \tproof{By contradiction. Assume $a\cdot \varepsilon\not\simeq 0$. Then by definition, there is an observable strictly positive $b$ such that $|a\cdot\varepsilon|=|a|\cdot|\varepsilon|\geq b>0$. But then $|\varepsilon|\geq \frac{b}{|a|}>0$. By closure $\frac{b}{|a|}$ is observable. This contradicts that $\varepsilon$ is ultrasmall.
  
  \emph{The proof by contradiction assumes the existence of (one) counterexample. A direct proof requires to show something about all observable positive numbers.}}
  \item Then: $\varepsilon+\delta \simeq 0$
  
  \tproof{$0\leq |\varepsilon+\delta|\leq 2\cdot \max\{|\varepsilon| , |\delta|\}$ which is two times an ultrasmall, whic is ultrasmall by the previous point. }
  \item Then: $\varepsilon\cdot\delta$ is ultrasmall
  
  \tproof{Obvious, but if necessary: $0<|\delta|<1$ so $0<|\varepsilon\cdot\delta|<|\varepsilon|$}
  \item If $a\neq 0$ Then: $\dfrac{a}{\varepsilon}$ is ultralarge
  
  \tproof{Again by contradiction: assume it is not ultralarge, then there is an observable $b>0$ such that 
  $|\frac{a}{\varepsilon}|=\frac{|a|}{|\varepsilon|}<b\Rightarrow |a|<|b|\cdot|\varepsilon|\simeq 0$, which contradicts that $a$ is observable.}
\end{enumerate}
}


\tproof{\textit{The following properties can be proven later, when after some specific exercises, a general formula is need. Could be postponed to beginning of chapter \ref{diffrul}.} }

\Theorem{Ultracomputation}{\label{ultracalc}
Relative to a context: If $a$ and $b$ are observable and not zero
and if $a\simeq x$ and $b\simeq y$,

\begin{multicols}{2}
\begin{enumerate}
 \item $a+b\simeq x+y$
 \item $a-b\simeq x-y$
 
 \tproof{Write $x=a+\varepsilon, y=b+\delta$. Then $x+y=a+\varepsilon+b+\delta$ and since $\varepsilon+\delta\simeq 0$ by theorem \ref{basics} we have the conclusion.}
 \item $a\cdot b\simeq x\cdot y $
 
  
 \tproof{as before, then $x\cdot y=(a+\varepsilon)\cdot (b+\delta)=a\cdot b+a\cdot \delta+b\cdot\varepsilon+\varepsilon\cdot\delta\simeq a\cdot b$ by theorem \ref{basics} }
 
 \item If also  $b\neq 0$, $\dfrac{a}{b}\simeq\dfrac{x}{y}$.
\end{enumerate}
\end{multicols}
}
}\index{ultracomputation}


For the last item of theorem \ref{ultracalc}, it is enough to show:

\bigskip
Relative to a context. If $b$ is observable and $b\neq 0$
and if $b\simeq y$ then $\dfrac{1}{b}\simeq\dfrac{1}{y}$

\bigskip
 and use item 3 to conclude.

\tproof{Writing $y=b+\delta$ and $\frac{1}{y}=\frac{1}{b+\delta}=\frac{1}{b}+h$ leads to
$b=(1+bh)(\underbrace{b+\delta}_{\simeq b})\simeq (1+bh)\cdot b$, hence $1+bh$ must be ultraclose to 1, so $bh\simeq 0$ and $h\simeq 0$.}

\tproof{More tricky but more powerful: good for maths 2:

$b$ is observable and not zero, hence for $y\simeq b$, $y$ is not ultrasmall nor ultralarge. Therefore $\frac{1}{y}$ is not ultralarge nor ultrasmall, hence it has an observable neighbour $c\simeq \frac{1}{y}$. We have $cy\simeq 1$ and then $\frac{1}{c}\simeq y\simeq b$. But by closure, $\frac{1}{c}$ is observable, so $\frac{1}{c}=b$. So $\frac{1}{y}\simeq\frac{1}{b}$.
}

\Pract{begin2}{
Consider a context.
\begin{enumerate}
\item Give an example of $x$ and $y$ such that $x\simeq y$ but $x^2\not\simeq y^2$.
\item Give an example of $x$ and $y$ such that $x\simeq y$ but $\frac{1}{x}\not\simeq\frac{1}{y}$.
\end{enumerate}
}


\Pract{begin3}{
Relative to a context.

In the following, assume that $\varepsilon, \delta$ are
positive ultrasmall and $H,K$ positive ultralarge numbers.
Determine whether the given expression yields an ultrasmall number, an
ultralarge number or a number in between.

\begin{multicols}{2}
\begin{enumerate}
\item $\ds 1+\frac{1}{\varepsilon}$
\item $\ds \frac{\sqrt{\delta}}{\delta}$
\item $\ds \sqrt{H+1}-\sqrt{H-1}$
\item $\ds \frac{H+K}{H\cdot K}$
\item $\ds \frac{5+\varepsilon}{7+\delta}-\frac{5}{7}$
\item $\ds \frac{\sqrt{1+\varepsilon}-2}{\sqrt{1+\delta}}$
\end{enumerate}
\end{multicols}
}

\Pract{begin}{
Relative to a context find ultrasmall $\varepsilon$ and $\delta$ (or the relation between them) such that $\dfrac{\varepsilon}{\delta}$ is:
\begin{multicols}{2}
\begin{enumerate}
\item not ultralarge and not ultrasmall,
\item ultralarge,
\item ultrasmall.
\end{enumerate}
\end{multicols}
}


\caution The previous exercise show that if no relation is known between ultrasmall numbers $\varepsilon$ and $\delta$, their quotient can be of any possible magnitude.




\bigskip
\noindent\fbox{\begin{minipage}{.97\textwidth}
{\large\noindent\textbf{Contextual Notation}}

The only acceptable properties are those that do not refer to observability  or those that use the symbol ``$\simeq$''.
\end{minipage}
}

\tproof{This is an extremely important restriction, even though it is probably not necessary to mention it otherwise than saying it is a rule which must be followed. The thing is that with ultrasmall numbers not any property can be used to determine a set.  As a direct example: relative to the standard context, it is not possible to collect all ultrasmall numbers inot a set. If we could, we would have a set which is bounded above (by $1$) but which has no least upper bound, which would contradict that all sets of real numbers bounded above have a least upper bound.

Recall that the context is the parameters that the statement is about. When we define a set by a property, this must state a property for the element to belong to the set, hence if ultrasmall values are invoqued they must be relative to the context containing the element, and it cannot be ultrasmall relative to itself.

In fact, ultrasmall values can nonly be used to determine a property such as in the derivative: they appear as ``dummy variables''.

Here is another example of what would go wrong:

Let $\textbf{obs}_1(x)$ stand for the observable neighbour of $x$ relative to the standard context.
Consider the rule $x\mapsto\textbf{obs}_1(x)$. If this defined a function, then zooming on the graph we would see a horizontal line on any ultrasmall neighbourhood (all points on an ultrasmall interval have the same observable neighbour.) There is no value where we could point to a discontinuity yet this everywhere horizontal ``continuous'' graph (if it exists) is increasing!

The problem here is  not referring to the context containing $x$.  
 \section*{The Problem of Induction}

For students, induction is not the natural way to think about mathematical objects (not yet).
Some mathematicians are troubled by some nonstandard statements which seem to contradict induction. The question is addressed here.

\bigskip
Statements about observability are always relative to the context of the statement. (Contextual statements)

\begin{itemize}
\item Statements that do not refer to observability can be used in induction proofs (these are the classical induction proofs). 
\item Statements that use ``$\simeq$''  can also be used in induction proofs.
\item Statements that use ``standard'' cannot be used in induction proofs since there is an absolute reference to a context.
\end{itemize}

Thus even though it is true that if $n$ is observable then $n+1$ is observable, one cannot deduce that all numbers are observable. This statement is about $n$, hence the context contains $n$. By the convention that observable always refers to the context, $n$ is observable can be rewritten as $n$ is as observable as itself -- which is true! So by induction, we would get, at best, that every number is as observable as itself.

}

\newpage
\null

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mypage
\section*{Answers to practice exercises}


\sol{begin2}{
\begin{enumerate}
\item
Let $x=N$ be ultralarge, and $y=N+\frac{1}{N}$ so $x\simeq y$ but $x^2=N^2\not\simeq N^2+2+\frac{1}{N^2}=y^2$.
\item  Let $h$ be ultrasmall, then let $x=h$ and $y=h^2$. Then $x\simeq 0$ and $y\simeq 0$ hence $x\simeq y$. Then $\frac{1}{h}$ and $\frac{1}{h^2}$ are both ultralarge and $\frac{1}{h^2}-\frac{1}{h}=\frac{1}{h}(\frac{1}{h}-1)$. By ultracomputation, this is ultralarge, hence $\frac{1}{x}\not\simeq\frac{1}{y}$.
\end{enumerate}
}

\sol{begin3}{

The terms ultrasmall or ultralarge all refer to a given context.

\begin{enumerate}
\item As $\frac{1}{\varepsilon}$ is ultralarge  $1+\frac{1}{\varepsilon}$ is ultralarge.
\item We have $\frac{\sqrt{\delta}}{\delta}=\frac{1}{\sqrt{\delta}}$ which is ultralarge.

(If $\delta<c$ for any observable $c$, then $\sqrt{\delta}<\sqrt{c}$ and $\sqrt{\delta}\simeq 0$ hence $\frac{1}{\sqrt{\delta}}$ is ultralarge.)
\item Maybe surprisingly, this is ultrasmall. To see this we multiply and divide by the conjugate:
\begin{eqnarray*}
\sqrt{H+1}-\sqrt{H-1}&=&\frac{(\sqrt{H+1}-\sqrt{H-1})(\sqrt{H+1}+\sqrt{H-1})}{\sqrt{H+1}+\sqrt{H-1}}
\\&=&\frac{(H+1)-(H-1)}{\sqrt{H+1}+\sqrt{H-1}}
\\&=&\frac{2}{\sqrt{H+1}+\sqrt{H-1}}.
\end{eqnarray*}
$H$ is assumed positive, its square root (plus or minus 1) is also a positive ultralarge. The sum of 2 positive ultralarge numbers is ultralarge hence the quotient is ultrasmall.

\item $\ds \frac{H+K}{HK}=\frac{1}{K}+\frac{1}{H}\ $ is ultrasmall.
\item $\ds \frac{5+\varepsilon}{7+\delta}-\frac{5}{7}= \frac{35+7\varepsilon-35-5\delta}{49+7\delta}=\frac{\overbrace{7\varepsilon-5\delta}^{\simeq 0}}{\underbrace{49+7\delta}_{\simeq 49}}\ $ is ultrasmall or zero.
\item $\ds \frac{\overbrace{\sqrt{1+\varepsilon}-2}^{\simeq -1}}{\underbrace{\sqrt{1+\delta}}_{\simeq 1}}\simeq -1$, hence not ultralarge and not ultrasmall.
\end{enumerate}
}


\sol{begin}{
\begin{enumerate}
\item Take $\varepsilon=\delta$   then $\dfrac{\varepsilon}{\delta}=1$.
\item Take $\delta=\varepsilon^2$, then $\dfrac{\varepsilon}{\delta}=\dfrac{1}{\varepsilon}$ is ultralarge.
\item Take $\varepsilon=\delta^2$, then  $\dfrac{\varepsilon}{\delta}=\delta$ is ultrasmall.
\end{enumerate}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\chapter{Derivatives}

\exo{
Let \[f:x\mapsto x^2\]
The graph of this function is a curve (a parabola). Zoom in on the point $\langle 2, 4\rangle$. 2 and 4 are always observable. Consider the value of the function at $2+\Delta x$, and draw a straight line passing through $\langle 2, 4\rangle$ and $\langle 2+\Delta x, f(2+\Delta x)\rangle$.

\begin{itemize}
\item What is the slope of this straight line?
\item What is the observable neighbour of  this slope?
\end{itemize}


}


\definition{\label{derivative}
A real function $f$ defined on an interval containing $a$ is \textbf{differentiable at} $a$ if there is an observable value $D$   such that, for any $\Delta x$ 
\[\frac{f(a+\Delta x)-f(a)}{\Delta x}\simeq D\]

Then $D=f'(a)$ is the \textbf{derivative} of $f$ at $a$.
}\index{derivative}\index{differentiable}

The "for any $\Delta x$" means that the value of $D$ must not depend on the choice of the ultrasmall $\Delta x$, in particular, whether it is positive or negative.

When the derivative exists, it is the observable neighbour of $\ \dfrac{f(a+\Delta x)-f(a)}{\Delta x}$.

\caution This is a statement about $f$ at $a$, hence the context is the list of parameters of $f$ and~$a$.
 

\bigskip
Metaphorically, finding the derivative can be described by: Zoom in. If what you see is indiscernible from a straight line, then measure the slope of that line. Zoom out. Drop what you cannot see anymore.




\exo{
Using definition \ref{derivative} calculate the derivatives (if they exist) of the following:
\begin{enumerate}
\item $f:x\mapsto 3x^2+x-5$ \qquad at $x=-2$ and $x=2$.
\item $g:x\mapsto 2x^3-2$ \qquad at $x=1$ and $x=0$.
\item $h:x\mapsto |x|$\qquad at $x=2$, $x=-2$ and at $x=0$.
\end{enumerate}}


\exo{Let $f:x\mapsto x^3-x-6$. Check that $2$ is a root of $f$. Are there other roots?

At what values of $x$ is the derivative equal to zero? What is the
value of the function at these points? At what values of $x$ de we have $f'(x)>0$ and at what values do we have $f'(x)<0$? 

Use all this information to make a rough sketch of the function.}

\exo{
Let $f:x\mapsto 2x^3-4x^2+2x$. At what values of $x$ is the function equal to zero? At what values of $x$ is the derivative equal to zero? What is the
value of the function at these points? At what values of $x$ de we have $f'(x)>0$ and at what values do we have $f'(x)<0$? 

Use all this information to make a rough sketch of the function.
}




\exo{Consider the derivative at $x$ (general case) of the function
\[
f: x \mapsto x^2 + 3x.
\]
Show that it is differentiable for all $x$ and that  $f'(x)=2x+3$.
}

Notice that in a derivative, the division is \textbf{always} between two ultrasmall numbers. They \underline{cannot} be replaced by 0 since $\frac{0}{0}$ is not defined.

If a function is differentiable for all $x$ in an interval, then $f$ is said to be differentiable on the interval.

\definition{If $f'(x)$ exists for all $x$ in $I$ 
 \textbf{the derivative function} is 

\begin{eqnarray*}
f': I&\to \mathbb{R}
\\
x&\mapsto f'(x)
\end{eqnarray*}


}\index{differentiable! on an interval}


If $f'(a)=0$, then in an ultrasmall neighbourhood of
$a$ the function is \textbf{stationary} -- on an ultrasmall neighbourhood $[a-\Delta x;a+\Delta x]$ its variation is of the form $\varepsilon\cdot \Delta x$ for ultrasmall $\varepsilon$ -- its graph is indistinguishable from a horizontal line. \index{stationary point}

\exo{Differentiate $f:x\mapsto x^2$ and $g:x\mapsto x^3$ at general $x$.}



\bigskip
\textbf{Notation:}  Let $\Delta x$ be ultrasmall relative to $f$ and $x$. We write

\[\Delta f(a) = f(a+\Delta x) - f(a) \text{ or } f(a+\Delta x) = f(a) + \Delta f(a).\]

Hence, we have:

\[\frac{\Delta f(a)}{\Delta x}\simeq f'(a).\]

\bigskip
\textbf{Notation:} A "$\simeq$" symbol may be replaced by a "$=$" symbol by adding a value ultraclose to zero on one of the sides i.e., $A\simeq B\Rightarrow A=B+\varepsilon$ where $\varepsilon\simeq 0$. Sometimes working with equality is safer.

Hence
\[\frac{\Delta f(a)}{\Delta x}= f'(a)+\varepsilon \text{ with }\varepsilon\simeq 0 \]

\bigskip
\begin{center}
\begin{tikzpicture}[scale=1.2]
\draw(0,0)--(1,4);
\draw[dashed](0.2,0)node[below]{$a$}--(0.2,0.8);
\draw[dashed](0.8,0)node[below]{\quad $a+\Delta x$}--(0.8,3.2);
\draw[dashed](0.2,0.8)--(1.5,0.8)node[right]{$f(a)$};
\draw[dashed](0.8,3.2)--(1.5,3.2)node[right]{$f(a+\Delta x)$};
\draw[latex-latex](0.2,0.3)--(0.8,0.3)node[midway,below]{$\Delta x$};
\draw[latex-latex](1.3,0.8)--(1.3,3.2)node[midway,right]{$\Delta f(a)$};
\end{tikzpicture}
\end{center}
Note: drawings involving ultrasmall or ultralarge values are not meant to be to scale nor be a correct representation. Their purpose -- as all drawings used in mathematics -- is merely to help the mind.


\Pract{derivative1}{
Using definition \ref{derivative}, give the derivative functions of the following functions:
\begin{multicols}{2}
\begin{enumerate}
\item $f:x\mapsto 3x+2$
\item $g:x\mapsto 2x^2-x$
\item $h:x\mapsto 5x^3+2x^2-x$
\item $k:x\mapsto 5x^3+2x^2+3x+2$
\end{enumerate}
\end{multicols}
}




In some cases, the slope to the right of a point is not the same as the slope to the left of that point. The derivative is the slope when it is the same on both sides.




\exo{
Let $f:x\mapsto ax+b$.

Show that the slope of $f$ is $a$.
}

\Theorem{\label{max}Derivative at a maximum or a minimum.}{
 Let $f$ be a real function defined on an open interval $]a;b[$ differentiable at $c \in
]a;b[$.

 If $f(c)$ is a local maximum (or a local minimum) then $f'(c)=0$.}

\exo{
Prove theorem \ref{max}. (Hint, consider the variation $\Delta f(c)$.)
}

\tproof{Assume $f'(a)$ exists and that $\langle a,f(a)\rangle$ is a local maximum. (the same proof holds for a minimum. Then $f(a)\geq f(a+\Delta x)\Rightarrow f(a+\Delta x)-f(a)\leq 0$.

Let $\Delta x$ be positive, then $\frac{f(a+\Delta x)-f(a)}{\Delta x}\leq 0\simeq f'(a)$

Let $\Delta x$ be negative, then $\frac{f(a+\Delta x)-f(a)}{\Delta x}\geq 0\simeq f'(a)$

The only observable number which is ultraclose to positive and negative values is 0.
}


\section*{Variation}
We now make the link between local variation and derivative.

\definition{Let $f$ be a real function defined on an interval $I$.
\begin{enumerate}
\item The function $f$ is \textbf{ increasing on $I$}
if $f(x) \leq f(y)$, whenever $x < y$ in
$I$.
\item
The function $f$ is \textbf{decreasing on $I$}
if $f(x) \geq f(y)$, whenever $x < y$
in $I$.
\end{enumerate}
}\index{variation}


If the inequalities are strict, then we say that the function is strictly increasing or strictly decreasing.

\exo{Prove the following theorem:
\Theorem{\label{derivee0}Variation and Derivative}{
Let $f$ be a real function differentiable at $a$. Then
\begin{enumerate}
\item
If $f'(a) \geq 0$ ($> 0$) then $f$ is (resp. strictly) increasing at $a$.
\item
If $f'(A) \leq 0$ ($<0$) then $f$ is
(resp. strictly) decreasing at $a$.
\item
If $f'(x) = 0$ then $f$ is stationary at $a$.

\end{enumerate} }\index{variation}
}

The converse is obvious: if $f$ is increasing at $a$, then $f'(a)>0$.


\exo{
A factory wants to make cardboard boxes (with no top) out of sheets of $30cm
\times 16cm$

\begin{center}
\begin{tikzpicture}[scale=0.3]
\draw(0,0)--(10,0)--(10,8)--(0,8)--(0,0);
\draw(0,2)--(10,2);
\draw(0,6)--(10,6);
\draw(2,0)--(2,8);
\draw(8,0)--(8,8);
\draw(1,0)node[below]{$x$};
\draw(0,1)node[left]{$x$};
\end{tikzpicture}
\end{center}

The volume will be a function of $x$. The dimensions of the base are
$30-2x$ and $16-2x$ (in centimetres). The height is $x$. What value(s) of
$x$ give(s) the maximum volume for the box?

}




%\section*{Linearity of the derivative}
%
%\theorem{\label{sum}Let $f$ and $g$ be real functions differentiable at $a$.
%Then the function $f+g$ is differentiable at $a$ and
%\[(f+g)'(a)=f'(a)+g'(a).\]
%}
%
%
%
%\theorem{\label{cf}Let $c\in\mathbb{R}$ and  $f$ be a real function differentiable at $a$. Then the function $c \cdot f$ is differentiable at $a$ and
%\[ (c \cdot f)'(a)=c \cdot f'(a).\]
%}
%
%
%
%\exo{Prove theorems  \ref{sum} and  \ref{cf}}
%
%\theorem{\label{derconstant}
%Let $c\in\mathbb{R}$ and $f: x \mapsto c$, for $x \in \mathbb{R}$
%\[f'(x)=0. \]}
%
%
%\exo{Prove theorem \ref{derconstant}}
%
%
%
%\Pract{derivative0}{
%Using theorems \ref{sum} and \ref{cf} and derivatives already calculates to find the derivative of the following:
%
%\begin{enumerate}
%\item $f:x\mapsto 5x^2-10x $ at $x=2$
%\item $g:x\mapsto 5(x-10)^2 $ at $x=3$
%\item $h:x\mapsto x^4+x^3+x^2+x+1 $ at $x=1$
%\item $k:x\mapsto 5x^2+10 $ at $x=2$
%\end{enumerate}
%
%}
%

\exo{
Differentiate

\begin{enumerate}
\item 
$f:x\mapsto \frac{1}{x}$ for $x=1$ and $x=2$.

\item $g:x\mapsto \frac{1}{3x+2}$ for $x=0$ and $x=1$.

\item $h:x\mapsto \frac{1}{x^2}$ for $x=1$ and $x=-1$.
\end{enumerate}
}

\section*{Tangent line}
Suppose $f$ is differentiable at $x_0$. We observe that through a microscope, the curve of a function $f$ at $x_0$ is indistinguishable from a straight segment. This straight segment meets the function  at $\langle x_0;f(x_0)\rangle$ and there is a (unique) line which extends this segment with slope equal to the derivative. This line is the tangent line. 

\definition{Let $f$ be differentiable at $x_0$. The tangent line $T_{x_0}$ is a line through  $\langle x_0;f(x_0)\rangle$ with slope $f'(x_0)$.
}

The tangent line  satisfies $T(x_0)=f(x_0)$ and $T'(x_0)=f'(x_0)$.
\index{tangent line}

\exo{Let $f:x\mapsto x^2$. Find the equation of the straight line tangent to $f$ at $x=3$. }

\exo{
Show that
\[
T_{x_0} : x \mapsto f'(x_0) (x - x_0) + f(x_0).
\]
}

\exo{
Give the equation of the line tangent to $x\mapsto x^3-3\cdot x^2$ at $x=2$. For which values of $x$ is this tangent horizontal? 
}

\exo{
\begin{enumerate}
\item Find the slope of the curve given by $y=5x^3-25x^2$ at $x=3.5$. 

Equivalent statement: compute $f'(x)\bigg|_{x=3.5}$
\item Find the equation of the line tangent to the curve at $x=1$.
\end{enumerate}}

\exo{
\begin{enumerate}
\item
For $f:x\mapsto x^2+5$ and the point $A\langle 0;0\rangle$, what is the equation of the
line passing through A, and tangent to $f$? 

\item
If $g:x\mapsto ax^2+b$, what values must $a$ and $b$ take to make $g(x)$
tangent to $t:x\mapsto 3x-2$ at $x=5$? What are the coordinates of
the contact point?
\end{enumerate}
}

\tproof{On the interval $[1,3]$, the function is locally increasing --  the derivative is positive, so  if we zoom on it, locally it is increasing. Hence $f(2+\Delta x)>f(2)$ for $\Delta x>0$. The variation of the area is between $f(2)\cdot\Delta x$ and $f(2+\Delta x)\cdot \Delta x$, hence 
\[f(2)\cdot\Delta x<\Delta A(2)<f(2+\Delta x)\Delta x\]
Then
\[f(2)<\frac{\Delta A(2)}{\Delta x}<f(2+\Delta x)\] and we conclude that $f(2)\simeq\frac{\Delta A(2)}{\Delta x}$ and the conclusion is the same for $\Delta x<0$ (with $>$ instead of $<$)

Therefore $A'(2)=f(2)$ and in general we will have $A'(x)=f(x)$.

Using results of previous exercises, it is possible to check that $A(x)=x^3+x$ but also $x^3+x+k$ satisfies the requirement.

We know that $A(1)=0$ (the area under $f$ from $1$ to $1$...) hence $A(1)=1^3+1+k=0\Rightarrow k=-2$ and $A(3)=3^3+1-2=26$.


}


\section*{Area under the curve of $x\mapsto x^2$}
\exo{\label{area1}To find the area under $f:x\mapsto x^2$ between $x=0$ and $x=2$, the idea is to consider the \emph{variation} of the area in order to find the area itself.

Assume that the area under $f$, between $0$ and $x$ is given by a function $A(x)$. Consider the variation $\Delta A(x)$, for ultrasmall variation of $x$ noted $\Delta x$.

\begin{center}
\begin{tikzpicture}[domain=0:2.2]
\draw[-latex](-.5,0)--(3,0);
\draw[-latex](0,0)--(0,4);
\draw plot (\x,\x^2)--(2.2,0);
\draw[fill=gray!50,domain=1.4:1.5](1.4,0)--plot (\x,\x^2)--(1.5,2.25)--(1.5,0);
\draw[-latex](3,2)node[right]{$\Delta A(x)$}--(1.45,1.5);
\draw[-latex](1,-1)node[below]{$x$}--(1.4,-0.1);
\end{tikzpicture}
\end{center}

Even though the exact value of $\Delta A(x)$ may not be directly seen, it can be shown to be between two values, $m$ and $M$ calculated by rectangles.

\[m<\Delta A(x)<M\]

\begin{itemize}
\item Give a formula for $m$, using $x$ and $f$.
\item Give a formula for $M$, using $x$ and $f$.
\item Divide all terms by $\Delta x$.
\item Show that all resulting quotients are ultraclose.
\item Conclude that the area is given by a function which is the derivative of a known function. 
\end{itemize}
}

\section*{Antiderivatives}

\Definition{Antiderivative}{If $f'$ is the derivative function of $f$, then $f$ is the \textbf{antiderivative} function of $f'$.}



\exo{\label{fall}The velocity of an object is given by the derivative of its position (variation of position divided by variation of time). 

The acceleration is given by the derivative of the velocity (variation of velocity divided by variation of time).

On earth, the acceleration of a falling body is constant (when there is no air friction) and approximately equal to $9.81 \frac{m}{s^2}$, written $g$.

\begin{enumerate}
\item Find the formula for the velocity with respect to time.
\item Given the formula for velocity, find the formula for the position of a falling body with respect to time.
\end{enumerate}
}




\exo{Show that if $F$ is an antiderivative of $f$, then for any constant $C$, $F+C$ is also an antiderivative of $f$.}

\exo{Considering previous exercise, reconsider your answers for exercise \ref{fall}. Think in terms of units to determine what the constants could represent.}

\exo{Find the antiderivatives for the following:
\begin{enumerate}
\begin{multicols}{2}[]
\item $x\mapsto 3x$
\item $x\mapsto x^2$
\item $x\mapsto 5$
\item $t\mapsto 3t+5$
\item $u\mapsto u^2+3u+5$
\item $v\mapsto v^3$
\end{multicols}
\end{enumerate}

Check your results by differentiating them.
}



\vfill
\begin{center}
{\LARGE THINGS TO LOOK OUT FOR
}


\bigskip
$f'(a)\ $ is {\LARGE\quad NOT\quad } equal to\quad $\dfrac{\Delta f(a)}{\Delta x}$.


\bigskip
The relation is one of ultracloseness.

\[f'(a)\simeq \dfrac{\Delta f(a)}{\Delta x}\]

\end{center}

\newpage

\Pract{derivative0}{
Calculate the derivative of the following:

\begin{enumerate}
\item $f:x\mapsto 5x^2-10x $ at $x=2$
\item $g:x\mapsto 5(x-10)^2 $ at $x=3$
\item $h:x\mapsto x^4+x^3+x^2+x+1 $ at $x=1$
\item $k:x\mapsto 5x^2+10 $ at $x=2$
\end{enumerate}

}

\Pract{derivative2}{

  Find the derivative of each of the following functions and specify its domain, starting from the definition.   
  \begin{enumerate}
    \begin{multicols}{2}
    \item $a:x\mapsto 1$
    \item $b:x\mapsto |x|$
    \item $c:x\mapsto x$
    \item $d:x\mapsto x^2$
    \item $e:x\mapsto |x^2|$
    \item $f:x\mapsto x^3$
    \item $g:x\mapsto |x^3|$
    \item $h:x\mapsto \dfrac1x$
    \item $i:x\mapsto \dfrac1{x^2}$
    \end{multicols}
  \end{enumerate}
  }


\Pract{derivative3}{
  Find the derivative of each of the following functions and specify its domain, using linearity and the results from the previous exercise.
\begin{enumerate}
  \item $a:x\mapsto 2x^2-4x+5$
  \item $b:x\mapsto \dfrac{x^3+2x}7$
  \item $c:x\mapsto 3x^3-\dfrac2x$
  \item $d:x\mapsto \dfrac{x^2-2x+5}x$
  \item $e:x\mapsto 5x^3-7|x|+8$
\end{enumerate}
}

\Pract{antiderivative1}{

Find all the antiderivatives of each of the following functions, using linearity and the results from the exercise 1.
\begin{enumerate}
\item $a:x\mapsto 10x$
\item $b:x\mapsto x^2$
\item $d:x\mapsto \dfrac x{|x|}$
\item $e:x\mapsto 3x-4$
\item $f:x\mapsto x^2-2x+4$
\item $g:x\mapsto \dfrac1{x^2}$
\item $h:x\mapsto 2x^2-\dfrac1{2x^2}$
\end{enumerate}
}

\Pract{curvesk}{
Let
\[f:x\mapsto \frac{1}{3}x^3+\frac{7}{2}x^2+12x\]
% Note that this does not depend on $x$ as long as it satisfies the condition of being ultraclose to $a$.

Calculate its derivative, find where the derivative is positive, where it is negative and where it is equal to zero.

Calculate the intercepts of $f$ and sketch the graph of $f$.

}

\Pract{tangentl}{
Consider the functions differentiated above:
\begin{enumerate}
  \item $a:x\mapsto 2x^2-4x+5$
  \item $b:x\mapsto \dfrac{x^3+2x}7$
\end{enumerate}


For $a$, give the equation the line tangent to the curve at $x=-2$

For $b$, give the equation the line tangent to the curve at $x=1$

}

%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mypage
\section*{Answers to practice exercises}

\sol{derivative1}{
\begin{multicols}{2}
\begin{enumerate}
 \item $f'(x)=3$
\item $g'(x)=4x-1$
\item $h'(x)=15x^2+4x-1$
\item $k'(x)=15x^2+4x+3$
\end{enumerate}
\end{multicols}
}

\sol{derivative0}{
\begin{multicols}{2}
\begin{enumerate}
\item $f'(2)=10$
\item $g'(3)=-70$
\item $h'(1)=10$
\item $k'(2)=20$
\end{enumerate}
\end{multicols}
}



\sol{derivative2}{
\begin{enumerate}

   \item $a'(x)=0$ \qquad Domain=$\mathbb{R}$
    \item $b'(x)=\begin{cases}
    1 & \text{ if } x>0
    \\
    \text{undefined} & \text{ if } x=0
    \\
    -1 & \text{ if } x<0
    \end{cases}$\qquad Domain=$\mathbb{R}\setminus\{0\}$
    \item $c'(x)=1$ \qquad Domain=$\mathbb{R}$
    \item $d'(x)=2x$\qquad Domain=$\mathbb{R}$
    \item $e'(x)=2x$\qquad Domain=$\mathbb{R}$
    \item $f'(x)=3x^2$\qquad Domain=$\mathbb{R}$
    \item $g'(x)=\begin{cases}
    3x^2 & \text{ if } x>0
    \\
    0& \text{ if } x=0
    \\
    -3x^2 & \text{ if } x<0
    \end{cases}$\qquad Domain=$\mathbb{R}$
    \item $h'(x)=\dfrac{-1}{x^2}$\qquad Domain=$\mathbb{R}$
    \item $i'(x)=\dfrac{-2}{x^3}$\qquad Domain=$\mathbb{R}$
\end{enumerate}
}

\sol{derivative3}{
\begin{enumerate}
  \item $a'(x)=4x-4$\qquad Domain=$\mathbb{R}$
  \item $b'(x)=\dfrac{3x^2+2}{7}$\qquad Domain=$\mathbb{R}$
  \item $c'(x)=9x^2+\frac{2}{x^2}$\qquad Domain=$\mathbb{R}\setminus\{0\}$
  \item $d'(x)=1-\dfrac{5}{x^2}$ \qquad Domain=$\mathbb{R}\setminus\{0\}$
  \item $e'(x)=\begin{cases}
  15x^2-7 &\text{ if } x>0
  \\
  \text{undefined} & \text{ if } x=0
  \\
  15x^ 2+7&\text{ if } x<0
  \end{cases}$\qquad Domain=$\mathbb{R}\setminus\{0\}$
\end{enumerate}
}

\sol{antiderivative1}{
\begin{enumerate}
\item $A(x)=5x^2+C$ \qquad for any $C\in\mathbb{R}$
\item $B(x)=\dfrac{x^3}{3}+C$\qquad for any $C\in\mathbb{R}$
\item $D(x)=C$\qquad for any $C\in\mathbb{R}$ (function undefined at $x=0$)
\item $E(x)=\dfrac{3}{2}x^2-4x+C$\qquad for any $C\in\mathbb{R}$
\item $F(x)=\dfrac{x^3}{3}-x^2+4x+C$\qquad for any $C\in\mathbb{R}$
\item $G(x)=-\dfrac{1}{x}+C$\qquad for any $C\in\mathbb{R}$
\item $H(x)=\dfrac{2}{3}x^3+\dfrac1{2x}+C$\qquad for any $C\in\mathbb{R}$
\end{enumerate}

}

\sol{curvesk}{
$\displaystyle f(x)=x\left(\frac{1}{3}x^2+\frac{7}{2}x+12\right)$

$\mathcal{S}=\{0\}$

$f'(x)=x^2+7x+12=(x+3)(x+4)$

$\mathcal{S}'=\{-3,-4\}$

\begin{center}
\begin{tikzpicture}[xscale=0.5,yscale=.5] 
\clip(-6,-16) rectangle (7,7);
\draw[-latex] (-6,0) -- (6,0) node[below] {$x$} ; 
\draw[-latex] (0,-15) -- (0,6) node[left] {$y$}; 	
\draw[thick] plot[raw gnuplot] function{plot[x=-6:1](0.33333*x**3+3.5*x**2+12*x)};
\foreach \n in {-10,-5,...,5}
\draw(\n,0.5)--(\n,-0.5)node[below]{\n};
\foreach \n in {-15,-10,...,5}
\draw(-0.5,\n)--(0.5,\n)node[right]{\n};
\draw[dashed](-3,1)node[above]{$-3$}--(-3,-13.5)--(0.5,-13.5)node[right]{$-13.5$};
\draw[dotted](-4,2)node[above]{$-4$}--(-4,-13.333)--(3.5,-13.333)node[right]{$-13.333$};
\end{tikzpicture}
\end{center}
}

\sol{tangentl}{
\begin{enumerate}
  \item $t_a:x\mapsto -12x-3$
  \item $t_b:x\mapsto \dfrac{5}{7}x-\dfrac{2}{7}$
\end{enumerate}

}
%===================================================

\chapter{Continuity} 
Informally: a function is continuous at $x=a$ if it is where you would expect it to be by observing where it is in the neighbourhood of $a$.


\Definition{Continuity \label{Dcontinuity1}}{
Let  $f$ be a real function defined around $a$. We say that \textbf{$f$ is continuous at $a$} if (for any $x$)
 \[x\simeq a\Rightarrow f(x)\simeq f(a).\]}\index{continuity}


The continuity of $f$ at $a$ is a property of $f$ and $a$.  Hence the context is given by $f$ and $a$.

The definition of continuity can also be interpreted in the following ways:

\Definition{Continuity: equivalent definition}{
Let $f$ be a real function defined around $a$. We say that \textbf{$f$ is continuous at $a$} if 
\[f(a+\Delta x)\simeq f(a) \text{ not depending on }\Delta x.\]}

(As for the derivative, the context is  $f$ and $a$.)


\exo{Show that $f:x \mapsto x^3$ is  continuous at $a=2$.}

\Theorem{Critical Point Theorem\label{critical}}{
Let $f$ be a continuous function on $I$ and suppose that $c$ is a
point in $I$ and $f$ has either a maximum or a minimum at $c$. Then
one of the following three things must happen:
\begin{enumerate}
\item $c$ is an end point of $I$.
\item $f'(c)$ is undefined.
\item $f'(c)=0$
\end{enumerate}
}

The critical point theorem graphically:

\bigskip
\begin{center}
\begin{tikzpicture}
\draw [line width=1.2pt](0,2).. controls  (1,0.5) and (2,0)  .. (3,0);
\draw [-latex] (1,2.5)--(0.05,2.05);
\draw [dashed](0,0)node[below]{c}--(0,2);
\draw [line width=1.2pt](5,0) .. controls (6,0.5) .. (6.5,2);
\draw [line width=1.2pt] (6.5,2) .. controls (7,0.5).. (8,0);
\draw [dashed](6.5,0)node[below]{c}--(6.5,2);
\draw[-latex] (7.5,2.5)--(6.55,2.05);
\draw [line width=1.2pt](10,0) .. controls (11,2) and (11.5,2)..(12,0);
\draw [-latex] (12,2.5)--(11.2,1.6);
\draw [dashed](11.15,0)node[below]{c}--(11.15,1.5);
\end{tikzpicture}
\end{center}

The two first cases are direct observation. The third case id theorem \ref{max}.

\exo{Show whether $f:x\mapsto \dfrac{x}{x^2+1}$ is continuous for all values of $x$.}
exo{
\begin{enumerate}
 \item Show that $f:x\mapsto |x|$ is continuous at $x=0$, at $x=1$, at $x=-1$ and at $x$ in general.
\item Show that 
$g:x\mapsto\begin{cases}
x^2 & \text{ if } x\geq 0
\\
x^3 & \text{ if } x < 0
\end{cases}$
is continuous at $x=0$ and at $x$ in general.
 \item Show that 
$g:x\mapsto\begin{cases}
x^2 & \text{ if } x\geq -1
\\
x^3 & \text{ if } x < -1
\end{cases}$
is not continuous at $x=-1$ but is continuous for all other values of $x$.
 
\end{enumerate}

}

\exo{
Prove the following theorem:

\theorem{ If a real function $f$ is differentiable at $a$ then $f$ is continuous at $a$.  }

\begin{enumerate}
\item Give a direct proof.

\tproof{\textit{We start using the power of the increment equation}. 

$\Delta f(a)=\underbrace{f'(a)\cdot \Delta x}_{\text{observable}\times\text{ultrasmall }\simeq 0}+\underbrace{\varepsilon\cdot\Delta x}_{\simeq 0}$}

\item Give a proof by contrapositive.

\tproof{Assume $f$ is not continuous at $a$, then there is an $x\simeq a$ such that $f(x)\not\simeq f(a)$. So $|f(a)-f(x)|\geq b$, for some observable positive $b$. Then $\frac{\left|f(a)-f(x)\right|}{\delta x}\geq \frac{b}{\Delta x}$. This last term is ultralarge (observable/ultrasmall) so there is no observable neighbour, so no derivative. }
\end{enumerate}
}

\exo{Use an induction proof to show that $x\mapsto x^n$ is continuous for all $n$.}




\exo{Prove the following theorem:

\theorem{\label{continuity} 
Let $f$ and $g$ be two real  functions continuous at $a$. Then
\begin{enumerate}
\item
$f \pm g$ is continuous at $a$.


\item
$f \cdot g$ is continuous at $a$.
\item
$\ds\frac{f}{g}$ is continuous at $a$ if $g(a) \not = 0$.

\tproof{For $x\simeq a$, we have $f(x)\simeq f(a)$ and $g(x)\simeq g(a)$. The conclusions follow by theorem \ref{ultracalc}.

\bigskip
It is also possible to introduce dependent variables $u$ and $v$.

$f(a)=b$, $g(a)=c$, $f(x)=u$ and $g(x)=v$ 

By continuity $b\simeq u$ and $c\simeq v$ 

By theorem \ref{ultracalc}, $b\pm c\simeq u\pm v\qquad b\cdot c\simeq u\cdot v$\quad and $\frac{b}{c}\simeq \frac{u}{v}$.
}
\end{enumerate}}}





\exo{Prove the following theorem:

\theorem{\label{composition}
Let  $f$ and $g$ be two real functions. If $f$ is continuous at $a$ and $g$ is continuous at $f(a)$, then $g \circ f$ is continuous at $a$.}
}


\tproof{$g(x)\simeq g(a)$ hence $f(g(x))\simeq f(g(a))$. And that is it. 

\bigskip
So short that maybe some expanding may help (useful to prepare the way for the chain rule). 

Let $g(a)=b$ and $g(x)=u$. By continuity of $g$ at $a$, we have $b\simeq u$ and by continuity of $f$ at $b$, we have $f(b)\simeq f(u)$.}

\exo{Use an induction proof to show that $\ds x\mapsto a_0+\sum_{k=1}^ na_kx^k$ is continuous for all $n$.}

\Definition{Continuity on an Interval}{
\begin{enumerate}
\item Let $f$ be a real function defined on the open interval $]a;b[$. Then $f$ is \textbf{continuous on $]a;b[$} if $f$ is continuous at all  $x \in ]a;b[$.
\item Let $f$ be a real function defined on the closed interval $[a;b]$. Then $f$ is \textbf{continuous on $[a;b]$} if $f$ is continuous at all $x \in ]a;b[$ and if  $f$ continuous on the right at $a$ and on the left at $b$.
 \end{enumerate}
}\index{continuity!on an interval}

Informally: a function is continuous on an interval if its curve can be drawn without lifting the pencil, or if the function is where you expect it to be if it is hidden by a vertical line.

\exo{Determine whether $f:x\mapsto x^2$ is continuous on its domain.}

\bigskip
Clearly, if $f$ and $g$ are continuous on an interval $I$ then the sum, difference, product and quotient (if $g(x)\not=0$) are continuous on $I$. Moreover, if $g$ is continuous on an interval containing $f(I)$ then $g\circ f$ is continuous on $I$.



\exo{Show whether the following functions are continuous on the given intervals.
\begin{enumerate}
  \item $f_1:x \mapsto \frac{1}{3}x+\sqrt{2}$ on  $\mathbb{R}$
  \item $f_2 : x \mapsto x^2-3x-1$  on $\mathbb{R}$
  \item $f_3:x \mapsto \dfrac{x+2}{x-1}$ on $]1;+\infty[$
\end{enumerate}
}

\exo{Determine whether $f:x\mapsto\frac{1}{x}$ is continuous on its domain.}


\Theorem{Intermediate Value theorem\label{Tintermed}}{Let $f$ be a real function continuous on $[a;b]$. Let $d$ be a real number between $f(a)$ and $f(b)$. Then there exists $c$ in $[a;b]$ such that $f(c) = d$.}\index{intermediate value theorem}

\bigskip
This theorem does not tell us how to find the root or the value $c$ such that $f(c)=d$. It only asserts the \emph{existence} of such a number. For specific functions where we can calculate  the roots explicitly this theorem is not really necessary but, when proving theorems about continuous functions in general, it is the only way to know that there is a root. 

\exo{
Give an example of a function $f$ discontinuous on $[a;b]$ with $f(a)<0$ and $f(b)>0$ such that there is no $c$ in the interval $[a;b]$ such that $f(c)=0$.
}



\exo{\label{intermediateT}
Proving theorem \ref{Tintermed}. 

Let $f$ be continuous on an interval $[a;b]$.

Assume $d=0$ and $f(a)<0<f(b)$. 

The context is $f$, $a$, $b$ and $0$. Take an ultralarge positive integer $N$ and partition $[a;b]$ into $N$ even parts, each of ultrasmall length $\Delta x=\frac{b-a}{N}$.  We thus have $x_0=a,\  x_1=x_0+\Delta x,\ \dots,\ x_N=b$.

Call $x_j$ the first point of the partition such that $f(x_j)\geq 0$. Hence $f(x_{j-1})<0$.

\begin{enumerate}
\item Let $c$ be the observable part of $x_j$. Is it the observable part of $x_{j-1}$?
\item Is $f(c)$ observable?
 \item How close are $f(x_j)$ and $f(x_{j-1})$?
\item How close is $f(c)$ from  $f(x_j)$ and $f(x_{j-1})$?
\item What is the value of $f(c)$?
\end{enumerate}

(For $d\neq 0$ the theorem would hold for $g(x)=f(x)+d$; for $f(a)>f(b)$, reverse all inequality symbols.) 
}

\tproof{
\bigskip
Let $N$ be an ultralarge integer, and $\Delta x=\frac{b-a}{N}\simeq 0$ and $x_k=a+k\cdot\Delta x$.

Let $x_j$ be the first element of the partition $\{a,x_1, x_2, \dots, x_N=b\}$ such that $f(x_j)<0$ and $f(x_{j+1})\geq 0$.

Since $a\leq x_j\leq b$, then $x_j$ has an observable neighbour $c$, so $x_j\simeq c$ and $x_{j+1}\simeq c$. By closure $f(c)$ is observable with $f(c)\simeq   f(x_j)<0$ and $f(c)\simeq f(x_{j+1})\geq 0$, hence $f(c)=0$.

\bigskip
\textit{I usually give the example of $x\mapsto x^2-2$ as $f:\mathbb{Q}\to\mathbb{Q}$ to show that this theorem is the link between continuity and the fundamental characterisation of what real numbers are.}
}




\definition{ A function has \textbf{maximum} (respectively \textbf{minimum}) on an interval $I$ if there is a $c\in I$ such that for any $x\in I$ we have $f(c)\geq f(x)$ (respectively $f(c)\leq f(x)$).

If a point is either a maximum or a minimum, it is an \textbf{extremum}.
}\index{maximum}\index{minimum}

\Theorem{Extreme value}{\label{extremes}
 Let $f$ be a continuous function on $[a;b]$. Then it has a  maximum and a  minimum on $[a;b]$. }\index{extreme value theorem}

\exo{Without loss of generality, we consider the case of a
maximum (for the minimum replace $f$ by $-f$). Context is $f,a$ and $b$. 


We proceed similarly to exercise \ref{intermediateT}.

Let $f$ be continuous on an interval $[a;b]$.

Take an ultralarge positive integer $N$ and partition $[a;b]$ into $N$ even parts, each of length $\Delta x=\frac{b-a}{N}$.  We thus have $x_0=a,\  x_1=x_0+\Delta x,\  \dots,\ x_N=b$.

Call $x_j$ the first point of the partition such that $f(x_j)\geq f(x_i)$ for any $i$ between 0 and $N$. 

\begin{enumerate}
\item Call $c$ the observable part of $x_j$. Is $f(c)$ observable?
\item Let $x$ be observable. Then there is an $i$ such that $x_i\leq x\leq x_{i+1}$. Using continuity, conclude that $f(x)\leq f(x_j)$.
\item By the closure principle, conclude that $f(c)$ is the maximum.
\end{enumerate}
}

\tproof{\textit{A bit more tricky since it uses Closure in the contrapositive: a statement and its negation have same observability. If a statement is true for all observable values of a set, then it is true for all values in that set. If it did not, there would be a counterexample, but by closure, if there is a counterexample, there is an observable one. So there is no counterexample.}

\bigskip
Take an ultralarge positive integer $N$ and partition $[a;b]$ into $N$ even intervals, each of length $\Delta x=\frac{b-a}{N}$.  We thus have $x_0=a,\  x_1=x_0+\Delta x,\  \dots,\ x_N=b$.

Call $x_j$ the first point of the partition such that $f(x_j)\geq f(x_i)$ for any $i$ between 0 and $N$. 

Let $c$ be the observable neighbour of $x_j$. By closure $f(c)$ is observable. Let $x\in [a;b]$ be observable. Then $f(x)\leq f(c)$.

Proof of this claim: since $x\in [a;b]$, there is an $i$ such that $x_i\leq x\leq x_{i+1}$. Assume $f(x)>f(c)$, then $f(x)\simeq f(x_i)\not \simeq f(x_j)$. This implies $f(x_i)> f(x_j)$ which contradicts the definition of $x_j$. Then $\langle c, f(c)\rangle$ is the maximum of for all observable $x$ in the interval, hence by closure it is the maximum of all $x$ in the interval.

}

\section*{Continuity and Differentiability}

\Theorem{Rolle}{Let $f$ be a real function continuous on $[a;b]$ and differentiable on
$]a;b[$. If $f(a)=f(b)$, then there is a $c\in ]a;b[$ such that
\[
f'(c)=0. \] }\index{Rolle's theorem}

\exo{
Prove Rolle's theorem.}



\Theorem{Mean Value\label{meanvalue}}{
Let $f$ be a real function continuous on $[a;b]$ and differentiable on $]a;b[$. 
Then there is a $c\in]a;b[$ such that \[ f(b)-f(a)=f'(c)\cdot(b-a).\]
}\index{mean value theorem}

\exo{
Consider $g$ which is obtained by subtracting the line $\ell(x)$ through $(a,f(a))$ and $(b,f(b))$ from the function $f$ i.e., $g(x)=f(x)-\ell(x)$. 

\begin{center}
\begin{tikzpicture}[yscale=0.08]
\draw[line width=1.2pt]  plot[raw gnuplot] function{plot[-3:3] 5*x+(x+3)*x*(x-3)} ;
\draw(-2.2,-.5)--(-1.2,4.5);
\draw(1.2,-4.5)--(2.2,.5);
\draw(-3,-15 )--(3,15);
\draw[dotted](-3,-15)node[below]{$a$}--(3,-15)node[below]{$b$};
\draw[->,dotted](3,15)--(3,-15);
\draw[dashed](-1.732,5)--(-1.732,-35);
\draw[dashed](1.732,5)--(1.732,-50);
%-----------------------
\draw[line width=1.2pt] plot[raw gnuplot] function{plot[-3:3] (x+3)*x*(x-3)-30} ;
\draw(-2.2,-19.608)--(-1.2,-19.608);
\draw(1.2,-40.392)--(2.2,-40.392);
\end{tikzpicture}
\end{center}



Show that $g$ satisfies Rolle's theorem and conclude with the mean value theorem.

}

\exo{
Let $f$ be continuous and positive on $[a;b]$

Assuming the area function under $f$ is given by $A$. Show how $A$ can be bounded above and below. Show that there is a value $c\in [a;b]$ such that $A=f(c)\cdot(b-a)$.}


\exo{Prove the following theorem:

\theorem{The antiderivative of a function -- when it exists -- is unique up to an additive constant i.e., 

for any constant $C$

\[f'=g'\Rightarrow f=g+C\]
}}



\exo{Consider the trigonometric circle. The chord $BC$ is shorter than the arc $BC$.  

\begin{center}
\begin{tikzpicture}[scale=0.4]
% Local definitions 
\def\costhirty{0.8660256} 
\def\costhirtysix{0.8660256*6}
\draw [] (6,0) arc (0:90:6cm) node[midway]{}; 
\draw [] (1.5,0) arc (0:30:1.5cm);
\draw [] (0.8660256,0.5) arc (30:60:1cm);
%\pgfsetarrowsend{latex}

\pgfsetarrowsend{latex}
\draw[->] (-.5,0) -- (7.5,0) node[right] {$x$} coordinate(x axis); 
\draw[->] (0,-.5) -- (0,7.5) node[above] {$y$} coordinate(y axis); 
\draw[<->, stealth-stealth] (3.,-.5) -- (5.19615,-.5) node[below, midway] {$\Delta\cos(\theta)$} ;
\draw[<->, stealth-stealth] (-0.5,3.) -- (-.5,5.19615) node[left, midway] {$\Delta\sin(\theta)$} ;
\pgfsetarrowsend{}
\draw (1.5,0.4) node[above, right] {$\theta $} ; 
\draw (0.5,1.1) node[above, right] {$d\theta$} ;  
\draw (0,0) -- (3.0,5.19615) ;
\draw (3.,5.39615) node[above, right] {$C$} ;  
\draw (0,0) -- (5.19615,3.0) ;
\draw (5.19615,3.2) node[above, right] {$B$} ; 
\draw [dashed](5.19615,0) -- (5.19615,3.0);
\draw [dashed](0,3.0) -- (5.19615,3.0);
\draw [dashed](3,0) -- (3.0,5.19615);
\draw [dashed](0,5.19615) -- (3,5.19615);
\draw (1.5,6.69615) -- (6.69615,1.5) node[above] {$s$};
\draw (5.7,-0.5) node[right] {$1$};
\draw (-0.7,-0.5) node[right] {$0$};
\draw (3,3.25)--(3.25,3.25)--(3.25,3);
\end{tikzpicture} 
\end{center}

Show that sine and cosine are continuous functions.
}

\tproof{By Pythagoras: $(\Delta \sin(\theta))^2+(\Delta \cos(\theta))^2=(BC)^2$

Since the straight line is the shortest between two points, $BC<\theta\simeq 0$. This implies both 
$\Delta\sin(\theta)\simeq0$ and  $\Delta\cos(\theta)\simeq0$
}
\newpage
\section*{Optimisation Problems}



\exo{
A $1l$ milk pack is made of cardboard. Its
sides can only be rectangles. The height is twice one of the other two
dimensions. The area of the pack must be minimal.

What are the dimensions of the pack?
}

\exo{
Imagine you want to protect a part of a rectangular garden against a
long wall. You have 100m of fence. (No fence is needed against the wall.)

What is the biggest area that you can protect?
}



\exo{
A cylindrical jar has a volume defined by its radius and its
height. If it contains one litre ($1\text{dm}^3$), what are the dimensions
that will make it have the least area?
}

\exo{
Find the length and width of the rectangle inscribed within the
ellipse given by the formula $4x^2+y^2=16$ (sides parallel to the
coordinate axes) such that its area is maximal.
}



\exo{
Let $\mathcal{P}$ be the parabola given by $x\mapsto x^2$ and $A$ be
the point $\langle 0;5\rangle$.

Find the point(s) on the parabola $\mathcal{P}$ such that its (their) distance to
$A$ is minimal.
}

\newpage
\section*{Bending}

\Definition{Second Derivative}{
Let $f$ be a function differentiable at $a$. If $f'$ is also differentiable at $a$, then we say that $f$ is differentiable twice at $a$ and $(f')'(a)=f''(a)$\footnote{pronounced: ``eff double prime''}

}

\label{bend}
\definition{Let $f$ be differentiable on an interval $I$.
The curve of $f$ is \textbf{bending upwards on $I$} if for every $x, u \in I$, $f(u)$ is above the line tangent to $f$ at $(x,f(x))$, i.e.,
\[
f(u) \geq f'(x)(u-x) + f(x).
\]
The curve of $f$ is \textbf{bending downwards on $I$} if $(-f)$ is bending upwards. }\index{bending}


\begin{center}
\begin{tikzpicture}
 \draw [line width=1.2pt](0,2).. controls (1,0) and (2,0.75) ..(4,3);
\draw[dashed] (0,1)node[left]{$f(x)$} -- (1.85,1)--(1.85,0)node[below]{$x$};
\draw(1,0.55)--(4,2.15); 
\draw[dashed](3.5,0)node[below]{$u$}--(3.5,2.45)--(5,2.45)node[right]{$f(u)$};
\draw[dashed](3.5,1.87)--(5,1.87)node[right]{$t(u)$};
\end{tikzpicture}
\end{center}

For ultrasmall $(u-x)$  this can be rephrased in the following manner:

\definition{
A differentiable function $f$ is bending upwards at $a$ if
\[f(a+\Delta x)\geq f(a)+f'(a)\cdot \Delta x.\]}

\Theorem{\label{conc}Bending and Second Derivative}{Let $f$ be twice differentiable on an interval $I$. Then
\begin{enumerate}
\item
If $f''(x) \geq 0$ whenever $x \in I$ then $f$ is bending upwards on $I$.
\item
If $f''(x) \leq 0$ whenever $x \in I$ then $f$ is bending downwards on $I$.
\end{enumerate}}

\exo{
Use the mean value theorem to prove theorem \ref{conc}.

}

\tproof{\textit{This proof is not specific to ultracalculus. But here it is:}

\bigskip
 For (1) we have to prove that \[ \Big (f(x)-f(a) \Big)\cdot (b-a)
\le \Big( f(b)-f(a) \Big)\cdot (x-a). \] We can write $b-a=
(b-x)+(x-a)$ and $f(b)-f(a)= (f(b)-f(x))+(f(x)-f(a))$. This
inequality is thus equivalent to the following:
\[
\Big(f(x)-f(a)\Big)\cdot (b-x) \le \Big(f(b)-f(x)\Big)\cdot (x-a),
\] that is,
\[
\frac{f(x)-f(a)}{x-a} \le \frac{f(b)-f(x)}{b-x}.\] By the Mean
Value Theorem, there exist $c,d$ such that $a<c<x<d<b$ and
\[
\frac{f(x)-f(a)}{x-a}=f'(c) \quad \text{and} \quad
\frac{f(b)-f(x)}{b-x}=f'(d). \]
It follows from $f''(x)\ge 0$ in
$I$, that $f'$ is increasing in $I$, and in particular, $f'(c) \le
f'(d)$. This proves (1); for the proof of (2) replace $f$ by $-f$.

}

%==========================================================

\chapter{Differential Calculus}\label{diffrul}

For the following rules, the proofs proceed by steps:

\begin{enumerate}
\item Definition of the derivative.
\item Definition of $\Delta$.
\item Definition of operations on functions.
\item Expansion of $f(a+dx)$ as $f(a)+\Delta f(a)$.
\item Division by $dx$.
\item Algebra.
\item Definition of the antiderivative for the inverse rule about integration.
\end{enumerate}


\exo{
Explain why if $f$ is differentiable at $a$, then $\Delta f(a)\simeq 0$.
}

The previous property can be rewritten using the $y=f(x)$ notation, where $y$ is a dependent variable. Then if $y'$ exists, we have $y'\simeq \frac{\Delta y}{\Delta x}$ and  $\Delta y\simeq 0$.

\subsection*{Product}

\tproof{\textit{Starting with linearity of the derivative leads to the common error $(uv)'=u'v'$. So we start with the less obvious ones to avoid this. }

\bigskip
The notation $f(x)=u$ and other notations simplify the writing: it is a shift from function to dependent variable -- which are similar concepts.
}
When two different functions are involved, it is common practice to write $f(x)=u$ and $g(x)=v$ then $\Delta f(x)=\Delta u$ and $\Delta g(x)=\Delta v$.

Consider the product $u\cdot v$ and its variation (a product $a\cdot b$ can be interpreted as the area of a rectangle with sides $a$ and $b$).
 
When $x$ varies to $x+\Delta x$, $u$ varies to $u+\Delta u$ and $v$ varies to $v+\Delta v$.
 \begin{center}
 \begin{tikzpicture}
\draw(0,4)--node[left]{$v$}(0,0)--node[below]{$u$}(5,0)--(5,4)--(0,4);
\draw[dashed](5,0)--node[below]{$\Delta u$}(6,0)--(6,4.5)--(0,4.5)--node[left]{$\Delta v$}(0,4);
\draw[dashed](5,4.5)--(5,4)--(6,4);
\draw[latex-](5.5,2)--(7,3)node[right]{$v\cdot \Delta u$};
\draw[latex-](2.5,4.25)--(3,6)node[above]{$u\cdot\Delta v$};
\draw[latex-](5.5,4.25)--(7,6)node[above right]{$\Delta v\cdot \Delta u$};
\end{tikzpicture}
 \end{center}

Then $u\cdot v$ varies to $v\cdot u+v\cdot \Delta u+\Delta v\cdot u+\Delta v\cdot \Delta u$
hence 
\[\Delta (u\cdot v)=v\cdot \Delta u+\Delta v\cdot u+\Delta v\cdot \Delta u\]

\exo{
Divide the expression above by $\Delta x$ and justify that $\frac{\Delta u\cdot \Delta v}{\Delta x}\simeq 0$ to prove

\tproof{\[\frac{\Delta u\cdot \Delta v}{\Delta x}=\frac{\Delta u}{\Delta x}\cdot \Delta v\simeq u'\cdot\Delta v\] Since $\Delta v\simeq 0$ we have \[u'\cdot\Delta v\simeq 0\]}

\theorem{Let $u$ and $v$ be two differentiable functions, then
\[(u\cdot v)'=u'\cdot v+u\cdot v'\]
}

\tproof{\[\frac{\Delta (u\cdot v)}{\Delta x}= \frac{\Delta u}{\Delta x}\cdot v+u\cdot\frac{\Delta v}{\Delta x}+\frac{\Delta u}{\Delta x}\cdot \Delta v\simeq u'\cdot v+u\cdot v'\]}
}

This theorem can also be written:

\bigskip
Let $f$ and $g$ be two real functions differentiable at $a$. Then the function $f\cdot g$
is differentiable at $a$ and 
\[(f\cdot g)'(a)=f'(a)\cdot g(a)+f(a)\cdot g'(a). \] 



\exo{Using the derivatives of $f:x\mapsto x^2$ and $g:x\mapsto x^3$, calculate the derivative of $h:x\mapsto x^5$ \quad$(=x^2\cdot x^3)$.}



\exo{\label{power}Prove :

\theorem{
\[\left(x^n\right)'=n\cdot x^{n-1}\]}
by induction.}

\section*{Induction}

If
\begin{enumerate}
\item The property holds for $n=0$ (or $n=1$),
\item Assuming the property holds for $n$ greater than 0 (or 1), we can prove that it also holds for $n+1$,
\end{enumerate}
then the property holds for all $n$.

A proof that this method of proof is valid can be given by contradiction. Assume (1) and (2) have been checked but that there is a value $m$ such that the property does not hold for $m$. Then $m>1$ since that has been proven to be true. Let $n$ be the smallest number such that the property does not hold. (This number is not zero because of (1).) Then the property holds for $n-1$. But by (2), this proves that the property holds for $n$: a contradiction. So there can be no number for which the property does not hold.




\exo{Similar to exercise \ref{area1}: Calculate the area between $y=5x^4-3x^3+2x^2-10$ and the $x$-axis from $x=-1$
to $x=1$.
}

\exo{Sketch the curve of $f:x\mapsto x^2$ and $g:x\mapsto x^3$.
 Calculate the points where $f(x)=g(x)$ 

Calculate the closed geometric area of the surface between the two curves.
}

\section*{Circular functions}

\tproof{The idea to present derivatives of circular functions this early is (1) because we can, (2) they will extensively be used in connection with the chain rule and (3) higher level goes definitely beyond polynomials.}

\exo{ Observe the following drawing where the angle $\beta$ has been
drawn on top of the angle $\alpha$. 

\begin{enumerate}
\item Explain why the angle right at the top is equal to $\alpha$
\item Express the lengths of $a$, $b$ and $c$ in terms of $\sin(\alpha), \cos(\alpha), \sin(\beta)$ and $\cos(\beta)$.
\end{enumerate}


\begin{center}
\begin{tikzpicture}[scale=0.75]
% Local definitions 
\def\costhirty{0.8660256} 
\def\costhirtysix{0.8660256*6}
\draw [] (6,0) arc (0:90:6cm) node[midway]{}; 
\draw [] (1.5,0) arc (0:30:1.5cm);
\draw [] (0.8660256,0.5) arc (30:60:1cm);
% \pgfsetarrowsend{latex}
\draw[->] (-.5,0) -- (7.5,0) node[right] {$x$} coordinate(x axis); 
\draw[->] (0,-.5) -- (0,7.5) node[above] {$y$} coordinate(y axis); 
\pgfsetarrowsend{}
\draw (1.5,0.4) node[above, right] {$\alpha $} ; 
\draw (0.5,1.1) node[above, right] {$\beta$} ;  
\draw (0,0) -- (3.0,5.19615) ;
\draw (3.35,4.3) node[below] {$\alpha$} ;  
\draw (0,0) -- (5.19615,3.0) ;
% \draw (5.19615,3.2) node[above, right] {$B$} ; 
\draw [dashed](5.19615,0) -- (5.19615,3.0);
 \draw [dashed](3,0) -- (3.0,5.19615);
\draw [dashed](0,5.19615) -- (3,5.19615);
\draw (3,5.1) --(4.4,2.5);
\draw[dashed](0,2.5)--(3,2.5)--(4.4,2.5)--(4.4,0);
\draw (5.7,-0.5) node[right] {$1$};
\draw (-0.7,-0.5) node[right] {$0$};
\draw(4.25,2.8)--(4.5,2.95)--(4.64,2.7);
%\draw(0,0)grid(5,5);
\draw(3.75,0)node[below]{$a$};
\draw(0,4)node[left]{$b$};
\draw(0,1)node[left]{$c$};
\end{tikzpicture} 
\end{center}
}

\exo{Finish the proof of

\theorem{\label{trig}
$$\sin(\alpha+\beta)=\sin(\alpha)\cos(\beta)+\cos(\alpha)\sin(\beta)$$
$$\cos(\alpha+\beta)=\cos(\alpha)\cos(\beta)-\sin(\alpha)\sin(\beta)$$
}
}

\exo{Use the definition of the derivative and theorem \ref{trig} to expand $\Delta \sin(a)$}

\exo{
To continue, you will need to prove theorem \ref{sinx}:

\theorem{\label{sinx}\[\frac{\sin(\Delta\theta)}{\Delta\theta}\simeq 1.\]}


Suppose first that $\theta > 0$ is in the first quadrant.

\begin{center}
\begin{tikzpicture}
 \draw(1,0) arc (0:20:0.6);
\draw(5,0) arc (0:20:3cm);
\draw(5,0)--(0,0)node[midway,below]{$\cos(\theta)$}--(4.83,1.02)--(4.83,0)node[midway,left]{$\sin(\theta)$};
\draw (1.5,0.15)node{$\theta$}; 
\draw(5,0)--(5,1.056)node[midway,right]{$\tan(\theta)$}--(4.83,1.02);
\end{tikzpicture}
\end{center}

Comparing the area of the sector with that of the inside
and outside triangles, we obtain
\begin{center}
inside triangle $\leq$ sector $\leq$ outside triangle.
\end{center}
Rewrite this chain of inequalities replacing the areas by the corresponding formulae.

By using $-\theta$ if $\theta$ is negative, we see that the same
inequalities are true for negative $\theta$ (in the fourth
quadrant).

Let $\theta$ be ultrasmall.  By continuity, $\cos(\theta)\simeq 1$. Then conclude the proof of the theorem.
}

\exo{Show that \[\frac{1-\cos(\Delta\theta)}{\Delta\theta}\simeq 0.\]

Hint: multiply above and below by $(1+\cos(\Delta\theta))$
}

\exo{Using theorem \ref{sinx} and previous exercise, find the derivative of $\sin(x)$ and of $\cos(x)$.}



These results are summarised here:

\theorem{\label{trigdiff}
\begin{enumerate}
\item $\sin'(\theta)=\cos(\theta)$
\item $\cos'(\theta)=-\sin(\theta)$

\end{enumerate}}


%==================================================

\exo{Let $c$ be a constant, considered as a constant function. What is $\Delta c$? and use this to conclude that
\theorem{\label{derconstant}Let $c$ be a constant. Then \[c'=0\]}}

This theorem can also be written:

\bigskip

Let $c\in\mathbb{R}$ and $f: x \mapsto c$, for $x \in \mathbb{R}$
\[f'(x)=0. \]

\bigskip
Consider the product $c\cdot u$ for constant $c$ and differentiable function $u$, then when $x$ varies to $x+\Delta x$ the product $c\cdot u$ varies $to c\cdot u$ to $c\cdot u+c\cdot\Delta u$, hence 
\[\Delta (c\cdot u)=c\cdot \Delta u\]
\begin{center}
\begin{tikzpicture}
\draw(0,4)--node[left]{$c$}(0,0)--node[below]{$u$}(5,0)--(5,4)--(0,4);
\draw[dashed](5,0)--node[below]{$\Delta u$}(6,0)--(6,4)--(5,4);
\draw[latex-](5.5,2)--(7,3)node[right]{$c\cdot \Delta u$};
\end{tikzpicture}
\end{center}

\exo{Divide the expression above by $\Delta x$ to prove
\theorem{\label{cf}Let $c$ be a constant and $u$ a differentiable function. Then 
\[(c\cdot u)'=c\cdot u'\]}

\tproof{\[\frac{c\cdot\Delta u}{\Delta x}=c\cdot\frac{\Delta u}{\Delta x}\simeq c\cdot u'\]}
}


This theorem can also be written:

\bigskip
Let $c\in\mathbb{R}$ and  $f$ be a real function differentiable at $a$. Then the function $c \cdot f$ is differentiable at $a$ and
\[ (c \cdot f)'(a)=c \cdot f'(a).\]




%The following theorem expresses a property for \underline{all} natural numbers:
%\theorem{\label{power}
%\[\left(x^n\right)'=n\cdot x^{n-1}.\]
%}
%
%It is of course impossible to prove all cases. We prove by \underline{induction}.
%
%If
%\begin{enumerate}
%\item The property holds for $n=0$ (or $n=1$),
%\item Assuming the property holds for $n$ greater than 0 (or 1), we can prove that it also holds for $n+1$,
%\end{enumerate}
%then the property holds for all $n$.
%
%A proof that this method of proof is valid can be given by contradiction. Assume (1) and (2) have been checked but that there is a value $m$ such that the property does not hold for $m$. Then $m>1$ since that has been proven to be true. Let $n$ be the smallest number such that the property does not hold. (This number is not zero because of (1).) Then the property holds for $n-1$. But by (2), this proves that the property holds for $n$: a contradiction. So there can be no number for which the property does not hold.
%
%

A function such as $\ds f:x\mapsto (x^3+2x)^4 $ can be decomposed as a composition of $f_1:x\mapsto x^3+2x$ and $f_2:x\mapsto x^4$. Then $f=f_2\circ f_1$.


\subsection*{Sum and Difference}

Consider the sum. When $x$ varies to $x+\Delta x$, $u$ varies to $u+\Delta u$ and $v$ varies to $v+\Delta v$.

\medskip
\begin{center}
\begin{tikzpicture}
\draw(0,0)--node[below]{$u$}(3,0)--(3,0);
\draw[dashed](3,0)--node[below]{$\Delta u$}(3.5,0);
\draw(3.5,0)--node[below]{$v$}(5,0);
\draw[dashed](5,0)--node[below]{$\Delta v$}(5.5,0);
\draw(3,-0.1)--(3,0.1);
\draw(3.5,-0.1)--(3.5,0.1);
\draw(5,-0.1)--(5,0.1);
\draw(5.5,-0.1)--(5.5,0.1);
\end{tikzpicture}
\end{center}
Then \[\Delta (u+v)=\Delta u+\Delta v\]



\exo{
Divide the expression above to prove:

\theorem{\label{sum}Let $u$ and $v$ be differentiable functions. Then
\[(u+v)'=u'+v'\]}


\tproof{\[\frac{\Delta u+ \Delta v}{\Delta x}\simeq u'+v'\]}
}


This theorem can also be written:

\bigskip
Let $f$ and $g$ be real functions differentiable at $a$.
Then the function $f+g$ is differentiable at $a$ and
\[(f+g)'(a)=f'(a)+g'(a).\]






\exo{Find the derivatives of $h:x\mapsto x^3+x^2$ and $k:x\mapsto 5x^3-7x^2$.}




\subsection*{Composition}

\Theorem{Chain Rulle}{\label{Tchain}Let $u$ by a differentiable function of $v$ and $v$ a differentiable  function of $x$. Then
\[\left(u\circ v\right)'=u'\cdot v'\]}

\exo{Prove the chain rule.}

\tproof{
If $u'$ exists, we have (as usual) \[u'\simeq \frac{\Delta u}{\Delta x}\]
where  $u$ depends on $v$

If $\Delta v\neq 0$, then
\[u'\simeq \frac{\Delta u}{\Delta x}=\frac{\Delta u}{\Delta v}\cdot\frac{\Delta v}{\Delta x}\simeq u'\cdot v'\]

}

\exo{Prove that this formula holds also if $\Delta v=0$.}

\tproof{If $\Delta v=0$ then $v'=0$, so $f'(v)\cdot v'=0$. But since $v$ has no variation, $u$ has no variation, so $u'=0$ and the result also holds.}

This theorem can also be written:

\bigskip
Let $f$ and $g$ be real functions such that $g$
is differentiable at $a$ and $f$ is differentiable at $g(a)$. The the function $f\circ g$ is differentiable at $a$ and
$$(f\circ g)'(a)=f'(g(a))\cdot g'(a).$$ 




\exo{Give the derivatives of the following functions:


\begin{enumerate}
 \item $\ds f:x\mapsto (x^3+2x)^4 $
\item $\ds g:x\mapsto (5x^3+3x^2)^{13}$
\end{enumerate}
}

\exo{
Use $(\sqrt{x})^2=x$ and theorem \ref{Tchain} to find the
derivative of $y=\sqrt{x}$ (for $x>0$) -- assuming it exists.
}


\exo{Give the derivatives of the following functions:


\begin{enumerate}
 \item $\ds f:x\mapsto (\sqrt{x}+1)^4 $
\item $\ds g:x\mapsto \sqrt{5x^3+3x^2}$
\item $\ds h:x\mapsto \sqrt{x^2}$
\end{enumerate}
}

\exo{
Find the derivatives of the following:

\begin{multicols}{2}
\begin{enumerate}
\item $y=\sqrt{3x^3+2x+1}$
\item $y=(x^2+3)^5$
\item $y=(ax+b)^n$
\item $y=\sqrt{x^3+1}$
\end{enumerate}
\end{multicols}
}

\exo{Use the definition of the derivative to find $f'(x)$ for $f:x\mapsto \frac{1}{x}$}

\exo{Use the previous exercise and the chain rule to find the derivative of $\frac{1}{f(x)}$ assuming $f(x)\neq 0$ and $f'(x)$ exists.}

\tproof{Write $f(x)=u$. Since $\left(\frac{1}{x}\right)'=-\frac{1}{x^2}$ (by previous exercise) we have $\left(\frac{1}{u}\right)'=-\frac{u'}{u^2}$}

\subsection*{Quotient}
\exo{
Use all previous results to prove:

\theorem{Let $u$ and $v$ be differentiable functions with $v\neq 0$, then

\[\left(\frac{u}{v}\right)'=\frac{u'\cdot v-u\cdot v'}{v^2}\]
}

\tproof{$\frac{u}{v}=u\cdot\frac{1}{v}$ hence 
\[\left(\frac{u}{v}\right)'=u'\cdot\frac{1}{v}-u\cdot\frac{v'}{v^2}=\frac{u'\cdot v-u\cdot v'}{v^2}\]

\textit{This proof is nice because it uses the chain rule and therefore stresses its importance.}

\bigskip
Or more classical:

\[\Delta\left(\frac{u}{v}\right)=\frac{u+\Delta u}{v+\Delta v}-\frac{u}{v}=\frac{\Delta u\cdot v-u\cdot \Delta v}{v^2+v\cdot\Delta v}\]

\[\frac{\Delta\left(\frac{u}{v}\right)}{\Delta x}=\frac{\dfrac{\Delta u}{\Delta x}\cdot v-u\cdot \dfrac{\Delta v}{\Delta x}}{v^2+v\cdot\Delta v}\simeq \frac{u'\cdot v-u\cdot v'}{v^2}\]
}

Also written:

\bigskip
Let $f$ and $g$ be two real functions differentiable at $a$ and $g(a)\not= 0$. Then the function $\ds\frac{f}{g}$ is differentiable at  $a$ and
\[\left(\frac{f}{g}\right)'(a)=\frac{f'(a)\cdot g(a)-f(a)\cdot g'(a)}{g^2(a)}. \] }




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



\exo{Calculate $\tan'(x)$ using $\tan(x)=\dfrac{\sin(x)}{\cos(x)}$.}

\exo{
Find the slope of $\ds f:x\mapsto \frac{x^2-2x+1}{x^3+x^2}$ at $x=1$.}

\exo{
Show that for $m\in\mathbb{Z}$
\[\left(x^m\right)'=m\cdot x^{m-1}. \]}

\exo{
Given that the gravitational force between two masses is $\ds
F=G\frac{m_1\cdot m_2}{d^2}$ (where $d$ is the distance between the
two masses and $G$ the universal constant of gravitation), what is the
force between objects $A$ and $B$ in the following situation? (For
simplicity, the linear mass will be considered to have no width and
the other will be considered reduced to a point.)


\begin{center}
%\includegraphics[width=8cm]{images/bar}
\begin{tikzpicture}%(200,30)(0,0)
\draw(9,1.3)node{$A$ 6kg};
\draw[ultra thick](0,1) -- (6,1);
\draw(9,1) circle (0.08);
\draw[<-] (6,0.4) -- (7,0.4)node[right]{3m};
\draw[->] (8,0.4) -- (9,0.4);
\draw[<-] (0,0.4)--(2.5,0.4)node[right]{6m};
\draw[->](3.5,0.4)--(6,0.4);
\draw(3,1.3)node{$B$ 18kg};
\end{tikzpicture} 
\end{center}
}





\Pract{deriv2}{
 Differentiate the following for general $x$:
\begin{multicols}{2}
\begin{enumerate}
\item $\ds f:x\mapsto 5x^4+x^3-2x^2+25$
\item $\ds g:x\mapsto 5\sqrt{3}\ x^2-100$
\item $\ds h:x\mapsto \frac{x^2+2x-1}{x^3-5}$
\item $\ds j:x\mapsto 5x^4+\frac{1}{3x^2 -2x+\pi}$
\item $\ds k:x\mapsto (5x+2)\cdot \frac{1}{5x+2}$
\item $\ds l:x\mapsto \frac{1}{x}+\frac{1}{x^2}+\frac{1}{x^3}+\frac{1}{x^4}$
\item $\ds m:x\mapsto \frac{1+x}{1+\frac{1+x}{x^2}}$
\end{enumerate}
\end{multicols}}

\Pract{deriv3}{
Sketch the curve of $y=-(x-3)(x+1)(x-1)$.
}

\Pract{deriv4}{
Let $y=\dfrac{10x}{x^2+1}$. Sketch the curve and give the equation of the  line tangent to the curve at $x=3$.
}

\Pract{deriv5}{
Consider each of the following as a function $f$, find the corresponding derivative function $f'$.
\begin{multicols}{2}
\begin{enumerate}
 \item \quad $x^3+x^2+2x-4$
\item \quad $-x^3+2x^2-2x+1$
\item \quad $\frac{1}{3}x^3-\frac{5}{2}x^2+6x$
\item \quad $\frac{1}{3}(x-2)^3$
\item \quad $\dfrac{x^2}{x+2}$
\item \quad $x-1+\dfrac{9}{x+1}$
\item \quad $\dfrac{4x^2+4x+5}{4x+2}$
\item \quad $\dfrac{-x^2-2x-1}{x+3}$
\item \quad $|x-2|$
\item \quad $\dfrac{x^2}{|x|+2}$
\item \quad $x+2-\dfrac{1}{x+1}$
\item \quad $|x^3-6x^2+11x-6|$
\end{enumerate}
\end{multicols}
}

\exo{Find the derivative of the following functions. Since they are piecewise defined, the answer will be in 3 parts -- one special point is the meeting point for both rules.

\begin{enumerate}
\item \[f:x\mapsto 
\begin{cases}
x^2 & \text{ if } x\geq 1
\\
2x-1 & \text{ if } x<1
\end{cases}\]
\item \[g:x\mapsto 
\begin{cases}
x^2 & \text{ if } x>2
\\
x+2 & \text{ if } x \leq 2
\end{cases}\]
\item \[h:x\mapsto 
\begin{cases}
x^2 & \text{ if } x\geq 3
\\
2x & \text{ if } x<3
\end{cases}\]
\end{enumerate}

}
%ZZZ


\Pract{deriv6}{
Find the derivatives of the following:

\begin{multicols}{2}
\begin{enumerate}
\item $\ds f_1:x\mapsto\sqrt{3x^3+2x+1}$
\item $\ds f_2:x\mapsto(x^2+3)^5$
\item $\ds f_3:x\mapsto(ax+b)^n$
\item $\ds f_4:x\mapsto\sqrt{x^3+1}$
 \item $\ds f_5:x\mapsto\sin(x^2+3x)$
\item $\ds f_6:\theta\mapsto \cos^2(3\theta)$
\item $\ds f_7:u\mapsto \sin(\sin(u))$
\item $\ds f_8:x\mapsto \tan^2(\tan^2(x^2))$
\item $\ds f_9:v\mapsto \frac{\sin(v)}{\tan(v)}$
\item $\ds f_{10}:x\mapsto \sin^2(x)+\cos^2(x)$
\end{enumerate}
\end{multicols}
}

%%%%%XXXX
\section*{The differential}

It is traditional to ue $dx$ for ultrasmall $\Delta x$.

\definition{Let $f$ be a real function differentiable on an interval around $a$.
Let $\Delta x$ be ultrasmall. The \textbf{differential of $f$ at $a$}, written
$df(a)$, is

\[df(a) = f'(a) \cdot dx.\] }\index{differential}

\caution While we write $dx =\Delta x$, we cannot write $dy=\Delta y$. We have
$\Delta y=y'+\varepsilon\cdot dx$.



Thus  \[\dfrac{df(a)}{dx} = f'(a)\] or still (if we use $y = f(a)$) \[\dfrac{dy}{dx} = y'\] .

If $f$ is differentiable the following holds:

\[\frac{\Delta f(a)}{\Delta x}\simeq\frac{df(a)}{dx}\]

% \[\Delta f(a)=df(a)+\varepsilon\cdot dx \qquad\text{ with }\varepsilon\simeq 0.\]


Whereas $\Delta f(a)$ is the variation of the function, the differential $df(a)$ is the variation along the tangent line.

\begin{center}
\begin{tikzpicture}[scale=2]
\clip(0,-1) rectangle (6,2);
\draw [line width=1.2pt] [smooth,samples=100,domain=1:4.5] %plot(\x,{0.1*\x^3});
plot(\x,{0.01*(\x+1.1)^4});
\draw [domain=1:4.5] plot(\x,{(--0.82-0.68*\x)/-0.6});
\draw [dash pattern=on 1pt off 1pt] (1,0.9)-- (3.3,0.9)node[right] {$f(a)$};
\draw [dash pattern=on 1pt off 1pt] (2.,0.9)-- (2,0)node[below]{$a$};
\draw [dash pattern=on 1pt off 1pt] (2.45,0.2)node[below] {$a+dx$}-- (2.45,1.56);
\draw [dash pattern=on 1pt off 1pt] (1,1.56)-- (3.1,1.56)node[right]{$f(a+dx)$};
\draw [dash pattern=on 1pt off 1pt] (1.7,1.4)-- (4,1.4)node[right]{$f(a)+f'(a)\cdot dx$};
\draw [dashed,latex-latex] (1.7,0.88)--(1.7,1.4);
\draw (1.72,1.15)node[left]{$df(a)$};
\draw  [dashed,latex-latex] (1,0.9)--(1,1.56);
\draw (1,1.2) node[left]{$\Delta f(a)$};
\end{tikzpicture}
\end{center}



Let $f$ be a function. Recall that the inverse function of $f$, if it exists, is written $f^{-1}$ and is such that $f^{-1}(f(x))=x$ amd if we write $f(x)=y$ then we also have $f(f^{-1}(y))=y$.

\medskip
\caution $f^{-1}(x)$ is \underline{not} $\dfrac{1}{f(x)}$.

\medskip
A function has an inverse if the image of its curve by a symmetry through the $y=x$ axis is the curve of a function.

\begin{center}
%  \includegraphics[width=10cm]{images/inverse}
\begin{tikzpicture}[scale=3.5]
\clip(-0.2,-0.2) rectangle (1.65,1);
\draw [rotate around={5.74:(-1.27,1.49)},line width=1.2pt] (-1.27,1.49) ellipse (3.61cm and 1.4cm);
\draw [domain=-0.1:1.5] plot(\x,{(-0-0*\x)/-2.15});
\draw (1.6,0.7) node[left]{$f$};
\draw (0,-0.1) -- (0,1);
\draw [dashed](0,0.42)node[left]{$y$}--(0.51,0.42)-- (0.51,0)node[below]{$x$};
\draw [dashed](0,0.72)--(1.29,0.72)-- (1.29,0);
\draw [dashed,latex-latex](0.51,0.42)--node[below]{$\Delta x$}(1.29,0.42);
\draw[dashed,latex-latex] (0.5,0.42)--node[left]{$\Delta y$}(0.5,0.72);
\end{tikzpicture}
\hspace{2cm}
 \definecolor{ffffff}{rgb}{1,1,1}
\begin{tikzpicture}[scale=3.5]
\clip(-0.2,-0.25) rectangle (1,1.5);
\draw [rotate around={5.74:(-1.27,1.49)},color=ffffff] (-1.27,1.49) ellipse (3.61cm and 1.4cm);
\draw [color=ffffff,domain=-0.1:1] plot(\x,{(-0--1.4*\x)/1.4});
\draw [rotate around={84.26:(1.49,-1.27)},line width=1.2pt] (1.49,-1.27) ellipse (3.61cm and 1.4cm);
\draw [domain=-0.1:1] plot(\x,{(-0-0*\x)/-2.15});
\draw (0.9,1.4)node{$f^{-1}$};
\draw (0,-0.1) -- (0,1.5);
\draw [dashed](0,0.51)--(0.42,0.51)--(0.42,0)node[below]{$y$};
 \draw [dashed,latex-latex](0.42,0.51)-- node[below]{$\Delta y$}(0.72,0.51);
\draw[dashed,latex-latex](0.42,0.51)--node[left]{$\Delta x$}(0.42,1.29);
\draw [dashed](0,1.29)node[left]{$x$}--(0.72,1.29)-- (0.72,0);
\end{tikzpicture}
\end{center}

\Theorem{Derivative of the Inverse\label{Tinverse}}{ If $f:I\to J$ is a
function, differentiable on $I$ and has an inverse $f^{-1}$, and $f'(a)\neq 0$ then this inverse is differentiable at $b=f(a)\in J$ and
\[\frac{df^{-1}(b)}{dy}=\frac{1}{f'(a)}.\]
}

This can also be written:
\[\frac{dx}{dy}=\frac{1}{y'}\]

You may also use the following drawing to observe that the slope of the tangent of the inverse is the reciprocal of the slope of the original tangent.

\tproof{Consider $y$ and $x$ be two variables with $y=f(x)$ and $x=f^{-1}(y)$

The the derivative of the inverse is \[\frac{df^{-1}(y)}{dy}=\frac{dx}{dy}=\frac{1}{\frac{dy}{dx}}=\frac{1}{y'}=\frac{1}{f'(x)}\]
}

\begin{center}
% \includegraphics[width=10cm]{images/tanginverse}
\begin{tikzpicture}[scale=3.5]
\clip(-0.1,-0.1) rectangle (1.5,1);
\draw [rotate around={5.74:(-1.27,1.49)},line width=1.2pt] (-1.27,1.49) ellipse (3.61cm and 1.4cm);
\draw [domain=-0.1:1.5] plot(\x,{(-0-0*\x)/-2.15});
\draw(1.4,0.9)node{$f$};
\draw (0,-0.1) -- (0,1);
\draw [dashed] (0,0.42)node[left]{$y$}-- (0.51,0.42);
\draw [dashed] (0.51,0.42)-- (0.51,0)node[below]{$x$};
% \draw [dotted] (0,0.72)-- (1.29,0.72);
\draw [dashed] (1.29,0.72)-- (1.29,0);
\draw [domain=-0.1:1.5] plot(\x,{(--0.25--0.29*\x)/0.94});
\draw [latex-latex,dashed] (0.51,0.19) --node[below]{$dx$} (1.29,0.19);
\draw [dashed] (1.29,0.66)-- (0,0.66);
\draw [latex-latex,dashed] (0.21,0.66) --node[left]{$dy$} (0.21,0.42);
\end{tikzpicture}
\hspace{2cm}
\begin{tikzpicture}[scale=3.5]
\clip(-0.1,-0.15) rectangle (1,1.5);
\draw [rotate around={84.26:(1.49,-1.27)},line width=1.2pt] (1.49,-1.27) ellipse (3.61cm and 1.4cm);
\draw [domain=-0.1:1] plot(\x,{(-0-0*\x)/-2.15});
\draw(0.9,1.4)node{$f^{-1}$};
\draw (0,-0.1) -- (0,1.5);
\draw [dashed] (0.42,0.51)-- (0,0.51)node[left]{$x$};
\draw [dashed] (0.42,0.51)-- (0.42,0)node[below]{$y$};
% \draw [dotted] (0.72,1.29)-- (0.72,0);
\draw [dashed] (0.72,1.29)-- (0,1.29) ;
\draw [domain=-0.1:1] plot(\x,{(--0.25-0.94*\x)/-0.29});
\draw [latex-latex,dashed] (0.28,1.29)--node[left]{$dx$} (0.28,0.51);
\draw [dashed] (0.66,1.29)-- (0.66,0);
\draw [latex-latex,dashed] (0.42,0.28) -- node[below]{$dy$}(0.66,0.28);
\end{tikzpicture}
\end{center}




\exo{
Find the derivative of $\ds y=x^{\frac{1}{n}}$.
}

\exo{Find the derivative of $\ds y=x^{\frac{m}{n}}$.}

This shows that the rule in exercise \ref{power} holds also for rational $n$.


\exo{
Use $\mid x\mid=\sqrt{x^2}$ to find an expression for the
derivative of $\mid x \mid$.
}


%==================

\exo{\textbf{Difficult exercise!}

Let $h$ be ultrasmall relative to 1.

$$H:x\mapsto
\begin{cases}
0 &\text{ if $x\leq -h$}\\
\frac{1}{2h}\left(x+h\right)& \text{ if $-h<x<h$}\\
1 &\text{ if $x\geq h$}
\end{cases}$$
\begin{enumerate}
\item What is the context of the function?
\item Calculate $H'(x)$.
\item Sketch $H$, first with horizontal scale $[-2;2]$ and vertical scale $[0;1]$ then, for same vertical scale, take a horizontal scale $[-2\cdot h;2\cdot h]$.
\end{enumerate}
}






\exo{For the inverse functions, it is convenient to use the differential.

Prove the following theorem:

Hint: Suppose that $\arcsin(x)=y$ i.e., $\sin(y)=x$. Then $\arcsin'(x)=\frac{dy}{dx}=\frac{dy}{d\sin(x)}$.

\theorem{\begin{enumerate}
\item
$\arcsin'(x)=\dfrac{1}{\sqrt{1-x^2}}$
\item
$\arccos'(x)=-\dfrac{1}{\sqrt{1-x^2}}$
\item
$\arctan'(x)=\dfrac{1}{1+x^2}$
\end{enumerate}}
}


\exo{
Let $\varepsilon$ be ultrasmall relative to 1. Consider the function
\[\ds H:x\mapsto
\frac{1}{2}+\frac{1}{\pi}\cdot\arctan\left(\frac{x}{\varepsilon}\right).\]

Calculate the value of $H$ at nonzero observable values, at zero.

Calculate $H'(x)$ and sketch the curves of $H$ and $H'$.

Calculate the value of $H'$ at nonzero observable values, at zero.

}

\tproof{\textit{this function is a nontandard continuous function which approximates a discontinuous function. the Heaviside function.}

$H(0)=\frac{1}{2}+\frac{1}{\pi}\arctan(0)=\frac{1}{2}$

For observable $a>0$,  $H(a)=\frac{1}{2}+\frac{1}{\pi}\arctan(a/\varepsilon)$. Since $a/\varepsilon$ is ultralarge and positive, we have $\arctan(a/\varepsilon)\simeq\frac{\pi}{2}$ hence $H(a)\simeq 1$.

For observable $a<0$,  $H(a)=\frac{1}{2}+\frac{1}{\pi}\arctan(a/\varepsilon)$. Since $a/\varepsilon$ is ultralarge and negative, we have $\arctan(a/\varepsilon)\simeq-\frac{\pi}{2}$ hence $H(a)\simeq 0$.

\[H'(x)=\frac{1}{\pi}\cdot\frac{1}{1+(\frac{x}{\varepsilon})^2}\cdot\frac{1}{\varepsilon}=\frac{1}{\pi}\cdot \frac{\varepsilon}{\varepsilon^2+x^2}\]

At observable $a\neq 0$ we have $H'(a)=\frac{\varepsilon}{\varepsilon^2+x^2}\simeq 0$

At $a=0$, we have $H'(0)=\frac{1}{\pi\varepsilon}$ which is ultralarge.

At standard context it looks like something which is not a function.

\begin{center}
\begin{tikzpicture}
\draw[-latex](-5,0)--(5,0);
\draw[-latex](0,-1.5)--(0,1.5);
\draw[thick](-5,0)--(0,0)--(0,1)--(5,1);
\end{tikzpicture}
\end{center}

But if we zoom horizontally: we see a continuous function which is ultrasteep at zero.

\begin{center}
\begin{tikzpicture}
\draw[-latex] (-5,0) -- (5,0) node[right] {$x$} ; 
\draw[-latex] (0,-0.2) -- (0,1.5) node[above] {$y$} ; 	
\draw[thick] plot[raw gnuplot] function{plot[x=-5:5](0.5+1/pi*atan(x))} ;
\draw(-1,0)--(-1,-0.2)node[below]{-$\varepsilon$};
\draw(1,0)--(1,-0.2)node[below]{$\varepsilon$};
\draw(0,1)--(0.2,1)node[right]{$1$};
\end{tikzpicture}
\end{center}
}


\exo{
\begin{enumerate}
\item
Show that $x\mapsto\cos\left(\frac{1}{x}\right)$ cannot be extended continuously at $x = 0$.

\item
Show that
\[
x\mapsto
\begin{cases} x^2\cdot\sin\left(\frac{1}{x}\right) &\text{ if }
x\neq 0
\\ 0 &\text{ if } x=0
 \end{cases}
 \]
is differentiable for all $x \in \mathbb{R}$ but that its derivative
$x \mapsto g'(x)$ is not continuous at $0$.
\end{enumerate}}



\exo{

 Compute the derivatives of the following:
\begin{enumerate}
	\item $f:x\mapsto\sin^2(3x+\pi)$
	\item $g:x\mapsto x \cdot \sin(x^2+1)$
	\item $\ds h:x\mapsto\sin^2\left(\frac{x}{x^2+1}\right)+\cos^2\left(\frac{x}{x^2+1}\right)$
	\item $j:x\mapsto 1+\tan^2(x)$
	\end{enumerate}
}

\exo{
\begin{enumerate}
\item Show that $f:x\mapsto\sin^6(x)+\cos^6(x)+3\sin^2(x)\cos^2(x)$ is a
constant function. 

(Hint: use the derivative\dots)
\item At what values does $f:x\mapsto\sin(x)+\cos(x)$ have stationary
points?
\item What is the equation of the straight line tangent to $y=\sin^2(x)$
at $x=\frac{\pi}{4}$?

\end{enumerate}
}



\chapter{Asymptotes}


\exo{Consider the function $f:x\mapsto \frac{1}{x}$.

\begin{center}
% \includegraphics[width=5cm]{images/unsurx}
\begin{tikzpicture}[scale=0.2]
%  \draw[step= 1cm , color=gray,very thin] (-10,-10) grid (10,10);
\pgfsetlinewidth{1pt};
\draw[->,thin] (-10,0)--(10,0)node[below]{$x$};
\draw[->,thin](0,-10)--(0,10)node[right]{$y$};
\draw[thick]  plot[raw gnuplot] function{plot [-10:-0.1]1/ x};
\draw[thick]  plot[raw gnuplot] function{plot [0.1:10] 1/x};
\end{tikzpicture}
\end{center}

\begin{enumerate}
 \item What is the domain of this function? Specify the context.

\item What happens to the curve close to the vertical axis i.e., for values of $x$ close to 0? Consider  ultrasmall values of $x$. 

\item What happens to the curve close to the horizontal axis? i.e., for very large values of $x$? Consider ultralarge values of $x$ (positive or negative).

\item Draw this function for a horizontal range of $[-100;100]$ and a vertical range of $[-100;100]$.
\item Does $f$ have a limit at 0? 
\end{enumerate}}




\bigskip
Informally: 
For a given function $f$, a straight line is \textbf{an asymptote} of the function $f$ if it is ultraclose to the function when either 
\begin{itemize}
\item $x$ tends to $\pm\infty$ (horizontal or oblique asymptote).
\item $y$ (or $f(x)$) tends to $\pm\infty$ (vertical asymptote).
\end{itemize}


\definition{
A real function \textbf{ $f$ has a vertical asymptote at $x=a$} if   $f(x)$ is positive or negative ultralarge for $x\simeq a$, $x$ being less than $a$ or $x$ being greater than $a$. 

If it is the case for $x$ greater than $a$, we write

\[x\simeq a_+ \Rightarrow f(x)\text{ is ultralarge}\]
or
\[\lim_{x\to a_+}f(x)=\pm\infty\]
If it is the case for $x$ less than $a$, we write

\[x\simeq a_- \Rightarrow f(x)\text{ is ultralarge}\]
or
\[\lim_{x\to a_-}f(x) =\pm\infty\]
}\index{asymptote}



\example{The function $f : x \mapsto 1/x$ has a vertical asymptote at 0. The only parameter of the function is 1, always observable. If $dx$ is a positive ultrasmall number then $f(dx)$ is positive ultralarge. Hence 
\[\frac{1}{dx}\text{ is ultralarge}\]
}



We also extend properties of limits to cases where $x$ is positive ultralarge or negative ultralarge, written
$x\to+\infty$ or $x\to-\infty$



\definition{A real function $f$  defined on an interval of the form  $[b,+\infty[$ or $]-\infty, b]$ has a \textbf{horizontal asymptote at $+\infty$} (resp. $-\infty$) if there is an observable number $L$  such that
\[x\to \infty\Rightarrow f(x)\simeq L.\]
(the same holds for $-\infty$)
}

A context is  $f$ and $b$, but it is always possible to consider an observable $b$ relative to $f$ hence a context is given by $f$, and $x$ is ultralarge relative to that context.
When this situation occurs, we say that $L$ is the limit of $f$ at plus infinity (resp. minus infinity), or that the limit of $f$ is $L$ when $x$ tends to infinity.

\bigskip
We write that $f$ has  \textbf{a horizontal asymptote $y= L$} at plus infinity if
\[\lim_{x \rightarrow +\infty} f(x) = L.\]

(Similarly for negative infinity.)

\example{Consider the limit
\[
\lim_{x \rightarrow + \infty} \frac{x^2 - 3x +1}{x^2 +1}.
\]
This means: consider the fraction for an ultralarge value of $x$.


The function $\ds f: x \mapsto \frac{x^2 - 3x +1}{x^2 +1}$ is defined on  $\mathbb{R}$. $1,2$ and $3$ are always observable. Let $x$ be ultralarge. Then
\[
f(x) = \frac{2x^2 - 3x +1}{x^2 +1} = \frac{x^2(2 - \frac{3}{x} +
\frac{1}{x^2})}{x^2(1 + \frac{1}{x^2})} =\frac{2 - \overbrace{\frac{3}{x}}^{\simeq 0} +
\overbrace{\frac{1}{x^2}}^{\simeq 0}}{1 + \underbrace{\frac{1}{x^2}}_{\simeq 0}} \simeq\frac{2}{1}= 2,
\]
hence $f$ has a horizontal asymptote $y=2$ at $\pm \infty$.}

\bigskip
We now define the oblique asymptote

\definition{A real function $f$ has an \textbf{oblique asymptote at} $+ \infty$ (resp. $- \infty$)
if there exist observable numbers $a, b$ (context is  $f$) such that
\[
x \to +\infty\Rightarrow [f(x) - (ax+b)] \simeq 0 \quad (\text{resp. } x\to
 -\infty\Rightarrow [f(x) - (ax+b)] \simeq 0).
\]
The line $y= ax+b$ is the \textbf{oblique asymptote of $f$}  (at $\pm \infty$).}

The existence of an oblique asymptote is a property of $f$ hence the context is $f$.

\bigskip
This is equivalent to saying that $f(x)\simeq ax+b$ whenever $x$ is ultralarge.

\example{Consider
\[f : x \mapsto
\frac{x^3 + 2x^2 + x - 1}{x^2+1}\] defined on $\mathbb{R}$. Using long division we have

\[f(x) = x+2 - \frac{3}{x^2+1}. \]
Let $x$ be ultralarge.  We have
\[f(x) - (x+2) = \frac{-3}{x^2+1} \simeq 0,\]
because $x^2+1$ is ultralarge. Hence $f$ has an oblique asymptote at $y=x+2$ (at $\pm \infty$),
i.e.,  $a=1$ and $b=2$.}

\exo{
Find the asymptotes (if any) of

\begin{multicols}{2}
\begin{enumerate}
\item $\ds f:x\mapsto\frac{x}{2x^2+1}$
\item $\ds g:x\mapsto\frac{2x^2+1}{x}$
\item $\ds h:x\mapsto\frac{x^3+2}{2x^2-1}$
\item $\ds i:x\mapsto\frac{x^2+2x+1}{x+1}$
\item $\ds j:x\mapsto\frac{3x^3+2x^2-x+12}{x^2+8}$
\end{enumerate}
\end{multicols}
}

For functions which are not rational functions, where the polynomial long division does not apply, we have the following:

\theorem{Let $f$ be a real function and let $a$ and $b$ be observable (context is $f$). Then $f$ has an oblique asymptote at  $y= ax+b$ at $+\infty$ (resp. $-\infty$) if and only if
\[
\lim_{x \to +\infty} \frac{f(x)}{x} = a \quad \text{ and } \quad
\lim_{x \to +\infty} [f(x) - ax ] = b.
\]

 \[\text{(resp.}
\lim_{x \to -\infty} \frac{f(x)}{x} = a \quad \text{ and } \quad
\lim_{x \to -\infty} [f(x) - ax ] = b.
)\]
}

\textbf{Remark:} If $a=0$ the line  $y=ax+b$ becomes $y= b$ i.e., a horizontal asymptote.

\exo{Use the definition of limit to rewrite the previous theorem without any reference to limits.}

\exo{
Prove the previous theorem.
}

\tproof{Since the asymptote is a property of the function, the context is given by $f$ but not by $x$. 

If $f$ has an oblique asymptote $y=ax+b$ then for ultralarge $x$, we have $f(x)\simeq ax+b$. Divide by $x$: \[\frac{f(x)}{x}\simeq a+\underbrace{\frac{b}{x}}_{\simeq 0}\simeq a\]
and $f(x)-ax\simeq b$.

\bigskip
Conversely, assume that for ultralarge $x$, $\frac{f(x)}{x}\simeq a$ and $f(x)-ax\simeq b$, then it is immediate that for ultralarge $x$, $f(x)\simeq ax+b$.
}

\example{Consider $f: x \mapsto \sqrt{x^2+1}$ defined on $\mathbb{R}$. Let $x$ be positive ultralarge. Then
\[
\frac{f(x)}{x} = \frac{\sqrt{x^2+1}}{x} = \frac{\sqrt{x^2(1+1/x^2)}}{x}=\frac{|x|\overbrace{\sqrt{1+1/x^2}}^{\simeq 1}}{x} 
\simeq\begin{cases}1 &\text{ it } x>0
\\-1&\text{ if } x<0\end{cases}.
\]
Moreover:
\[
f(x) - x = \sqrt{x^2+1} - x = \frac{(\sqrt{x^2+1} - x) \cdot (
\sqrt{x^2+1} + x)}{\sqrt{x^2+1} + x} = \frac{1}{\sqrt{x^2+1} + x}
\simeq 0.
\]
Hence $f$ has an oblique asymptote at $y=x$ at $+\infty$. 

At $-\infty$ the function has an oblique asymptote at $y=-x$.}

\newpage
\exo{
Find the asymptotes at infinity (if any) of

\begin{multicols}{2}
\begin{enumerate}
\item $\ds f:x\mapsto\frac{\sin(x)}{x} $
\item $\ds g:x\mapsto\frac{x^2+\sin(x)}{x}$
\item $\ds h:x\mapsto\frac{x^2+\sin(x)}{\sqrt{x}}$
\item $\ds i:x\mapsto x^{\frac{3}{2}}$
\end{enumerate}
\end{multicols}
}

\exo{
Consider a rational function $$f(x) = \frac{p(x)}{q(x)}$$ where $p$ and $q$ are polynomials. Reminder: the order (or degree) of a polynomial function is the value of the highest exponent of the variable.

\begin{enumerate}
\item In which cases will there be a vertical asymptote?
 \item In which cases will be there be a horizontal asymptote?
\item In which cases will there be a horizontal asymptote at $y=0$?
\item In which cases will there be an oblique asymptote?
 
\end{enumerate}
}


\Pract{asymptotes}{Find all asymptotes of the following functions.

\begin{multicols}{2}
\begin{enumerate}
 \item $\ds f_1:x\mapsto \frac{x^2-x}{x-1}$
\item $\ds f_2:x\mapsto \frac{4x^3+2x^2-5}{3x^3-4x^2}$
\item $\ds f_3:x\mapsto \sqrt{x^2+x}$
\item $\ds f_4:x\mapsto \frac{\sqrt{x^5+x}}{\sqrt{3x^5-x}}$
\item $\ds f_5:x\mapsto \frac{x^2+2x}{\sin(x)}$
\item $\ds f_6:x\mapsto \frac{\sin(x)}{x^2-x}$
\item $\ds f_7:x\mapsto \frac{10^x}{10^x+1}$

\end{enumerate}
\end{multicols}
}


%\exo{
%A function has an inverse if the image of its curve by a symmetry through the $y=x$ axis is the curve of a function. Use the following drawing to prove that if a function $f:\mathbb{R}\to\mathbb{R}$ is continuous and has an inverse, then this inverse is continuous.
%
%Show that if $y\simeq b=f(a)$ then the observable neighbour of $f^{-1}(y)$ is $a$.
%
%\begin{center}
%\begin{tikzpicture}[scale=3.5]
%\clip(-0.2,-0.2) rectangle (1.65,1);
%\draw [rotate around={5.74:(-1.27,1.49)},line width=1.2pt] (-1.27,1.49) ellipse (3.61cm and 1.4cm);
%\draw [domain=-0.1:1.5] plot(\x,{(-0-0*\x)/-2.15});
%\draw (1.6,0.7) node[left]{$f$};
%\draw (0,-0.1) -- (0,1);
%\draw [dashed](0,0.42)node[left]{$y$}--(0.51,0.42)-- (0.51,0)node[below]{$x$};
%\draw [dashed](0,0.72)--(1.29,0.72)-- (1.29,0);
%\draw [dashed,latex-latex](0.51,0.42)--node[below]{$\Delta x$}(1.29,0.42);
%\draw[dashed,latex-latex] (0.5,0.42)--node[left]{$\Delta y$}(0.5,0.72);
%\end{tikzpicture}
%\hspace{2cm}
% \definecolor{ffffff}{rgb}{1,1,1}
%\begin{tikzpicture}[scale=3.5]
%\clip(-0.2,-0.25) rectangle (1,1.5);
%\draw [rotate around={5.74:(-1.27,1.49)},color=ffffff] (-1.27,1.49) ellipse (3.61cm and 1.4cm);
%\draw [color=ffffff,domain=-0.1:1] plot(\x,{(-0--1.4*\x)/1.4});
%\draw [rotate around={84.26:(1.49,-1.27)},line width=1.2pt] (1.49,-1.27) ellipse (3.61cm and 1.4cm);
%\draw [domain=-0.1:1] plot(\x,{(-0-0*\x)/-2.15});
%\draw (0.9,1.4)node{$f^{-1}$};
%\draw (0,-0.1) -- (0,1.5);
%\draw [dashed](0,0.51)--(0.42,0.51)--(0.42,0)node[below]{$y$};
% \draw [dashed,latex-latex](0.42,0.51)-- node[below]{$\Delta y$}(0.72,0.51);
%\draw[dashed,latex-latex](0.42,0.51)--node[left]{$\Delta x$}(0.42,1.29);
%\draw [dashed](0,1.29)node[left]{$x$}--(0.72,1.29)-- (0.72,0);
%\end{tikzpicture}
%\end{center}
%}
%
%\theorem{Let $f:I\to J$ be a real function continuous on $I$ and invertible on $I$, then $f$ has an inverse, written $f^{-1}$, which is continuous on $J$.}
%
%
%}%endlevel

\chapter{Curve Sketching}

Curve sketching needs the following steps:
\begin{itemize}
\item Find the domain.
\item Find the roots and the intercept (if any).
\item Find the asymptotes (if any).
\item Find the derivative (if any).
\item Find the roots of the derivative (if any).
\item Find the second derivative (if any).
\item Find the roots of the second derivative (if any).
\item Determine the maximums and minimums and bending direction.
\item Put all these values in a table.
\item Draw arrows which indicate the general direction of the
function: 
\item Use this information to choose a convenient scale.
\item Sketch the function.

\end{itemize}



Reminder: for sketching purposes, the following approximations are good enough: 
$ \sqrt{2}\approx 1.4$, $\sqrt{3}\approx 1.7$, $\sqrt{5}\approx 2.2$

\begin{enumerate}
\item $\ds f_1: x\mapsto x^3+5x^2-8x-12$\qquad (Check that $-1$ is a root to find the other roots.)
\item $\ds f_2: x\mapsto (x-1)\cdot (x+1)\cdot x^2 $ 
\end{enumerate}

\Pract{curve}{
Sketch the following:

\begin{multicols}{2}
\begin{enumerate}
\item $f_1:x\mapsto \dfrac{x^2}{x+2}$
\item $f_2:x\mapsto x-1+\dfrac{9}{x+1}$
\item $f_3:x\mapsto\dfrac{-x^2-2x-1}{x+3}$
\item $f_4:x\mapsto  x+3+\dfrac{1}{2x+1}$
\item $f_5:x\mapsto \dfrac{x^2-4x+6}{(x-2)^2}$
\item $f_6:x\mapsto \dfrac{2x^2-3}{x^2-1}$
\item $f_7:x\mapsto \dfrac{x^2+3x-4}{x^2-x-2}$
\item $f_8:x\mapsto \dfrac{x^3+2}{2x}$
\item $f_9:x\mapsto \dfrac{x^3-1}{x^2}$
\item $f_{10}:x\mapsto \dfrac{2x-1}{\sqrt{x^2+2}}$
\item $f_{11}:x\mapsto \dfrac{\sqrt{x^2+1}}{x+1}$
\item $f_{12}:x\mapsto \dfrac{\sqrt{x^2-4x+3}}{x+1}$
\end{enumerate}
\end{multicols}
}
%===================================================
\section*{Answers to practice exercises}


\sol{asymptotes}{
Vertical asymptote of the form $x=c$, horizontal asymptote of the form $y=b$, oblique  asymptote of the form $y=ax+b$.
\begin{multicols}{2}
\begin{enumerate}
 \item $y=x$
\item $y=1$, $x=0$, $x=4/3$
\item $\begin{cases}
       y=x & \text{ if } x>0
\\ y=-x & \text{ if } x<0
      \end{cases}$
\item $y=\sqrt{1/3}$, $x=\sqrt[4]{1/3}$
\item $x=k\cdot\pi\quad k\in\mathbb{Z}$
\item $y=0$, $x=2$
\item $\begin{cases}y=0 & \text{ if } x<0
\\
y=1 & \text{ if } x>0
\end{cases}$
\end{enumerate} 
\end{multicols}
}


\sol{curve}{
\begin{tikzpicture}[scale=0.2] 
\draw(-8,5)node{($f_1$)};
\draw[-latex] (-10.4,0) -- (10.4,0) node[right] {$x$}; 
\draw[-latex] (0,-10.4) -- (0,10.4) node[above] {$y$}; 
\draw[thick] plot[raw gnuplot] function{plot[x=-8.1:-2.7]( (x**2)/(x+2))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=-1.7:+10.1]( (x**2)/(x+2))}  ;
\draw[dashed] plot[raw gnuplot] function{plot[x=-8.1:+10.1]((x-2))}  ;
\draw[dashed] (-2,-10.4) -- (-2,10.4) ; 
\end{tikzpicture}
\begin{tikzpicture}[scale=0.2] 
\draw(-8,5)node{($f_2$)};
\draw[-latex] (-10.4,0) -- (10.4,0) node[right] {$x$}; 
\draw[-latex] (0,-10.4) -- (0,10.4) node[above] {$y$};  
\draw[thick] plot[raw gnuplot] function{plot[x=-8.1:-2.35]( x-1+((9)/(x+1)))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=-0.2:10.1]( x-1+((9)/(x+1)))} ;
\draw[dashed] plot[raw gnuplot] function{plot[x=-9.1:+10.1]((x-1))}  ;
\draw[dashed] (-1,-10.4) -- (-1,10.4) ; 
\end{tikzpicture}
\begin{tikzpicture}[scale=0.2] 
\draw(-8,-5)node{($f_3$)};
\draw[-latex] (-10.4,0) -- (10.4,0) node[right] {$x$} ; 
\draw[-latex] (0,-10.4) -- (0,10.4) node[above] {$y$} ; 	
\draw[thick] plot[raw gnuplot] function{plot[x=-8.1:-3.7]( (-x**2-2*x-1)/(x+3))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=-2.7:+10.1]( (-x**2-2*x-1)/(x+3))} ;
\draw[dashed] plot[raw gnuplot] function{plot[x=-8.1:+10.1]((1-x))}  ;
\draw[dashed] (-3,-10.4) -- (-3,10.4) ; 
\end{tikzpicture}

\bigskip
\begin{tikzpicture}[scale=0.2] 
\draw(-8,5)node{($f_4$)};
\draw[-latex] (-10.4,0) -- (10.4,0) node[right] {$x$} ; 
\draw[-latex] (0,-10.4) -- (0,10.4) node[above] {$y$}; 	 
\draw[thick] plot[raw gnuplot] function{plot[x=-8.1:-.55]( x+3+((1)/(2*x+1)))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=-0.4:7.1]( x+3+((1)/(2*x+1)))} ;
\draw[dashed] plot[raw gnuplot] function{plot[x=-9.1:+7.1]((x+3))}  ;
\draw[dashed] (-0.5,-10.4) -- (-0.5,10.4) ; 
\end{tikzpicture}
\begin{tikzpicture}[scale=0.2] 
\draw(-8,-5)node{($f_5$)};
\draw[-latex] (-10.4,0) -- (10.4,0) node[right] {$x$} ; 
\draw[-latex] (0,-10.4) -- (0,10.4) node[above] {$y$} ; 
\draw[thick] plot[raw gnuplot] function{plot[x=-8.1:1.51]( (x**2-4*x+6)/(x-2)**2)} ;
\draw[thick] plot[raw gnuplot] function{plot[x=+2.49:+10.1]((x**2-4*x+6)/(x-2)**2)} ;
\draw[dashed](-10,1)--(10,1);
\draw[dashed] (2,-10.4) -- (2,10.4) ; 
\end{tikzpicture}	
\begin{tikzpicture}[scale=0.2] 
\draw(-8,-5)node{($f_6$)};
\draw[-latex] (-10.4,0) -- (10.4,0) node[right] {$x$}; 
\draw[-latex] (0,-10.4) -- (0,10.4) node[above] {$y$} ;  
\draw[thick] plot[raw gnuplot] function{plot[x=-8.1:-1.1]( (2*x**2-3)/(x**2-1))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=-0.9:0.9]( (2*x**2-3)/(x**2-1))} ;
\draw[dashed] (-1,-10.4) -- (-1,10.4) ;
\draw[thick] plot[raw gnuplot] function{plot[x=1.1:10.1]( (2*x**2-3)/(x**2-1))} ;
\draw[dashed] (-9,2)--(10,2);
\draw[dashed] (1,-10.4) -- (1,10.4) ;
\end{tikzpicture}

\bigskip
\begin{tikzpicture}[scale=0.2] 
\draw(-8,5)node{($f_7$)};
\draw[-latex] (-10.4,0) -- (10.4,0) node[right] {$x$} ; 
\draw[-latex] (0,-10.4) -- (0,10.4) node[above] {$y$} ; 
\draw[thick] plot[raw gnuplot] function{plot[x=-8.1:-1.2]( (x**2+3*x-4)/(x**2-x-2))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=-0.8:1.8]( (x**2+3*x-4)/(x**2-x-2))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=2.25:+10.1]( (x**2+3*x-4)/(x**2-x-2))} ;
\draw[dashed] (-1,-10.4) -- (-1,10.4) ; 
\draw[dashed](-8,1)--(10,1);
\draw[dashed] (+2,-10.4) -- (+2,10.4) ; 
\end{tikzpicture}
\begin{tikzpicture}[scale=0.2] 
\draw(-8,-5)node{($f_8$)};
\draw[-latex] (-10.4,0) -- (10.4,0) node[right] {$x$} ; 
\draw[-latex] (0,-10.4) -- (0,10.4) node[above] {$y$} ; 	 \draw[thick] plot[raw gnuplot] function{plot[-4.1:-.1]( (x**3+2)/(2*x))} ;
\draw[thick] plot[raw gnuplot ] function{plot[x=+0.1:4.1]( (x**3+2)/(2*x))} ;
\draw[dashed] plot[raw gnuplot] function{plot[x=-4:+4]((x**2)/(2))}  ;
\draw[dashed] (-0.0,-10.4) -- (-0.0,10.4) ; 
\end{tikzpicture}
\begin{tikzpicture}[scale=0.2] 
\draw(-8,5)node{($f_9$)};
\draw[-latex] (-9.4,0) -- (10.4,0) node[right] {$x$} ; 
\draw[-latex] (0,-9.4) -- (0,10.4) node[above] {$y$}; 	
\draw[thick] plot[raw gnuplot] function{plot[x=-8.1:-.3]( (x**3-1)/(x**2))} ;
\draw[thick] plot[raw gnuplot] function{plot[0.3:+10.1]( (x**3-1)/(x**2))} ;
\draw[dashed] plot[raw gnuplot ] function{plot[x=-8.1:+10.1]((x))}  ;
\draw[dashed] (0,-9.4) -- (0,10.4) ; 
\end{tikzpicture}
	
\bigskip
\begin{tikzpicture}[scale=0.2] 
\draw(-8,-6)node{($f_{10}$)};
\draw[-latex] (-9.4,0) -- (10.4,0) node[right] {$x$} coordinate(x axis); 
\draw[-latex] (0,-9.4) -- (0,10.4) node[above] {$y$} coordinate(y axis); 	 
\draw[thick] plot[raw gnuplot] function{plot[x=-8.1:10.1]( (2*x-1)/(sqrt(x**2+2)))} ;
\draw[dashed](-8,-2)--(10,-2);
\draw[dashed](-8,2)--(10,2);
\end{tikzpicture}
\begin{tikzpicture}[scale=0.2] 
\draw(-8,5)node{($f_{11}$)};
\draw[-latex] (-9.4,0) -- (10.4,0) node[right] {$x$} coordinate(x axis); 
\draw[-latex] (0,-9.4) -- (0,10.4) node[above] {$y$} coordinate(y axis); 	
\draw[thick] plot[raw gnuplot] function{plot[x=-8.1:-1.18]( (sqrt(x**2+1))/(x+1))} ;
\draw[thick] plot[raw gnuplot ] function{plot[x=-0.85:+10.1]( (sqrt(x**2+1))/(x+1))} ;
\draw[-][dashed] (-1,-9.4) -- (-1,10.4) ;
\draw[dashed](-8,-1)--(10,-1);
\draw[dashed](-8,1)--(10,1); 
\end{tikzpicture}
\begin{tikzpicture}[scale=0.2] 
\draw(-8,5)node{($f_{12}$)};
\draw[-latex] (-9.4,0) -- (10.4,0) node[right] {$x$} coordinate(x axis); 
\draw[-latex] (0,-9.4) -- (0,10.4) node[above] {$y$} coordinate(y axis); 	 
\draw[thick] plot[raw gnuplot] function{plot[x=-8.1:-1.35]( (sqrt(x**2-4*x+3))/(x+1))} ;
\draw[thick] plot[raw gnuplot,] function{plot[x=-0.75:1]( (sqrt(x**2-4*x+3))/(x+1))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=3:10.1]( (sqrt(x**2-4*x+3))/(x+1))} ;
\draw[dashed](-8,-1)--(10,-1);
\draw[dashed](-8,1)--(10,1);
\draw[dashed] (-1,-9.4) -- (-1,10.4) ; 
\end{tikzpicture}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\chapter{Integrals}

\section*{Area under a curve}\label{area}

Consider a nonnegative function $f$  continuous on a closed interval $[a;b]$. Note $A(x)$ the area between the curve of $f$ and the horizontal $x$-axis.

The variation between $x$ and $x +dx$ is $\Delta A(x)$.



\begin{center}
\begin{tikzpicture}[scale=2]
\draw[fill=gray!50, line width=0pt, smooth, samples=100, domain=-0.6:0.66] (-0.6,-1.4)--plot(\x,{(\x-0.01)^5-(\x-0.01)^2+0.01})--(0.66,-1.4);
\draw[fill=gray!30, line width=0pt, smooth, samples=100, domain=0.66:0.91] (0.66,-1.4)--plot(\x,{(\x-0.01)^5-(\x-0.01)^2+0.01})--(0.91,-1.4);
\draw(-0.6,-1.4)node[below]{$a$};
\draw (1.19,0.89)-- (1.19,-1.4)node[below]{$b$};
\draw  (0.91,-1.4)-- (0.91,-1.7)node[below]{$x+dx$};
\draw  (0.66,-1.4)node[below]{$x$};
\draw [dashed] (0.91,-0.2)-- (0.66,-0.2)--(0.66,-0.3);
\draw(0.67,-1)node[right]{$\Delta A(x)$};
\draw (0.2,-1)node{$A(x)$};
\draw (-0.5,-0.1)node{$f$};
\draw[line width=1.2pt, smooth, samples=100, domain=-0.8:1.19] plot(\x,{(\x-0.01)^5-(\x-0.01)^2+0.01});
\draw (-0.9,-1.4)-- (2,-1.4);
\end{tikzpicture}
\end{center}

\exo{\label{area2}
Using  the drawing above, consider $f:x\mapsto 3x^2+x$ between $2$ and $2+dx$.

\begin{enumerate}
 \item Write the formula for the variation of the area $\Delta A(2)$ or at least for upper and lower bounds to $\Delta A(2)$.
\item  Determine the equation of $A$.
\end{enumerate}
}

\theorem{\label{int} Let $f$ be a non-negative function continuous on $[a;b]$. Then the function 
\[A: x
\mapsto A(x), \]
where $A(x)$ is the area under the curve of $f$ between $a$ and $x$, has the following properties 
\begin{enumerate}
\item
$A'(x) = f(x)$, whenever $x \in [a;b]$.
\item
$A(a) = 0$.
\end{enumerate}}\index{area under a curve}




\exo{
Prove theorem \ref{int}.

Reread exercises \ref{area1} and \ref{area2} and generalise the proof. At one point you will need the extreme value theorem (theorem \ref{extremes}).
}

\tproof{For $dx>0$. On $[x,x+dx]$ the function reaches a max and a min. Hence the slice $\Delta A(x)$ is bounded below by the rectangle $f(x_m)\cdot dx$ and above by the rectangle $f(x_M)\cdot dx$, hence 
\[f(x_m)\cdot dx\leq \Delta A(x)\leq f(x_M)\cdot dx\] 
then, since $x_m$ and $x_M$ are in $[x,x+dx]$, dividing by $dx$ we get:
\[f(x)\simeq f(x_m)\leq \frac{\Delta A(x)}{dx}\leq f(x_M)\simeq f(x)\Rightarrow  \frac{\Delta A(x)}{dx}\simeq f(x)\]
By taking $dx<0$ we notice that the area decreases and the the inequalites are reversed, hence, not depending on $dx$ we have
\[ \frac{\Delta A(x)}{dx}\simeq f(x)\Rightarrow A'(x)=f(x)\]
 
 $A(a)=0$ be the defintion that it is the area between $a$ and $a$.}

\exo{Calculate the area under $f:x\mapsto 5x^3-2x^ 2+x-2$ between $x=1$ and $x=4$.

Use $A'=f$ and $A(1)=0$.
}

\exo{Consider the area under $f$ between $a$ and $b$. Show that if $A'=f$ and $A(a)=0$, then $A(x)+C$ leads to $C=-A(a)$.

Hence the area is calculated by $A(b)-A(a)$.}

\bigskip
\textbf{Notation}

$$A(b)-A(a) \text{ is written } A(x)\Big|_a^b$$


\section*{A $\int$um of $\int$lices}

\exo{Total variation of a function:

Let $g:x\mapsto x^2$, $a=0$ and $b=5$.
\begin{enumerate}
\item Cut the interval $[a;b]$ into an ultralarge number $N$ of pieces.
Put all these pieces together again -- add all their lengths. What is
the result? 

Write this using the symbol for a sum i.e., sum for $k=0$ to $N-1$. 
\item For each $dx=\frac{b-a}{N}$ there is a corresponding $\Delta y$. Add all the
  $\Delta y$ between $f(a)$ and $f(b)$. Find the result.
\item \label{varsum}Use the microscope equation to express $\Delta y$
in terms of $y$ or $y'$. Add all these terms. Find the result.
\end{enumerate}

The (vertical) variation of $f$ between $a$ and $b$ is
written $f(x)\Big|_a^b$
}

\tproof{Let $N$ be an ultralarge natural number and let $dx=\frac{5-0}{N}=\frac{5}{N}$. Set $x_k=k\cdot dx$. Each pice goes from $x_k$ to $x_{k+1}$ for some $k$. The length is $dx$.
\[\sum_{k=0}^{N-1} dx=N\cdot dx=N\cdot\frac{5}{N}=5\]

We have the telescoping sum:
\[f(5)-f(0)=\sum_{k=0}^{N-1} f(x_{k+1})-f(x_k)=\sum_{k=0}^{N-1} \Delta f(x_k)\tag{*}\]
\[=\sum_{k=0}^{N-1}(f'(x_k)\cdot dx+\varepsilon_k\cdot dx)\]

\[=\sum_{k=0}^{N-1}f'(x_k)\cdot dx+\sum_{k=0}^{N-1}\varepsilon_k\cdot dx\]

For the second sum, let $\varepsilon=\max\{\varepsilon_k\}$ then
\[\sum_{k=0}^{N-1}\varepsilon_k\cdot dx\leq \sum_{k=0}^{N-1}\varepsilon\cdot dx=\varepsilon\cdot\sum_{k=0}^{N-1} dx=5\cdot dx\simeq 0\]

Hence we get the relation:

\[x^2\bigg|_0^5\simeq\sum_{k=0}^{N-1}f'(x_k)\cdot dx=\sum_{k=0}^{N-1}2\cdot x_k\cdot dx\]
}

For the area under $x^2$ between $x=0$ and $x=5$, we look at a sum of slices of area. This will give the total variation of the area.
\[A=\sum_{k=0}^{N-1}\Delta A(x_k)\]
This equation is the same as (*) above. Assuming $A'=f$ as shown in theorem $\ref{int}$, we have 
\[A(x)\bigg|_b^a\simeq \sum_{k=0}^{N-1} f(x_k)\cdot dx\]

\caution Questions: How can we be sure that the function $A$ exists and how do we define the area under a function?

We will now in fact reverse the process: define these sums and then define the area using these.

\section*{Fundamental Theorem of Calculus}

\tproof{\textit{The whole path to prove that a continuous function is integrable is tough. I do it in class and only after do I specify which (if any) parts of the proof will be tested. The reason to do these though, is that we (they) can assert that every theorem used is proved.}}

\definition{Let $f$ be a real function defined on $[a;b]$. Let $n$ be a positive integer.  Let $\ds  dx = \frac{b-a}{n}$ and $x_i = a+ i \cdot
dx$, for $i = 0, \dots, n$. We say that \textbf{$f$ is integrable on $[a;b]$} 
if there is an observable $I$  such that for any ultralarge integer $n$ with $\ds dx = \frac{b-a}{n}$ and $x_i = a+ i \cdot dx$, for $i = 0, \dots, n$, we have   
\[\sum_{i = 0}^{n-1} f(x_i)\cdot dx \simeq I.\]


If such an $I$ exists, it is called the integral of $f$ between
 $a$ and $b$; written
\[ \int_a^b f(x)
\cdot dx.
\]
}\index{integral}

Note that this sum is defined whether $f$ is positive or not.

\section*{preliminary results}

\exo{Prove the following preliminary results}

\begin{Lemma}\label{tiny}Let $dx=\frac{b-a}{N}$ for ultralarge $N$, and all $\varepsilon_i\simeq 0$.
Then \[\sum_{i=0}^{N-1}\varepsilon_i\cdot dx\simeq 0\]
\end{Lemma}

\tproof{
Let $\varepsilon=\max\{\varepsilon_i\ |\ 0 \leq i \leq N-1\}$
\[\sum_{i=0}^{N-1}\varepsilon_i\cdot dx\leq \sum_{i=0}^{N-1}\varepsilon\cdot dx=\varepsilon\cdot\sum_{i=0}^{N-1} dx=N\cdot dx=N\cdot\frac{b-a}{N}=\underbrace{\varepsilon}_{\simeq 0}\cdot \underbrace{(b-a)}_{\text{observable}}\simeq 0\]}


\begin{Lemma}\label{mv}\label{intv}
Let $f$ be an function continuous on $[a;b]$. Let $\frac{1}{N}\simeq 0$,  $dx=\frac{b-a}{N}$ and $x_k=a+k\cdot dx$, then there
exists a point $c\in[a;b]$ such that 
\[f(c)\cdot(b-a)=\sum_{k=0}^ {N-1} f(x_k)\cdot dx \]
\end{Lemma}

\tproof{
 For $f$ continuous on $[a,b]$, $f$ has a maximum $f(x_M)$ and a minimum $f(x_m)$.
\[\sum_{k=0}^ {N-1} f(x_m)\cdot dx \leq\sum_{k=0}^ {N-1} f(x_k)\cdot dx\leq \sum_{k=0}^ {N-1} f(x_M)\cdot dx  \]
hence
\[ f(x_m)\cdot\sum_{k=0}^ {N-1} dx \leq\sum_{k=0}^ {N-1} f(x_k)\cdot dx\leq f(x_M)\cdot \sum_{k=0}^ {N-1} dx  \]
then
\[ f(x_m)\cdot(b-a) \leq\sum_{k=0}^ {N-1} f(x_k)\cdot dx\leq f(x_M)\cdot (b-a)  \]
or
\[ f(x_m) \leq\frac{\ds\sum_{k=0}^ {N-1} f(x_k)\cdot dx}{b-a}\leq f(x_M)  \]
Since $f$ is assumed continuous on $[a,b]$, by the intermediate value theorem, it reaches all intermediate values, hence there is a $c\in [a,b]$ such that
\[ f(c) =\frac{\ds\sum_{k=0}^ {N-1} f(x_k)\cdot dx}{b-a} \]

}

\begin{Lemma}\label{uniform}If $f$ is continuous on $[a,b]$ and  $u$ and $v$ in $[a,b]$, then 
$u\simeq v\Rightarrow f(u)\simeq f(v)$
\end{Lemma}

\tproof{This in fact characterises uniform continuity. The difference between continuity and this situation is that for continuity we state that for observable $c$ and $x\simeq c$ we have $f(c)\simeq f(x)$. Here $u$ and $v$ are not necessarily observable.

For $u, v\in [a,b]$, their (common) observable neighbour $c$ is also in $[a,b]$ (theorem \ref{inside}). Hence $c\simeq u$ and $c\simeq v$. So by continuity, $f(u)\simeq f(c) \simeq f(v)$.

\caution Reminder: Polynomials are not uniformly continuous on their domain.

 Take $x^2$ at ultralarge values (relative to the standard context). Let $u=x$ and $v=x+\frac{1}{x}$ then $u\simeq v$ but $u^2=x^2$ and $v^2=x^2+2+\frac{1}{x^2}$ the difference is $2$ hence not ultrasmall.}


\theorem{\label{contint}If $f$ is continuous an $[a;b]$ then $f$ is integrable on $[a;b]$}

\exo{Difficult!

To prove theorem \ref{contint}, you must show that

\begin{enumerate}
\item the observable neighbour of the sum exists, and

\tproof{
By lemma \ref{intv} we have $f(x_m)\leq f(c)\leq f(x_M)$. If a function has a maximum, by closure, it is observable. Same for the minimum. Hence $f(c)$ is not ultralarge and therefore has an observable neighbour.
}
\item this observable neighbour does not depend on the choice of $N$.



\bigskip
that for $\frac{1}{N}\simeq 0$ and $\frac{1}{M}\simeq 0$ with $du=\frac{b-a}{N}$ and $u_k=a+k\cdot du$ and also $dv=\frac{b-a}{M}$ and $v_j=a+j\cdot dv$ then

\[\sum_{k=0}^ {N-1} f(u_k)\cdot du\simeq \sum_{j=0}^ {N-1} f(v_j)\cdot dv\]

This can be done by using $\sum_{i=0}^ {N\cdot M-1} f(w_i)\cdot dw$ with $dw=\frac{b-a}{M\cdot M}$ and comparing each sum with this one.


By symmetry, it is enough to show that 
\[\sum_{k=0}^ {N-1} f(u_k)\cdot du\simeq \sum_{i=0}^ {N\cdot M-1} f(w_i)\cdot dw\]

Consider an interval $[u_\ell; u_{\ell+1}]$ and \emph{the same interval} $[w_{M\cdot \ell};w_{M\cdot \ell+M}]$, this interval of length $du$ is one step in the sum of $f(u_k)\cdot dx$ and $M$ steps in the sum of $f(w_i)\cdot dw$.

... and conclude the proof.

\tproof{

We need now to show that the sum does not depend on the choice of the ultralarge $N$. For this, we assume that $N$ and $M$ are both ultralarge and that both sums are ultraclose the the sum containing $N\cdot M$ terms.

$\frac{1}{N}\simeq 0$ and $\frac{1}{M}\simeq 0$ with $du=\frac{b-a}{N}$ and $u_k=a+k\cdot du$ and also $dv=\frac{b-a}{M}$ and $v_j=a+j\cdot dv$

Each interval $[u_\ell,u_{\ell+1}]$ of the partition in $N$ patrs, contains $M$ subintervals of the partition in $N\cdot M$ parts. (The same would hold exchanging $v$ and $M$ for $u$ and $N$).

By lemma \ref{intv}, there is a $c\in [u_\ell,u_{\ell+1}]$ such that \[f(c)\cdot du=\sum_{k=0}^{M-1} f(x_{\ell+k})\cdot dv\] 

We write $f(c(\cdot du=f(x_\ell)\dot du+\varepsilon_\ell\dot du$ with $\varepsilon_\ell\simeq 0$.

Then from $f(x_\ell)\cdot du+\varepsilon_\ell\cdot du=\sum_{k=0}^{M-1} f(x_{\ell+k})\cdot dv$ we sum

\[\sum_{\ell=0}^{N-1}f(x_\ell)\cdot du+\sum_{\ell=0}^{N-1}\varepsilon_\ell\cdot du=\sum_{\ell=0}^{N-1}\sum_{k=0}^{M-1} f(x_{\ell+k})\cdot dv\]

The second sum is ultraclose to zero by lemma \ref{tiny}. The third sum is a concatenation of intervals. Hence

\[\sum_{\ell=0}^{N-1}f(x_\ell)\cdot du\simeq\sum_{j=0}^{N\cdot M-1}f(x_j)\cdot dv\] 
}

\end{enumerate}
 
}





\Theorem{\label{contant}Continuity of the Integral}{If $f$ is continuous on $[a,b]$ then $\ds F(x)=\int_a^x f(t)\cdot dt$ is continuous on $[a,b]$.}

We need to show that $\int_a^x f(t)\cdot dt\simeq \int_a^{x+dx} f(t)\cdot dt$ where $dx\simeq 0$ relative to the context of $f,a$ and $x$. 

But for the integral $\int_a^{x+dx} f(t)\cdot dt$ the context is $f,a,x$ and also $dx$, hence we need to use an extra context of ultrasmallness! We write $\frac{1}{N}\simep 0$ to indicate an ultralarge relative to this extended context. We can use the same $N$ for the first integral since integrability means that it does not matter which $N$ is chosen provided it is ultralarge (theorem \ref{contint}). 



The idea is to divide the intervals $[a,x]$ and $[a,x+dx]$ into the same number of pieces.

Since $x$ is a constant here, we will use $t\in[a,x]$ and $u\in[a,x+dx]$ as variables. 

\exo{Try to complete the proof}


\tproof{\textit{This is the only case, in the handout, where we work on three contexts.
\\
We cannot use additivity of the integral since we need continuity to prove additivity!}

\bigskip
Note that in this approach, we use even partitions hence when considering $\int_a^b+\int_b^c$ and $\int_a^c$ we would have no guarantee that the partition of the last integral corresponds to the partitions of the first two. This is probably the most difficult proof of the whole course.

\bigskip
Consider $\int_a^x f(t)\cdot dt$ and $\int_a^{x+dx} f(t)\cdot dt$ .

We write $\frac{1}{N}\simep 0$ to indicate an ultralarge relative to the extended context of $a,x$ and~$dx$. 

By theorem \ref{contint}, we can use the same $N$ for both integrals. 

(visualisation by showing a partition of two intervals by same number)

\begin{center}
\begin{tikzpicture}[yscale=0.75]
\draw(0,1)--(5,1);
\draw(0,0)--(6,0);
\foreach \n in {0,1,...,5}
{\draw(\n,1)--(\n,1.2)node[above]{$\n$};
\draw[dashed](\n,1)--(\n,.2);
\draw(\n+\n*0.2,0)--(\n+\n*0.2,-0.2)node[below]{$\n$};
};
\draw(0.5,1)node[above]{$\Delta t$};
\draw(0.5,0)node[below]{$\Delta u$};
\draw(2,-1.3)node{$\Delta u=\Delta t+\frac{1}{5}\Delta t$};
\draw[color=gray, dashed](5,1)--(6,1)--(6,1.2)node[above]{6};
\end{tikzpicture}
\end{center}
 
 
 Let $N\in\mathbb{N}$ be   ultralarge relative to this extended context. Let  $dt=\frac{x-a}{N}$ and \[du =\frac{x+dx-a}{N}=\frac{x-a}{N}+\frac{dx}{N}=dt+\frac{dx}{N}\]
 
 Let $t_k=a+k\cdot dt$ and $u_k=a+k\cdot du$ then 
 \[u_k=k\cdot dt +k\cdot\frac{dx}{N}=t_k+k\cdot\frac{dx}{N}\simeq u_k\]
 
By lemma \ref{uniform}, $u_k\simeq t_k\Rightarrow f(u_k)\simeq f(t_k)$ so we write
\[f(u_k)=f(t_k)+\varepsilon_k \qquad \text{for } \varepsilon_k\simeq 0\]

hence
\[\int_a^{x+dx}f(u)\cdot  du\simeq\sum_{k=0}^{N-1} f(u_k)\cdot du=\sum_{k=0}^{N-1}(f(t_k)+\varepsilon_k )\cdot(dt+\frac{dx}{N})\]
\[=\underbrace{\sum_{k=0}^{N-1}(f(t_k)\cdot dt}_{\simep \int_a^x f(t)dt}+\underbrace{\sum_{k=0}^{N-1}\frac{f(t_k)}{N}\cdot dx}_{\simeq 0}+\underbrace{\sum_{k=0}^{N-1}\varepsilon_k \cdot dt}_{\simep 0}+\underbrace{\sum_{k=0}^{N-1}\frac{\varepsilon_k }{N}\cdot dx}_{\simeq 0}\]

The three last sums are all of the form of stated in  lemma \ref{tiny}

Hence 

\[\simeq \int_a^x f(t)\cdot dt\]}




\Theorem{Additivity of the integral\label{additivity}}{Let $f$ be a real integrable function continuous on $[a;c]$ and $b \in [a;c]$. Then
\[
\int_a^bf(x)\cdot dx+\int_b^c f(x)\cdot dx=\int_a^c f(x)\cdot
dx.\]}


\exo{
Prove theorem \ref{additivity}.

\tproof{The context is given by $f, a,b$ and $c$.

Divide the interval $[a;c]$ into an ultralarge number of even parts as usual. Then $b$ is or is not on one of the partition points. If it is, nothing is to be added. If not, then there is a $j$ such that $x_j<b<x_{j+1}$.
Extend the context to $x_j$ and eedivide each interval into an ultralarge number of parts so that:
\[\int_a^c f(x)\cdot dx\simeq \sum_{k=0}^{N-1} f(x_k)\cdot dx=\sum_{k=0}^{j-1} f(x_k)\cdot dx+f(x_j)\cdot dx+\sum_{k=j+1}^{N-1} f(x_k)\cdot dx\]

\[\simeq \underbrace{\sum_{k=0}^{j-1} f(x_k)\cdot dx}_{\ds\simeq\int_a^{x_j}}+\underbrace{\sum_{k=j+1}^{N-1} f(x_k)\cdot dx}_{\ds\simeq \int_{x_j}^c}\]
and by continuity:
\[\int_a^{x_j}\simeq \int_a^b \quad \text{and} \quad  \int_{x_{j+1}}^c\simeq \int_b^c\]}
}

\theorem{\label{antiint}If $f$ is a continuous  function on $[a,b]$ then 
\[F(x)=\int_a^x f(t)\cdot dt\]
is an antiderivative of $f$ on $]a,b[$ and the only one satisfying $F(a)=0$.}

\exo{Prove theorem \ref{antiint} starting with the definition of the derivative applied to the integral. By theorem \ref{contint}, it is integrable.

\tproof{
By additivity:
\[F(x+dx)-F(x)=\int_x^{x+dx}f(t)\cdot dt\]

By lemma \ref{mv}, there is a $c\in[x,x+dx]$ such that
\[\int_x^{x+dx}f(t)\cdot dt=f(c)\cdot dx\]
hence 
\[\frac{\Delta F(x)}{dx}=f(c)\simeq f(x)\] by continuity of $f$ since $x\simeq c$. 
hence $F'(x)=f(x)$.
} }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\Theorem{Fundamental theorem of Calculus\label{fundtheo}}{Let $f$
be a function continuous on $[a;b]$. Let $F$ be an antiderivative of $f$
on $[a;b]$. Then
\[
\int_a^b f(x)\cdot dx= F(b) - F(a).
\]
}


The method used in the proof can also be seen as looking at the link between the global variation of a function $F$ and its derivative $f$.

\exo{
Consider the variation of $F$ between $a$ and $b$. 


Let $n\in\mathbb{N}$ such that $1/N\simeq 0$ and $dx=\frac{b-a}{N}$ and $x_k=a+k\cdot dx$.

Then clearly,  we have 
\[F(b)-F(a)=\sum_{k=0}^{N-1} \Delta F(x_k)\]


Here the context is $f,a,b$ -- not necessarily any given $x_j$!
\begin{enumerate}
\item 
On each interval $[x_k,x_{k+1}]$ (which is also in the form $[x_k,x_k+dx]$)
there is a $c$ such that
\[
F(x_k+ dx) - F(x_k) = f(c)\cdot dx,
\]

Why is this? By what theorem? 
\item Explain why we have $f(c)\simeq f(x_k)$. 

\item Conclude by explaining why:

\[
\sum_{k=0}^{N-1}F(x_k+dx) - F(x_k) = \sum_{k=0}^{N-1}f(x_k) \cdot dx + \sum_{k=0}^{N-1}\varepsilon_k \cdot dx\simeq \sum_{k=0}^{N-1}f(x_k) \cdot dx 
\]\end{enumerate}

}

Hence, the global variation of $F$ between $a$ and $b$ is, up to an ultrasmall value, the sum of $F'(x_i)\cdot dx$ provided $F'$ is continuous on $[a,b]$.
%===================================================


Page \pageref{area} we looked at one slice of the area under a positive function.
Now we show that if we sum up all slices on the area under a curve, the antiderivative gives the answer.  Hence we  have
\[
\text{area}\simeq\sum_{i=0}^{N-1} f(x_k) \cdot dx.
\]


\begin{center}
\begin{tikzpicture}[scale=2]
% \clip(-1.3,-2) rectangle (5.5,4.5);
\draw[line width=1.2pt, smooth,samples=100,domain=-0.6:1.19] plot(\x,{(\x-0.01)^5-(\x-0.01)^2+0.01});
\draw(-0.6,-0.45)-- (-0.6,-1.41)node[below]{$a$};
\draw (1.19,0.89)-- (1.19,-1.41)node[below]{$b$};
\draw [dashed] (0.4,-0.13)-- (0.4,-1.41)node[below]{$x_k$};
\draw(0.03,1.69) circle (0.82cm);
\draw (-0.65,2.16)-- (0.76,1.32);
\draw (-0.62,1.19)-- (0.4,-0.132);
\draw (0.4,-0.13)-- (0.82,1.48);
\draw (-0.61,2.)-- (-0.4,2);
\draw (-0.4,2)-- (-0.4,0.99);
\draw (-0.4,1.9)-- (-0.2,1.9);
\draw (-0.2,1.9)-- (-0.2,0.9);
\draw (0,0.87)node[below]{$x_k$}-- (0,1.77);
\draw (0,1.77)-- (-0.2,1.77);
\draw [dashed](0,1.65)--(0.4,1.65)node[right]{$f(x_k)$};
\draw (0.2,0.89)-- (0.2,1.65);
\draw[dashed](0.2,0.89)--(0.2,0.6);
\draw[dashed](0,0.7)--(0,0.6);
\draw[latex-latex, dashed](0,0.6)--node[below]{$dx$}(0.2,0.6);
\draw (0.2,1.65)-- (0,1.65);
\draw (0.4,0.96)-- (0.4,1.53);
\draw (0.4,1.53)-- (0.2,1.53);
\draw (0.6,1.11)-- (0.6,1.41);
\draw (0.6,1.41)-- (0.4,1.41);
\draw (-0.6,2.13)-- (-0.6,1.17);
\draw [domain=-1.3:2] plot(\x,{(--4.16-0*\x)/-2.96});
\draw[latex-](0.1,1.2)--(2,1.5)node[right]{area of rectangle is $f(x_k)\cdot dx$};
\end{tikzpicture}
\end{center}

\caution The drawing can be misleading. It is only a specific case. A continuous function does not
necessarily appear as a straight line under magnification. The extreme
value theorem ensures that it has a maximum and minimum on the interval.


\bigskip





\textbf{Notation}: we write
\[F(x)\Big|_a^b= F(b)-F(a).
\]


\bigskip
If bounds are given, the integral represents a value: it is a \textbf{definite integral}.
If no bounds are given, it represents an antiderivative: it is an
\textbf{indefinite integral}.
%============================================================


\exo{Show that for a definite integral, it does not matter which antiderivative is chosen.
}

\exo{What conditions would a function need to satisfy in order to be non-integrable? Give such a function.}

\exo{A constant function $f:x\mapsto C$ from $a$ to $b$ defines a
rectangle. Check that the area under $f$ is the ``usual'' formula:
$(b-a)\cdot C$
}

\exo{ The function $y=x$ defines a triangle. Show that the area of the
triangle from 0 to $a$ yields the ``usual'' result for the area of a
triangle.
}


\exo{
\begin{enumerate}
\item Calculate the area between the curve and the $x$-axis for $y=x^2$ from $x=-5$ to $x=5$.
\item Calculate the area between the curve and the $x$-axis for $y=x^3$ from $x=0$ to $x=3$.
\item Calculate the area between the curve and the $x$-axis for $y=x^3$  from $x=-2$ to $x=0$.
\item Calculate the area between the curve and the $x$-axis for $y=x^3$  from  $x=-10$ to $x=10$.
\end{enumerate}
}

Notice that the integral can be a negative value. If $f$ represents the velocity of an object, a negative integral means that the distance is becomming smaller. If the integral is equal to zero, the object is back where it started.

\bigskip
So far we have assumed that an area function exists. Now we can give a definition.

\Definition{Area}{The area between a positive continuous function and the $x$-axis, on an interval $[a;b]$ is given by the integral of the function on $[a;b]$.}

\exo{
Calculate the mean value of $x\mapsto x^2$ on $[-4;4]$.
}



\section*{Linearity}

\Theorem{Linearity of the integral\label{linearity}}{Let $f$ and $g$ be real functions continuous on $[a;b]$. Let $\lambda, \mu$ be real numbers. Then
\begin{enumerate}
 \item \[ \int_a^b\left(\lambda\cdot f(x)\right)\cdot dx=\lambda\cdot\int_a^b f(x)\cdot dx\]
\item \[ \int_a^b \left(f(x)+ g(x)\right)\cdot dx= \int_a^bf(x)\cdot dx+\int_a^b g(x)\cdot dx. \]
\end{enumerate}

}

Note that if $f$ and $g$ are integrable then all linear combinations of $f$ and $g$ are integrable.


\Theorem{Monotonicity of the integral} {\label{intbasic}Let $f$ be a real function continuous on  $[a;b]$.
\begin{enumerate}
\item
If $f(x) \geq 0$ (resp. $>0$) for each $x \in [a;b]$ then
\[
\int_a^b f(x) \cdot dx \geq 0 \quad (\text{resp. $>0$}).
\]

\item
If $f(x) = 0$ for each $x \in [a;b]$ then
\[
\int_a^b f(x) \cdot dx = 0.
\]
\item If $f(x) \leq 0$ (resp. $<0$) for each $x \in [a;b]$ then
\[
\int_a^b f(x) \cdot dx \leq 0 \quad (\text{resp. $<0$}).
\]
\end{enumerate}
}


\exo{
Prove theorems \ref{linearity} and \ref{intbasic}.
}

%XXX


\exo{Prove theorem \ref{intparts}.}

\Theorem{Integration by parts\label{intparts}}{Let $f$ and $g$ be real functions continuous on $[a;b]$ such that $f'$ and $g'$ are continuous on $[a;b]$. Then
\[
\int_a^b f'(x)\cdot g(x) \cdot dx= f(x)\cdot
g(x)\bigg|_a^b-\int_a^b f(x)\cdot g'(x)\cdot dx.
\]}




\example{Consider the integral
\[ \int_0^{\pi/2} x \cdot
\sin(x) \cdot dx.
\]
To integrate by parts, use $f': x \mapsto \sin(x)$ et $g:
x \mapsto x$.  We have $f(x) = -\cos(x)$ and $g'(x) = 1$, hence
 \[ \int_0^{\pi/2} x \cdot \sin(x) \cdot dx = -x \cdot
\cos(x)\bigg|_0^{\pi/2} + \int_0^{\pi/2} \cos(x) \cdot dx =
\sin(x) \bigg|_0^{\pi/2} = 1.
\]
We also deduce that  \[ \int x \cdot \sin(x) \cdot dx = -x \cdot
\cos(x) + \sin(x) + C.
\]
}


\exo{

Use integration by parts to compute the following integrals:

\begin{multicols}{2}
 \begin{enumerate}
  \item $\ds\int x\cdot \cos(x)\cdot dx$
 \item $\ds\int (\cos(x))^2\cdot dx$
\item $\ds \int x^2\cdot \sin(x)\cdot dx$
\item $\ds\int\sin(x)\cdot\cos(x)\cdot dx$
 \end{enumerate}

\end{multicols}

}





\exo{
For each of the following functions, find an antiderivative:
\begin{enumerate}
\begin{multicols}{3}
\item $\ds f:t\mapsto3t^2+1$ 

\item $\ds f:t\mapsto 4- 3t^3 $

\item $\ds f:s\mapsto 7s^{-3}$ 

\item $\ds f:x\mapsto (x-6)^2$

\item $\ds f:y\mapsto y^{\frac{3}{2}}$ 

\item $\ds f:x\mapsto |x|$ 

\item $\ds f:u\mapsto u^2+u^{-2}$ 

\item $\ds f:x\mapsto 4$ 

\item $\ds f:t\mapsto t$

\item $\ds f:z\mapsto \frac{2}{z^2}$
\end{multicols}
\end{enumerate}

Check your results by differentiating them.
}

\exo{
\begin{enumerate}
\item If $F'(x)=x+x^2$ for all $x$, find $F(1)-F(-1)$.
\item If $F'(x)=x^4$ for all $x$, find $F(2)-F(1)$.
\item If $F'(t)=t^\frac{1}{3}$ for all $t$, find $F(8)-F(10)$.
\end{enumerate}
}


\exo{
The following computation may seem correct: $\int_{-1}^1 x^{-2} dx=-\frac{1}{x}\bigg|_{-1}^1=-2$ yet there is no $x\in[-1,1]$ such that $f(x)<0$. By theorem \ref{intbasic} we should therefore have a positive value for the integral. Why is this not so?
}


\Theorem{Integration with inside derivative\label{intinside}}{Let $f$ and $g$ be real functions differentiable on  $[a;b]$ such that $f'$ and $g'$ are continuous on $[a;b]$. Then
\[
\int_a^b f'(g(x))\cdot g'(x)\cdot dx = f(g(x))\bigg|_a^b.
\]
 }

\exo{Prove theorem \ref{intinside}.}

\exo{
Compute the following integrals:
\begin{multicols}{2}
\begin{enumerate}
 \item $\ds \int 2x\cdot\sin(x^2)\cdot dx$
\item $\ds \int x^2\cdot(x^3+1)\cdot dx$
\item $\ds \int \sin(x)\cdot\cos(\cos(x))\cdot dx$
\item $\ds \int \sin(x)\cdot \cos^2(x)\cdot dx $
\end{enumerate}
 
\end{multicols}
}



%======================================
%endlevel

%==========================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
\section*{Variable substitution}

Consider $\ds \int_a^b f(x)\cdot dx$. 

If $x$ is a function of $u$ written $x=g(u)$ then  $dx=g'(u)\cdot du$,

$f(x)$ becomes $f(g(u))$ and the limits must be
changed to $a_1$ and $b_1$ so that $g(a_1)=a$ and $g(b_1)=b$ 


\example{
Let \[\int_0^1\sqrt{1+\sqrt{x}}\cdot dx.\]
Consider the variable change
$u=1+\sqrt{x}$. Then $x = (u-1)^2 = g(u)$, the derivative of  $g$ is continuous.  If $x=0$ then $u=1$
and if $x=1$ then $u=2$. Moreover $f(g(u)) = \sqrt{u}$ and
\[
dx = 2\cdot (u-1)\cdot du. \]
Replacing all terms we obtain
\[\int_0^1\sqrt{1+\sqrt{x}}\cdot dx = 2\int_1^2\sqrt{u}\cdot (u-1)\cdot du =
2\int_1^2 \left(u^{3/2}-u^{1/2}\right) \cdot du \] so that
\[2\left(\frac{2}{5}u^{5/2}-\frac{2}{3}u^{3/2}\right)\bigg|_1^2=\frac{8+8\sqrt{2}}{15}.\]
As $g$ has an inverse which is $x \mapsto 1 + \sqrt{x}$ and is differentiable (except at $x=0$), we can revert to the variable $x$ and find an antiderivative:
$$\int\sqrt{1+\sqrt{x}}\cdot dx=
\frac{4}{5}\left(\sqrt{1+\sqrt{x}}\right)^5-\frac{4}{3}\left(\sqrt{1+\sqrt{x}}\right)^3+C.$$
}


\exo{Calculate
\[\int_0^1\sqrt{5x+2}\cdot dx.\]
Use $u=5x+2$. Calculate $du$, change the bounds, calculate the
integral.


Same integral. Use $v=\sqrt{5x+2}$ 
}

\bigskip
The difficulty is usually to find which variable substitution is best.

\exo{
Use variable substitution  to evaluate
the following:

\begin{multicols}{2}
\begin{enumerate}
\item $\ds \int_0^{10} \frac{1}{(2x+2)^2}\cdot  dx$
\item $\ds\int (3-4z)^6\cdot  dz$
\item $\ds\int_{-1}^1 2t\sqrt{1-t^2}\cdot dt$
\item $\ds\int_a^b \sqrt{3y+1}\cdot dy$
%\item $\ds\int_2^\pi \frac{x}{2x^2+1}\cdot dx$
\item $\ds\int\frac{4y}{(2+3y^2)^2}\cdot dy$
\item $\ds\int_{-2}^2 x(4-5x^2)^2\cdot dx$
\item $\ds\int(1-x)^{\frac{3}{2}}\cdot dx$
%\item $\ds\int\frac{1-2t}{1+2t}\cdot dt$
%\item $\ds\int\frac{x}{x^2+1}\cdot dx$
\end{enumerate}
\end{multicols}
}


\Pract{substi}{
\begin{multicols}{2}
\begin{enumerate}
\item $\ds\int_0^1\frac{u}{\sqrt{1-u^2}}\cdot du$
\item $\ds\int_1^2\frac{u}{\sqrt{1-u^2}}\cdot du$
\item $\ds\int_0^1\sqrt{1+\sqrt{x}}\cdot dx$
\item $\ds\int_0^{10}t(t^2+3)^{-2}\cdot dt$
\item $\ds\int_{\sqrt{6}}^5 x(x^2+2)^{\frac{1}{3}}\cdot dx$
\item $\ds\int_{-1}^1\frac{x^2}{(4-x^3)^2}\cdot dx$
\item $\ds\int_1^2\frac{1}{t^{2}\sqrt{1+\dfrac{1}{t}}}\cdot dt$
\end{enumerate}
\end{multicols}
}


Variable substitution is formalised in the following theorem.

\Theorem{Integration by variable substitution\label{substitution}}{Let $f$ be a real function continuous on $[a;b]$. Let $g$ be a function whose derivative is continuous and such that for $e, d \in
\mathbb{R}$ we have $g(d) = a$ and $g(e) = b$. Then
$$\int_a^b f(x)\cdot dx=\int_{d}^{e} f(g(u))\cdot g'(u)\cdot du.$$
}

This formula looks probably quite difficult, but hopefully, the exercises done above show that it amounts to a systematic procedure.

\tproof{Since $dx$ is a quantity and $du=u'dx$ also, this theorme can be avoided as such and variable by substitution can be given as a step by step method.}


\vfill
A simplified writing can be used: we have already used the writing $y=f(x)$ where $y$ is a dependent variable and $x$ the independent variable. When several functions are used, we can write $u=f(x)$ and $v=g(x)$, then we have (for constant $c$ and for $U'=u$ and $V'=v$):

\begin{center}
\fbox{\begin{minipage}{0.8\linewidth}
\begin{itemize}
\item $c'=0$
\item $(c\cdot u)'=c\cdot u'$
\item $(u+v)'=u'+v'$
\item $(u\cdot v)'=u'\cdot v+u\cdot v'$
\item $\ds\left(\frac{u}{v}\right)'=\frac{u'\cdot v-u\cdot v'}{v^2}$
\item $\ds(u\circ v)'=u'\cdot v'$ (in this case, $u$ depends on $v$ which depends on $x$).
\item $\ds(x^n)'=nx^{n-1}$
\item $\ds\sin'(x)=\cos(x)$
\item $\ds\cos'(x)=-\sin(x)$
\item $\ds\tan'(x)=1+\tan^2(x)=\frac{1}{\cos^2(x)}$
\item $\ds \int c\cdot u\cdot dx=c\cdot U+k$
\item $\ds \int (u+v)\cdot dx=U+V+k$
\item $\ds \int u(v)\cdot v'\cdot dx=U(v)+k$
\item $\ds \int u'\cdot v\cdot dx=u\cdot v-\int u\cdot v'\cdot dx$
\end{itemize}
\end{minipage}
}
\end{center}

\newpage
\section*{Answers to practice exercises}

\sol{deriv2}{
\begin{enumerate}
\item $\ds f'(x)=20x^3+3x^2-4x$
\item $\ds g'(x)=10\sqrt{3}x$
\item $\ds h'(x)= -\frac{x^4+4x^3-3x^2+10x+10}{(x^3-5)^2} $
\item $\ds j'(x)= 20 x^3-\frac{6x-2}{(3x^2-2x+\pi)^2}$
\item $\ds k'(x)= 0$
\item $\ds l'(x)= -\frac{1}{x^2}-\frac{2}{x^3}-\frac{3}{x^4}-\frac{4}{x^5}$
\item $\ds m'(x)= \frac{(x^2+x+1)(3x^2+2x)-(x^3+x^2)(2x+1)}{(x^2+x+1)^2}=\frac{x(x^3+2x^2+4x+2)}{(x^2+x+1)^2}$
\end{enumerate}
}

\sol{deriv3}{
\textbf{}

\begin{center}
\begin{tikzpicture}[xscale=1.5,yscale=0.3]
\draw[step= 1cm , color=gray,very thin] (-2,-10) grid (3,15);
\draw[line width=1.2pt]  plot[raw gnuplot] function{plot [-2:3]-(x-2)*(x+1)*(x-1)};
% \pgfsetlinewidth{1pt};
\draw[->] (-2,0)node[below]{-2}--(3.2,0)node[below]{3};
\draw[->](0,-10)node[right]{-15}--(0,15)node[right]{15};
\end{tikzpicture}
\end{center}

}

\sol{deriv4}{
Tangent line is $y=-\dfrac{4}{5}x+\dfrac{27}{5}$

\begin{center}
\begin{tikzpicture}[scale=0.5]%[xscale=1.5,yscale=0.2]
\draw[step= 1cm , color=gray,very thin] (-5,-5) grid (10,7);
\draw[line width=1.2pt]  plot[raw gnuplot] function{plot [-5:10]10*x/(x**2+1)};
\draw  plot[raw gnuplot] function{plot [-5:10] -0.519*x+4.43};
% \pgfsetlinewidth{1pt};
\draw[->] (-5,0)node[left]{-5}--(10,0)node[right]{10};
\draw[->](0,-5)node[below, right]{-5}--(0,7)node[above, right]{7};
\end{tikzpicture}
\end{center}
}


\sol{deriv5}{

\begin{enumerate}
\begin{multicols}{2}
 \item \quad $3x^2+2x+2$
\item \quad $-3x^2+4x-2$
\item \quad $x^2-5x+6$
\item  \quad $(x-2)^2$
\item \quad $\dfrac{x(x+4)}{(x+2)^2}$
\item \quad $\dfrac{x^2+2x-8}{(x+1)^2}$
\item \quad $\dfrac{4x^2+4x-3}{(2x+1)^2}$
\item \quad $-\dfrac{x^2+6x+5}{(x+3)^2}$
\item \quad $\begin{cases} 1 & \text{ if } x>2\\-1 & \text{ if } x <
2\\\text{not differentiable} & \text{ if } x=2\end{cases}$
\item \quad $\begin{cases}\dfrac{x(x+4)}{(x+2)^2}& \text{ if
} x\geq 0\\&\\\dfrac{-x(x-4)}{x-2)^2} & \text{ if } x\leq
0\end{cases}$
\item \quad $\dfrac{x^2+2x+2}{(x+1)^2}$
\end{multicols}
\item \quad 
$\begin{cases}
3x^2-12x+11 & \text{ if } x\in ]1;2[\cup]3;\infty[\\
-3x^2+12x-11 &\text{ if } x\in]-\infty;1[\cup]2;3[\\
\text{not differentiable} & \text{ if } x\in\{1;2;3\}
 \end{cases}$
\end{enumerate}
}



\sol{deriv6}{


\begin{enumerate}
\begin{multicols}{2}
\item $\ds f'_1:x\mapsto\frac{9x^2+2}{2\sqrt{3x^3+2x+1}}$
\item $\ds f'_2:x\mapsto 10x\cdot(x^2+3)^4$
\item $\ds f'_3:x\mapsto an\cdot(ax+b)^{n-1}$
\item $\ds f'_4:x\mapsto\frac{3x^2}{2\sqrt{x^3+1}}$
 \item $\ds f'_5:x\mapsto\cos(x^2+3x)\cdot(2x+3)$
\item $\ds f'_6:\theta\mapsto -6\cos(3\theta)\cdot\sin(3\theta)$
\item $\ds f'_7:u\mapsto \cos(\sin(u))\cdot\cos(u)$
\end{multicols}
\item $\ds f'_8:x\mapsto 8x\tan(\tan^2(x^2) (1+\tan^2(\tan^2(x^2))(\tan(x^2)(1+\tan^2(x^2))$
\begin{multicols}{2}
\item $\ds f_9:v\mapsto -\sin(v)$
\item $\ds f'_{10}:x\mapsto 0$
\end{multicols}
\end{enumerate}


}

\sol{substi}{

\begin{multicols}{2}
\begin{enumerate}
 \item 1 \quad Use $x=1-u^2$.
\item undefined -- for $u>1$ we have the square root of a negative number.
\item $\frac{8(\sqrt{2}+1)}{15}$ \quad Use $u=1+\sqrt{x}$
\item $\frac{50}{309}$\quad Use $u=t^2+3$
\item $\frac{195}{8}$ \quad Use $u=x^2+2$
\item $\frac{2}{45}$\quad Use $u=4-x^3$
\item $-\sqrt{6}+2\sqrt{2}$\quad Use $u=1+\frac{1}{t}$
\end{enumerate}
\end{multicols}
}


\chapter{limits}

\vspace{1cm}
A function $f$ is defined on the left of $a$ (resp. on the right) if  $f(x)$ is defined for all  $x \simeq a$ with $x < a$ (resp. $x > a$). It is clear that $f$ is defined around  $a$ if and only if $f$ is defined on the right and on the left of $a$.

\Definition{One sided Continuity}{Let $f$ be a real function and $a \in \mathbb{R}$.
\begin{enumerate}
\item
Suppose that $f$ is defined on the left of $a$. Then $f$ is \textbf{continuous on the left at $a$} if   $x<a$ and $x \simeq a\ \Longrightarrow\ f(x) \simeq  f(a)$.
\item
Suppose that $f$ is defined on the right of $a$. Then $f$ is \textbf{continuous on the right at $a$} if $x>a$ and $x \simeq a\ \Longrightarrow\ f(x) \simeq  f(a)$.
\end{enumerate}
}\index{continuity!one sided}

It is immediate that $f$ is continuous at $a$ if and only if it is continuous on the right and on the left at $a$. 

We now extend the concept of continuity at a point to continuity on an interval.


% \exo{
% 
% Consider the functions $f$ and $g$ given by
% \[
% f:x\mapsto \frac{x^2 + x - 6}{x-2} \quad \text{and}\quad g:x\mapsto \frac{\sqrt{x+2}-2}{x-2} .
% \]
% 
% Examine the behaviour of $f$ and $g$ around 2. Even though these functions are not defined at $x=2$, what would be a reasonable way to extend the function so that its extension would be defined at 2?
% }

\exo{Prove directly that $x\mapsto\sqrt{x}$ is continuous on its domain i.e, for any value $x=a$ in the domain.

Hint: start by the definition, then multiply and divide by $(\sqrt{a+dx}+\sqrt{a}$.}

\bigskip
If we want to study the behaviour of $f$ in the neighbourhood of $a$, the function $f$ must be defined \textit{around} $a$, but not necessarily at $a$. If the function is defined in a neighbourhood of $a$, by closure, it is possible to use a neighbourhood defined by observable bounds. Hence  $f(x)$ must exist for $x\simeq a$ but $f(a)$ does not necessarily exist. Context is $f$ and $a$.

\definition{A \textbf{deleted interval of}  $a$ is an interval around $a$ not containing $a$.}\index{deleted interval}

\begin{center}
\fbox{The limit of $f$ at $a$ is the value that $f$ should take in order to be continuous at $a$.}
\end{center}

\definition{Let $f$ be a real function defined on a deleted interval of $a$. Context is $f$ and $a$. We say that $f$ \textbf{has a limit at $a$} if there exists an observable number $L$  such that if we had $f(a)=L$ then $f$ would be continuous at $a$,
}

In other terms, if there is an observable number $L$ such that
\[x\simeq a\Longrightarrow f(x) \simeq L.\]
\index{limit}

Of course, by this definition, if $f$ \emph{is} continuous at $a$, then the limit of $f$ at $a$ is $f(a)$.

\bigskip
\begin{center}
\fbox{The limit of $f$ at $a$ is the observable value of $f(x)$ when $x\simeq a$}
\end{center}

The definition of limit  can also be interpreted in the following way:



\bigskip
If $f$ has a limit at $a$ then it is the observable neighbour of  $f(a+dx)$. 

If $L$ is the limit of $f$ at $a$ we write

\[f(a+dx)\simeq L\]
or
\[\lim_{x \to a} f(x) = L,\]
or
\[\lim_{h\to 0} f(a+h)=L.\]
% 
% The following definition of continuity, given here using a limit, is equivalent to the definition of continuity given page~\pageref{Dcontinuity1}.
% 
% $f$ is continuous at $a$ if and only if
% 
% \[\lim_{x \to a}f(x) = f(a).\]

\exo{Calculate
\[\lim_{x \to 3}\frac{2x^2-7x+3}{x-3}.\]

Show that it is equal to
\[\lim_{h\to 0} \frac{2(3+h)^2-7(3+h)+3}{(3+h)-3}.\]
}




%===================================================

\exo{
Consider the signum function $\sgn$, defined by
\[
\sgn: x\mapsto \begin{cases} -1 \quad &\text{ if } x < 0,\\
0 &\text{ if } x = 0,\\
+1 &\text{ if } x > 0.
\end{cases}
\]

Check that $\sgn$ is defined around 0. Does it have a limit at 0?
}

\section*{One Sided Limits}

A function is defined \textbf{on the left} (respectively \textbf{on the right})
of $a$, if $f(x)$ exists for $x \simeq a$, $x < a$ (respectively
$x \simeq a$, $x > a$).

\definition{Let $f$ be a real function defined on the left of $a$. The function
$f$ \textbf{has a limit on the left of $a$} if there is an obervable number $L$  such that
\[
 x \simeq a \text{ and } x < a
\
\Longrightarrow
\ f(x) \simeq L.
\]
}\index{limit!one sided}

If the limit on the left exists it is unique (it is the observable neighbour of $f(x)$).
 We write:
\[
\lim_{x \to a_-} f(x) = L, \text{\quad or \quad} x\simeq a_-\Rightarrow f(x) = L.\]

The symbol $a_-$ indicates that we choose numbers less than $a$.

Similarly we define the \textbf{limit on the right of $a$} and write:
\[
\lim_{x \to a_+} f(x) = L, \text {\quad or \quad } x\simeq a_+\Rightarrow f(x)=L. \]

The symbol $a_+$ indicates that we choose numbers greater than $a$.


\exo{
Consider $f$ defined by
\[
f: x \mapsto  \sin(1/x),
\quad \text{for } x > 0.
\]
Check that $f$ is defined on the right of $0$.

Does it have a limit on the right of zero?
}

\bigskip

Using limits, the derivative may be re-defined in the following way:

\bigskip
Let $f$ be a real function defined on an interval containing $a$. 
\textbf{The derivative of $f$ at $a$} is the limit

\[
\lim_{h \rightarrow 0} \frac{f(a+h) - f(a)}{h}\] 
if the limit exists.
% Similarly: if
% \[
% \lima \frac{f(x) - f(a)}{x-a} \quad \text{ exists.}
% \]
If it exists, it is noted  $f'(a)$. It is the derivative of $f$ at $a$ and $f$ is said to be \textbf{differentiable} at $a$.
\index{derivative}

\begin{center}
\fbox{
\begin{minipage}{0.8\textwidth}
The limit is only a rewriting. The "equal" sign used is there to say that the limit is the value that the function can be ultraclose to.

When a limit appears in a problem, the first thing to do is to rewrite it in terms of ultracloseness.
\end{minipage}}
\end{center}


We extend the definition of limit to the cases where the function reaches ultralarge values.

\caution Introducing a new symbol: if relative to a context, we consider ultralarge values of $x$ or ultralarge values of $f(x)$, the infinity symbol "$\infty$" is used. But \textbf{no value can ever be equal to~$\infty$}. 

\caution The $\infty$ symbol cannot  be used in operations, because it is not a number.

\definition{Let $f$ be a real function defined on a deleted interval of $a$. The context is $f$ and $a$. We say that\textbf{ $f$ tends to plus infinity} ($+\infty$) (resp.  minus infinity ($-\infty$)) at $a$ if $f(x)$ is positive ultralarge (resp. negative ultralarge) whenever $x\simeq a\quad x\neq a$

written \[\lim_{x\to a}f(x)=\infty \]

The definition for one-sided limits is similar.

}\index{limit!$\infty$}\index{$\infty$}


Similarly
\[\lim_{x\to\infty}f(x)=L\]
stands for: there is an observable $L$ such that $f(x)\simeq L$ whenever $x$ is ultralarge.

\Theorem{Rule of de l'Hospital for $0/0$ 
\label{0/0}}{Let $f$ and $g$ be differentiable functions at
$a$.  Suppose that $f(a) = g(a) =0$, but that $g'(a) \not = 0$.
Then
\[
\frac{f(a+dx)}{g(a+dx)}\simeq\frac{f'(a)}{g'(a)}\]
(provided $f'(a)$ and $g'(a)$ exist).

}
\index{rule of de l'Hospital}\index{de l'Hospital}\index{Hospital}


\exo{
Prove theorem \ref{0/0}.
}

\tproof{
Write $f(a+\Delta x)=u+\Delta$ and $g(a+\Delta x)=v+\Delta v$, then for $x\simeq a$ we write

\[\frac{u+\Delta u}{v+\Delta v}\underbrace{=}_{u=0, v=0}\frac{\Delta u}{\Delta v}=\frac{u'\Delta x+\varepsilon\Delta x}{v'\Delta x+\delta\Delta x}=\frac{u'+\varepsilon}{v'+\delta}\simeq \frac{u'}{v'}\]
}

The rule of de l'Hospital also holds for the case where $a$ is ultralarge. And more generally
\[\lim_{x\to a}\frac{f(x)}{g(x)}=\lim_{x\to a}\frac{f'(x)}{g'(x)}\] if $lim_{x\to a}g'(x)\neq 0$.

\tproof{The proof of this general case goes beyond classroom work. It requires considering $x\simeq a$ then $f'(x)$ which requires $\Delta x\simeq 0$ in the extended context of $f$ \underline{and} $x$, this means working with three levels. See the book.}

\exo{
Evaluate  using de L'Hospital's rule.
\[\frac{x-1}{\sqrt{x^2-1}}\]
for $x\simeq 1$.
}

\exo{Assuming the rule of de l'Hospital holds for the case $\frac{\text{ultrasmall}}{\text{ultrasmall}}$, show that it holds for the case $\frac{\text{ultralarge}}{\text{ultralarge}}$}

\tproof{Assume that $f(x)=u$ and $g(x)=v$ are ultralarge. Then $\frac{u}{v}=\frac{\ \frac{1}{v}\ }{\frac{1}{u}}$ which is $\frac{\text{ultrasmall}}{\text{ultrasmall}}$ so  
\[\frac{u}{v}\simeq\frac{\ \left(\frac{1}{v}\right)'\ }{\left(\frac{1}{u}\right)'}=\frac{\ -\frac{v'}{v^2}\ }{-\frac{u'}{u^2}}=\frac{v'}{u'}\frac{u^2}{v^2}\] Hence

\[\frac{u}{v}\simeq \frac{v'}{u'}\frac{u^2}{v^2}\]
which leads to \[\frac{v}{u}\simeq \frac{v'}{u'}\]
 }

\exo{
Evaluate  using de L'Hospital's rule.

\begin{multicols}{2}
 \begin{enumerate}
\item $\ds \frac{1/t-1}{t^2-2t+1}$ for $t\simeq 1$ (with $(t>1)$).
\item $\ds \frac{\sqrt{x}-1}{\sqrt[3]{x}-1}$ for $x\simeq 1$.
\item $\ds \frac{x^2}{\sqrt{2x+1}-1}$ for $x\simeq 0$.
\item $\ds \frac{2+1/t}{3-2/t}$ for $t\simeq 0$.
\item $\ds \frac{x+5-2x^{-1}-x^{-3}}{3x+12-x^{-2}}$ for ultralarge $x$ 
% \item $\ds \lim_{x\to 0}\frac{1-\cos(x)}{x}$
% \item $\ds \lim_{x\to \pi/2}\frac{\cos(3x)}{\pi/2-x}$
% \item $\ds \lim_{\theta\to 0}\frac{\sin(2\theta)}{\sin(5\theta)}$
\item $\ds \left(t+\frac{1}{t}\right)((4-t)^{3/2}-8)$ for $t\simeq 0$.
\item $\ds \frac{u+u^{-1}}{1+\sqrt{1-u}}$ for ultralarge $u$.
 \end{enumerate}

\end{multicols}
}





\Pract{limits}{Calculate the following limits. The answer should be a number, $+\infty$, $-\infty$ or "does not exist"

\begin{multicols}{2}
\begin{enumerate}
 \item $\ds \lim_{x\to \infty}\ \frac{6x-4}{2x+5}$
\item $\ds \lim_{x\to\infty}\ x^3-10x^2-6x-2$
\item $\ds \lim_{x\to\infty}\ \frac{x^2-x+4}{3x^2+2x-3}$
\item $\ds \lim_{x\to\infty}\ \frac{\sqrt{x+2}}{\sqrt{3x+1}}$
\item $\ds \lim_{x\to\infty}\ x-\sqrt{x}$
\item $\ds \lim_{x\to\infty}\ \sqrt[3]{x+2}$
\item $\ds \lim_{x\to 0_-}\ 1+\frac{1}{x}$
\item $\ds \lim_{x\to 0}\ \frac{1}{x^2}-\frac{1}{x}$
\item $\ds \lim_{x\to 0}\ \frac{1+2x^{-1}}{7+x^{-1}-5x^{-2}}$
\item $\ds \lim_{x\to 2}\ \frac{1-x}{2-x}$
\item $\ds \lim_{x\to 3_+}\ \frac{x+1}{(x-2)(x-3)}$
\item $\ds \lim_{x\to 3}\ \frac{x+1}{(x-2)(x-3)}$
\item $\ds \lim_{x\to 1}\ \frac{3x^2+4}{x^2+x-2}$
\item $\ds \lim_{x\to 2_+}\ \frac{x^2+4}{x^2-4}$
\item $\ds \lim_{x\to \infty}\ \sqrt{x^2+1}-x$
\item $\ds \lim_{x\to -\infty}\ \sqrt{x^2+1}-x$
\item $\ds \lim_{x\to\infty}\ \sqrt{x^2-3x+2}-\sqrt{x^2+1}$
\item $\ds \lim_{x\to \infty}\ \sqrt[3]{x+4}-\sqrt[3]{x}$
% \item $\ds \lim_{x\to\infty}\ \cos\left(\frac{1}{x}\right)$
% \item $\ds \lim_{x\to \pi/2_+}\ \tan(x)$
% \item $\ds \lim_{x\to 0_+}\ \frac{\cos(x)}{x}$
\end{enumerate}
\end{multicols}}


\Pract{hospital}{
Evaluate using de L'Hospital's rule.
\begin{multicols}{2}
 \begin{enumerate}
\item $\ds \lim_{x\to 0}\frac{\sqrt{9+x}-3}{x}$
\item $\ds \lim_{x\to 2}\frac{2-\sqrt{x+2}}{4-x^2}$
\item $\ds \lim_{u\to\infty}\frac{\sqrt{u+1}+\sqrt{u-1}}{u}$
\item $\ds \lim_{x\to 0}\frac{(1-x)^{1/4}-1}{x}$
\item $\ds \lim_{t\to 0_+}\left(\frac{1}{t}+\frac{1}{\sqrt{t}}\right)(\sqrt{t+1}-1)$
\item $\ds \lim_{u \to 1}\frac{(u-1)^3}{u^{-1}-u^2+3u-3}$
\item $\ds \lim_{u\to 0_+}\frac{1+5/\sqrt{u}}{2+1/\sqrt{u}}$
\item $\ds \lim_{x\to\infty}\frac{x+x^{1/2}+x^{1/3}}{x^{2/3}+x^{1/4}}$
\item $\ds \lim_{t\to\infty}\frac{1-t/(t-1)}{1-\sqrt{t/(t-1)}}$
% \item $\ds \lim_{x\to 0}\frac{\sin(2x)}{x}$
% \item $\ds \lim_{x\to 0}\frac{\tan(x)}{x}$
% \item $\ds \lim_{\theta\to\pi/2}\frac{\cos(\theta)}{\pi/2-\theta}$
 \end{enumerate}
\end{multicols}
}


\chapter{More on integration}



\definition{ The $\infty$ symbol in the bounds of an integral indicates a limit.
\[\int_a^\infty f(x)\cdot dx=\lim_{n\to\infty}\int_a^n f(x)\cdot dx\]}

This is calculated by taking ultralarge $N$ in $\int_a^N$ and taking the observable part of the result (if it exists and is independent of $N$).

\exo{
Check that an derivative of $x\mapsto\dfrac{x}{x+1}$ is
$x\mapsto\dfrac{1}{(x+1)^2}$.


Sketch the curve of $f:x\mapsto \dfrac{1}{(x+1)^2}$ for $x>0$. 

Calculate the area under $f$ between 0 and 10. 

Calculate the area under $f$ between 0 and $+\infty$
}

% \exo{
% \begin{enumerate}
% \item Check that the derivative of $\dfrac{x}{x+1}$ is
% $\dfrac{1}{(x+1)^2}$.
% \item
% Sketch the curve of $f:x\mapsto \dfrac{1}{(x+1)^2}$ for $x>0$. 
% \item
% Calculate the area under $f$ between 0 and 10. 
% 
% 
% \item Calculate the area under $f$ between 0 and $\infty$.
% \end{enumerate}
% }
% 
% \exo{
% The gravitation acceleration is $g\approx 9.81 m/s^2$
% 
% \begin{enumerate}
% \item Using the acceleration $g$, find the function that gives the
% velocity of a falling object, with respect to time (considering no air friction).
% \item Find the function that gives the position of a falling object,
% with respect to time.
% \item
% How far has an object fallen after $10s$?
% \item What is its velocity after $10s$?
% \end{enumerate}
% }



\exo{
Do infinitely long objects have a finite area?
\begin{enumerate}
\item Calculate the area under $f:x\mapsto  \frac{1}{x^2}$ between $x=1$ and
$x=\infty$, i.e: show that this area  does not depend
on which ultralarge is chosen.

\item Without any calculation, explain why the total length of both sides (the
curve above and the straight line below) is infinite.

\item Does this prove that a finite amount of paint would be enough to cover
the area but not enough to paint the border lines? 
\end{enumerate}
}


\bigskip


%===================================================




\definition{
If the function to integrate is not defined at one of the bounds, then

\[\int_a^bf(x)\cdot dx=\lim_{u\to a_+}\int_u^bf(x)\cdot dx\]
or \[\int_a^bf(x)\cdot dx=\lim_{u\to b_-}\int_a^uf(x)\cdot dx\]
}

\exo{
Evaluate the integrals:
\begin{enumerate}
\begin{multicols}{3}[]
\item $\ds\int_0^1 2x^{-2}\cdot dx$
\item $\ds\int_{-2}^3 u^{-3}\cdot  du$
\item $\ds\int_{-1}^{2} -5(t+1)^{-1/4}\cdot dt$
\item $\ds\int_0^4 \frac{1}{2 \sqrt{x}}\cdot dx$
\end{multicols}
\end{enumerate}
}

\exo{
In the following problems an object moves along the $y$
axis. Its velocity varies with respect to the time. Find how far the
object moves between the given times $t_0$ and $t_1$.

\begin{enumerate}
\columnsep=50pt
\begin{multicols}{2}[]
\item $\ds v=2t+5 \hfill t_0=0 \quad t_1=2$
\item $\ds v=4-t \hfill t_0=1 \quad t_1=4$
\item $\ds v=3 \hfill t_0=2 \quad t_1=6$
\item $\ds v=3t^2 \hfill t_0=1 \quad t_1=3$
\item $\ds v=10t^{-2} \hfill t_0=1\quad t_1=100$
\end{multicols}
\end{enumerate}
}



\section*{Antiderivative of $x\mapsto\dfrac{1}{x}$}

% We already saw how the exponential $a^x$ (exercise \ref{expon}) can be defined, and consequently how a corresponding logarithm function can be defined. 

\bigskip

Let $n$ be a positive integer. From $(x^{n+1})' = (n+1)
\cdot x^{n}$ we can deduce
\[ \int x^n \cdot dx = \frac{1}{n+1} x^{n+1} + C, \quad n \neq -1.\]
Hence an antiderivative of $x \mapsto \dfrac{1}{x}$ is not a particular case of this formula.


\exo{\label{expexp}
Let  $f$ be an antiderivative of $x\mapsto\frac{1}{x}$ (why is there one?). Then  $f$ is strictly increasing (why?) and so it has an inverse, call it $g$. Show that this implies $g'(x)=g(x)$.
}



\exo{
Let $a, b > 0$.
Use the substitution $u = \frac{t}{a}$ to show that (considering $f$ to be the antiderivative of $\frac{1}{x}$.)
\[\int_a^{a\cdot b} \frac{1}{t}\cdot dt=\int_1^b\frac{1}{u}\cdot du.\]
Deduce that  $f(a\cdot b) = f(a) + f(b)$.
}


\exo{
Let $a>0$ and $b$ a rational number. Show that (considering $f$ to be the antiderivative of $\frac{1}{x}$.)

\[
f(a^b) = b \cdot f(a).
\]

(To find the substition, consider the transformation of the bounds.)
}


\exo{What kind of function has the properties $f(a\cdot b)=f(a)+f(b)$ and $f(a^b)=b\cdot f(a)$?}

\theorem{\label{ln}
The antiderivative $f$ of $\frac{1}{x}$ satisfies the following limits:
\[
\lim_{x \rightarrow 0^+} f(x) = - \infty
\quad \text{ and }\quad
\lim_{x\rightarrow +\infty} f(x) = + \infty.
\]}

\exo{
Prove theorem \ref{ln}. Hint: for ultralarge $x$ use ultralarge $N$ such that $2^N\leq x$.
}

\definition{The \textbf{natural logarithm} is the function
$\ln : ]0;+\infty[ \rightarrow \mathbb{R}$ defined by
$$x \mapsto \int_1^x \frac{1}{t} \cdot dt.$$
}\index{logarithm}



\definition{We define $e$ to be the unique number such that
\[
\ln(e) = 1.
\]
}\index{exponential}

 $e$ is an irrational number whose first digits are
$$e= 2.71828 \dots$$






\definition{The \textbf{exponential} function 
$\exp : \mathbb{R} \longrightarrow ]0;+\infty[$ is defined as the inverse of $ln$.}

Thus $\ln$ is in fact $\log_e$ and $\ln(e)=1$.

We have, for rational $x$, that $a^x=\exp(x\ln(a))$, hence $e^x=\exp(x)$. For irrational $x$, we \textbf{define} $a^x$ to be $\exp(x\ln(a))$ hence also $e^x=\exp(x)$ for all $x$.

We also have $\ln(a^y) = y\cdot \ln(a)$ for all $y$. Writing
$x=a^y$ we get $\ln(x)=\log_a(x)\cdot \ln(a)$ so $\log_a(x)=\frac{\ln(x)}{\ln(a)}$.





\theorem{\label{expp}
\begin{enumerate}
\item
Let $b \in \mathbb{R}$. The function $x \mapsto x^b$ is differentiable on its domain and  $(x^b)' = b \cdot x^{b-1}$, for all $x \in  \mathbb{R}$.
\item
Let $a > 0$. The base $a$ exponential is differentiable on its domain and
$(a^x)' = \ln(a)\cdot a^x$, for $x > 0$.
\item Let $a > 0$. The base $a$ logarithm is differentiable and $(\log_a(x))' = \frac{1}{\ln(a) \cdot x}.$
\end{enumerate}}

\exo{Prove  theorem \ref{expp}.}


\exo{

Let $f$ be a positive real function whose derivative is continuous. Calculate:
$$\int \frac{f'(x)}{f(x)} \cdot dx$$
}


\exo{Calculate \[\int\tan(x)\cdot dx\]
}


\exo{Let $f$ be a positive real function whose derivative is continuous. Calculate:
$$\int f'(x) \cdot e^{f(x)}\cdot dx$$}


%===================================================

\exo{Using $\ln(x)=1\cdot\ln(x)$, use integration by parts to compute $\int \ln(x)dx$.}

\exo{
\begin{enumerate}
\item Differentiate $\ln(x)$.
\item Differentiate $e^x$.
\item Integrate $x\mapsto e^x$.
\item Differentiate the function $x\mapsto\ln(\ln(x))$.
\item Differentiate the function $x\mapsto\ln(x^a)$ (Note that $a$ is not the
variable!)
\item Differentiate the function $x\mapsto \ln(a^x)$.
\item Differentiate $x\mapsto e^{x^2}$.
\item Using the fact that $u=e^{ln(u)}$ (if $u>0$) differentiate
  $x\mapsto a^x$ (for $a>0$ and $x>0$).
\item Same idea: Differentiate the function $x\mapsto x^x$.
\end{enumerate}
}


\exo{Differentiate $\ln(|x|)$.} 

This proves the following extension:

\theorem{The antiderivative of $\frac{1}{x}$ is $\ln(|x|)+K$ for some constant $K$.}


% 
%============================================================


%===================================================
\section*{Mean value of a function}


The mean value is unambiguous when we consider $n$ points, where
$n$ is a positive integer. We now show that defining the mean
value of a continuous function on $[a;b]$ as
$$\frac{1}{b-a}\int_a^b f(x)\cdot dx$$ is a natural extension of this concept.

Consider a continuous function $f$ and the interval $[a;b]$. Context is
$a,b$ and $f$. Let $N$ be a positive ultralarge integer. Let
$dx=(b-a)/N$ and $x_i = a + i \cdot dx,$ for $i = 1, \dots, N$.
Then the mean value of the function can be approximated by the
mean value of the $N$ points $f(x_i)$, $i = 0, \dots, N-1$. But

$$\frac{\ds\sum_{i=0}^{N-1} f(x_i)}{N}=\frac{dx}{b-a}\sum_{i=0}^{N-1} f(x_i)
=\frac{1}{b-a}\sum_{i=0}^{N-1} f(x_i)\cdot
dx\simeq\frac{1}{b-a}\int_a^b f(x)\cdot dx,$$ since $f$ is
continuous on $[a;b]$.

The mean is the part of this number which is observable i.e., the integral. We therefore define:

\definition{
The \textbf{mean value} of a function $f$ continuous on
$[a;b]$ is
$$\frac{1}{b-a}\int_a^b f(x)\cdot dx.$$
}\index{mean value}

The mean value is a number $\mu$ such that the area under the
curve is equal to $\mu\cdot (b-a)$, i.e., the height of a rectangle
of basis $(b-a)$ whose (oriented) area is equal to the integral.

\theorem{\label{intv2}
If $f$ is a function continuous on $[a;b]$, then there
exists a point $c\in[a;b]$ such that $f(c)$ is the mean value of
the function on $[a;b]$.
}


Note that theorem \ref{intv2} is a restatement of theorem \ref{intv} which is the mean value theorem, for the antiderivative of $f$.
When we claim that there is a $c\in [a;b]$ such that
\[
f(c)=\frac{1}{b-a}\int_a^bf(x)\cdot dx, \] we are in fact asserting
that there is a $c\in[a;b]$ such that \[ f(c)\cdot
(b-a)=\int_a^bf(x)\cdot dx=F(b)-F(a),\]
and as $F'(x)=f(x)$, we
conclude that there is a $c\in[a;b]$ such that
$F'(c)\cdot(b-a)=F(b)-F(a)$.

It is also a consequence of lemma \ref{mv}.

\exo{
Calculate the mean value of $x\mapsto x^2$ on $[-4;4]$.
}

\exo{
Calculate the mean value of $x\mapsto x^3$ on $[-4;4]$.
}

\exo{
Let $f:x\mapsto x^2$ and the interval $[0;t]$. Find the value of
$t$ such that the mean value of $f$ over the interval is equal to $\pi$.
}

\exo{
An object falling on earth satisfies the equation
$d(t)=\frac{1}{2}gt^2$ where $g\approx 9.81[m/s^2]$, $t$ is the time
in seconds and $d(t)$ is the vertical distance.

If an object falls for $10s$, what is its average distance from its
initial point?
}



\exo{
An object falling on earth satisfies the equation
$d(t)=\frac{1}{2}gt^2$ where $g\approx 9.81[m/s^2]$, $t$ is the time
in seconds and $d(t)$ is the vertical distance.

If an object falls for $10s$, what is its average distance from its
initial point?
}


\section*{Solid of Revolution}

\begin{center}
\begin{tikzpicture}
% \foreach \x in {0,1,...,10} \draw[gray!20] (\x,0)--(\x,10);
% \foreach \y in {0,1,...,10} \draw[gray!20] (0,\y)--(10,\y);
\draw(5,2)[rotate= 30] ellipse (2 and 4 );
%  \draw(10,2.5)[rotate= 30] ellipse (1 and 2 );
 \draw (8.2,5.35)[rotate=30] arc (-100:103:1 and 2) ;
 \draw (6.3,8.84)[dotted, rotate=30] arc (95:270:1 and 2) ;
\draw[dashed](8.5,2.35)[rotate= 30] ellipse (0.65 and 1.3 );
\draw[dashed](8.1,2.36)[rotate= 30] ellipse (0.6 and 1.2 );
\draw[dashed] (3,4.33) -- (8.2,7.8);
\draw[-latex] (8.2,7.8)--(10,9)node[left]{$x$};
\draw[-latex] (1,3)--(3,4.33)node[below]{$a$}--(3,9)node[below right]{$y$};
\draw[dashed](7.3,7.2) node[below] {$b$}--(7.3,8.75);
\draw (3,7.5) .. controls (5,7) and  (5.5,6)..(7.3,8.75)node[below left]{$f\ $}; 
\draw (2,7.85) .. controls (5,7.2) and  (5,6)..(6.2,8.7);
\draw (5.99,2.2) .. controls (6,5.4) and  (6.4,4.9)..(6.4,5); 
\draw (6.4,5) .. controls (7.2,5.3) and (8,5.4) .. (8.25,5.36);
\draw[dotted] (5.8,6.2)--(5.8,7.1)--(3,5.6);
\draw[dotted] (6.1,6.4)--(6.1,7.35)--(3,5.7);
\draw[->](7,4)node[below]{$x_i$}--(5.8,6.2);
\draw[->](8,4)node[below]{$x_{i+1}$}--(6.1,6.4);
\draw[->](2.5,5)node[left]{$f(x_{i})$}--(3,5.6);
\draw[->](2.3,6)node[left]{$f(x_{i+1})$}--(3,5.7);
\end{tikzpicture}
 \end{center}

\exo{
An area is calculated by approximating the surface by ultrasmall rectangles. To find the formula for the volume of a solid of revolution, proceed in the same manner: consider that the solid is ultraclose to an ultralarge number of ultrathin disks. Find the formula for the volume of a solid of revolution given by a function $f$.}

\exo{
Evaluate the volume of the solid of revolution of
$y=\dfrac{1}{x}$ around the $x$-axis between $x=1$ and $x=10$.
}

\exo{
Evaluate the volume of the solid of revolution of
$y=\dfrac{1}{x}$ around the $x$-axis between $x=1$ and $x=+\infty$ i.e:
take  an ultralarge $N$ then show that the result does
not depend on the choice of $N$.
}
%===================================================

\bigskip
\section*{Arc length}

\exo{
Approximating the length of a curve by ultrasmall straight lines leads to the following definition. Explain why it is a reasonable definition (using the drawing).

\definition{
Let $f: [a;b] \to \mathbb{R}$ be smooth.  Then the graph of $f$ has  length
\[
L = \int_a^b \sqrt{1 + f'(x)^2}\cdot dx.
\]
}}


\begin{center}
\begin{tikzpicture}[scale=2]
\draw[line width=1.2pt](0,0.35) .. controls (1,1) and (2,.9) .. (3,.8); 
\draw (0.5,0.62)-- (0.5,0)node[below]{$x_i$};
\draw (2,0.88)-- (2,0)node[below]{$x_{i+1}$};
\draw (0.5,0.62)-- (2,0.88);
\draw [dashed] (0.5,0.62)-- (3.1,0.62)node[right]{$f(x_{i})$};
\draw [dashed] (2,0.87)-- (0.14,0.87)node[left]{$f(x_{i+1})$};
\end{tikzpicture}
 \end{center}




\exo{
Find the lengths of the following curves:
\begin{enumerate}
\item $\ds y=2x^{3/2} \quad 0\leq x\leq 1$
\item $\ds y=\frac{2}{3}(x+2)^{\frac{3}{2}}\quad 0\leq x\leq 3$
\end{enumerate}
}

\newpage
\Pract{antideriv}{
Find the antiderivatives of the following functions:
\begin{multicols}{2}
\begin{itemize}
\item $\ds f_a :x\mapsto 5x^4-2x+4$
\item $\ds f_b :x\mapsto x^3-5x^2+3x-2$
\item $\ds f_c :x\mapsto 2x-1$
\item $\ds f_d :x\mapsto
\frac{5}{4}x^4-\frac{3}{4}x^2+\frac{5}{2}x+\frac{3}{2}$
\item $\ds f_e :x\mapsto 2x+1-\frac{1}{x^2}$
\item $\ds f_f :x\mapsto 3+\frac{2}{x^2}-\frac{5}{x^3}$
\item $\ds f_g :x\mapsto x^3+\frac{1}{x^2}$
\item $\ds f_h :x\mapsto \sqrt[3]{x}+\frac{1}{\sqrt[3]{x}}$
\item $\ds f_i :x\mapsto \frac{1}{\sqrt{x}}+\sqrt{x}$
\item $\ds f_j :x\mapsto (x+1)^2$
\item $\ds f_k :x\mapsto 15(3x-2)^4$
\item $\ds f_l :x\mapsto (2x+1)^3$
\item $\ds f_m :x\mapsto (3-x)^{11}$
\item $\ds f_n :x\mapsto (3-4x)^4$
\item $\ds f_o :x\mapsto \sqrt{3x-2}$
\item $\ds f_p :x\mapsto \frac{1}{\sqrt{x-1}}$
\item $\ds f_q :x\mapsto 4x(3-x^2)^5$
\item $\ds f_r :x\mapsto (2x-3)(x^2-3x+1)^4$
\item $\ds f_s :x\mapsto (3x^2-4x+1)(x^3-2x^2+x+3)^2$
\item $\ds f_t :x\mapsto (4x^2-5x)^2(16x-10)$
\item $\ds f_u :x\mapsto (3x-1)(3x^2-2x+5)^3$
\item $\ds f_v :x\mapsto \frac{2x}{(x^2+1)^2}$
\item $\ds f_w :x\mapsto \frac{2x+1}{(x^2+x+3)^2}$
\item $\ds f_x :x\mapsto x\sqrt{x^2+1}$
\item $\ds f_y :x\mapsto \frac{3x^2}{\sqrt{9+x^3}}$
\item $\ds f_z :x\mapsto (3x^2+1)\sqrt{x^3+x+2}$
\item $\ds f_A :x\mapsto e^{2x}$ 
\item $\ds f_B :x\mapsto \frac{1}{e^{3x}}$ 
\item $\ds f_C :x\mapsto xe^{-x^2}$ 
\item $\ds f_D :x\mapsto 2^{-x}$ 
\item $\ds f_E :x\mapsto e^{2x}\sqrt{1+e^{2x}}$ 
\item $\ds f_F :x\mapsto x^2e^x$ 
\item $\ds f_G :x\mapsto e^x\sin(x)$ 
\item $\ds f_H :x\mapsto \frac{e^x}{1+e^{2x}}$
\item $\ds f_I :x\mapsto \frac{1}{2x+3}$ 
\item $\ds f_J :x\mapsto \frac{2x}{x-1}$ 
\item $\ds f_K :x\mapsto \frac{x-1}{x+1}$ 
\item $\ds f_L :x\mapsto (\ln(x))^2$ 
\item $\ds f_M :x\mapsto \frac{\cos(x)}{1+\sin(x)}$
\item $\ds f_N :x\mapsto \ln(x)$ 
\item $\ds f_O :x\mapsto \frac{x}{x+1}$ 
\item $\ds f_P :x\mapsto \frac{1}{x\ln(x)}$ 
\end{itemize}
\end{multicols}
}

%===================================================


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Curve Sketching}

\Pract{curve2}{
Sketch the following

\begin{multicols}{2}[]
\begin{itemize}

\item $\ds g_1:x\mapsto x\ln(x)$

\item $\ds g_2:x\mapsto \frac{x}{\ln(x)}$

\item $\ds g_3:x\mapsto \frac{e^x}{\ln(x)}$

\item $\ds g_4:x\mapsto \frac{\sin(\sqrt{x})}{e^x}$

\item $\ds g_{5}:x\mapsto \sin(\cos(x))$

\item $\ds g_{6}:x\mapsto \cos(\sin(x))$

\item $\ds g_{7}:x\mapsto  \frac{e^x}{1+e^x}$

\item $\ds g_{8}:x\mapsto  \frac{1}{1+e^x}$

\item $\ds g_{9}:x\mapsto  \ln(x^2+1)$

\item $\ds g_{10}:x\mapsto  \frac{e^x}{x-2}$

\item $\ds g_{11}:x\mapsto  e^{-x^2}$

\item $\ds g_{12}:x\mapsto  \frac{x\cdot e^x}{\ln(x)}$

\end{itemize}
\end{multicols}
}

\newpage

\section*{Answers to practice exercises}


\sol{limits}{
\begin{multicols}{3}
\begin{enumerate}
\item $3$
\item $\infty $
\item $1/3$
\item $1/\sqrt{3}$
\item $\infty$
\item $\infty$
\item $-\infty$
\item $\infty$
\item $0$
\item does not exist
\item $\infty$
\item does not exist
\item does not exist
\item $\infty$
\item $0$
\item $\infty$
\item $0$
\item $-3/2$
%\item $0$
% \item $1$
% \item $-\infty$
% \item $\infty$
 \end{enumerate}
\end{multicols}

}

\sol{hospital}{
\begin{multicols}{3}
 \begin{enumerate}
  \item $1/6 $
 \item $1/16 $
 \item $0 $
 \item $-1/4 $
 \item $1/2 $
 \item $-1 $
 \item $5 $
 \item $\infty $
  \item $2 $
%  \item $2 $
%  \item $1 $
%  \item $2 $ 
\end{enumerate}
\end{multicols}
}



\sol{antideriv}{(Integration constant to be added)
\begin{multicols}{2}
\begin{itemize}
\item $\ds F_a :x\mapsto x^5-x^2+4x$
\item $\ds F_b :x\mapsto \frac{1}{4}x^4-\frac{5}{3}x^3+\frac{3}{2}x^2-2x$
\item $\ds F_c :x\mapsto x^2-x$
\item $\ds F_d :x\mapsto
\frac{1}{4}x^5-\frac{1}{4}x^3+\frac{5}{4}x^2+\frac{3}{2}x$
\item $\ds F_e :x\mapsto x^2+x+\frac{1}{x}$
\item $\ds F_f :x\mapsto 3x-\frac{2}{x}+\frac{5}{2x^2}$
\item $\ds F_g :x\mapsto \frac{x^4}{4}-\frac{1}{x}$
\item $\ds F_h :x\mapsto \frac{3}{4}\sqrt[3]{x^4}+\frac{3}{2}\sqrt[3]{x^2}$
\item $\ds F_i :x\mapsto 2\sqrt{x}+\frac{2}{3}\sqrt{x^3}$
\item $\ds F_j :x\mapsto \frac{1}{3}(x+1)^3$
\item $\ds F_k :x\mapsto (3x-2)^5$
\item $\ds F_l :x\mapsto \frac{1}{8}(2x+1)^4$
\item $\ds F_m :x\mapsto -\frac{1}{12}(3-x)^{12}$
\item $\ds F_n :x\mapsto -\frac{1}{20}(3-4x)^5$
\item $\ds F_o :x\mapsto \frac{2}{9}\sqrt{(3x-2)^3}$
\item $\ds F_p :x\mapsto 2\sqrt{x-1}$
\item $\ds F_q :x\mapsto -\frac{1}{3}(3-x^2)^6$
\item $\ds F_r :x\mapsto \frac{1}{5}(x^2-3x+1)^5$
\item $\ds F_s :x\mapsto \frac{1}{3}(x^3-2x^2+x-3)^3$
\item $\ds F_t :x\mapsto \frac{2}{3}(4x^2-5x)^3$
\item $\ds F_u :x\mapsto \frac{1}{8}(3x^2-2x+5)^4$
\item $\ds F_v :x\mapsto -\frac{1}{x^2+1}$
\item $\ds F_w :x\mapsto -\frac{1}{x^2+x+3}$
\item $\ds F_x :x\mapsto \frac{1}{3}\sqrt{(x^2+1)^3}$
\item $\ds F_y :x\mapsto 2\sqrt{9+x^3}$
\item $\ds F_z :x\mapsto \frac{2}{3}(x^3+x+2)\sqrt{x^3+x+2}$
\item $\ds F_A :x\mapsto \frac{e^{2x}}{2}$
\item $\ds F_B :x\mapsto -\frac{1}{3e^{3x}}$
\item $\ds F_C :x\mapsto -\frac{e^{-x^2}}{2}$
\item $\ds F_D :x\mapsto -\frac{1}{\ln(2)}2^{-x}$
\item $\ds F_E :x\mapsto \frac{1}{3}(e^{2x}+1)^{\frac{3}{2}}$
\item $\ds F_F :x\mapsto e^x(x^2-2x+2)$
\item $\ds F_G :x\mapsto \frac{e^x}{2}\left(\sin(x)-\cos(x)\right)$
\item $\ds F_H :x\mapsto \arctan(e^x)-\frac{\pi}{2}$
\item $\ds F_I :x\mapsto \frac{\ln(x+\frac{3}{2})}{2}$
\item $\ds F_J :x\mapsto 2x+2\ln(x-1)$
\item $\ds F_K :x\mapsto x-2\ln(x+1)$
\item $\ds F_L :x\mapsto 2x\left(\frac{\ln(x)^2}{2}-\ln(x)+1\right)$
\item $\ds F_M :x\mapsto \ln(\sin(x)+1)$
\item $\ds F_N :x\mapsto x\ln(x)-x$
\item $\ds F_O :x\mapsto x-\ln(x+1)$
\item $\ds F_P :x\mapsto \ln(\ln(x))$
\end{itemize}

\end{multicols}
}

\sol{curve2}{

\begin{tikzpicture}[xscale=1.2,yscale=0.8] 
\clip(-0.5,-2.5) rectangle (2.5,2.5);
\draw(1,1)node{($g_1$)};
\draw[-latex] (-2.5,0) -- (2.5,0) node[right] {$x$} ; 
\draw[-latex] (0,-2) -- (0,2) node[above] {$y$}; 
\draw[thick] plot[domain=0.05:2.5](\x, {\x*ln(\x)}) ;	
\end{tikzpicture}
\hfill
\begin{tikzpicture}[xscale=0.4,yscale=0.4] 
\clip(-2,-5) rectangle (8,5);
\draw(3,1)node{($g_2$)};
\draw[-latex] (0,0) -- (8,0) node[right] {$x$} ; 
\draw[-latex] (0,-5) -- (0,4) node[above] {$y$} ; 
\normalsize	
\draw[thick] plot[raw gnuplot] function{plot[x=0.05:0.9]( x/log(x))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=1.1:8]( x/log(x))} ;
\draw[dashed](1,-5)--(1,5);
\end{tikzpicture}\hfill
\begin{tikzpicture}[xscale=0.6,yscale=0.04] 
\clip(-2,-30) rectangle (5,60);
\draw(-1.5,10)node{($g_3$)};
\draw[-latex] (-8,0) -- (5,0) node[right] {$x$} ; 
\draw[-latex] (0,-30) -- (0,50) node[above] {$y$} ; 	
\draw[thick] plot[raw gnuplot] function{plot[x=0.05:0.95]( exp(x)/log(x))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=1.05:5]( exp(x)/log(x))} ;
\draw[dashed](1,-30)--(1,60);
\end{tikzpicture}

\bigskip
\begin{tikzpicture}[xscale=0.8,yscale=2.5] 
\clip(-0.5,-0.2) rectangle (5,1.5);
\draw(1,1)node{($g_4$)};
\draw[-latex] (0,0) -- (5,0) node[right] {$x$} ; 
\draw[-latex] (0,-1) -- (0,1) node[above] {$y$} ; 	
\draw[thick] plot[raw gnuplot] function{plot[x=0:5]( sin(sqrt(x))/exp(x))} ;
\end{tikzpicture}
\hfill
\begin{tikzpicture}[xscale=0.2,yscale=1] 
\draw(-8,1)node{($g_{5}$)};
\draw[-latex] (-10,0) -- (10,0) node[right] {$x$}; 
\draw[-latex] (0,-1.5) -- (0,1.5) node[above] {$y$} ; 	
\draw[thick] plot[raw gnuplot] function{plot[x=-8:8]( sin(cos(x)))} ;
\end{tikzpicture}\hfill
\begin{tikzpicture}[xscale=0.2,yscale=1] 
\draw(-8,2)node{($g_{6}$)};
\draw[->] (-10,0) -- (10,0) node[right] {$x$}; 
\draw[->] (0,-1) -- (0,2) node[above] {$y$} ; 	
\draw[thick] plot[raw gnuplot] function{plot[x=-8:8]( cos(sin(x)))} ;
\end{tikzpicture}


\bigskip
\begin{tikzpicture}[xscale=0.3,yscale=2] 
\draw(-4,1)node{($g_{7}$)};
\draw[-latex] (-5,0) -- (5,0) node[right] {$x$} ; 
\draw[-latex] (0,-0.2) -- (0,1) node[above] {$y$} ; 	
\draw[thick] plot[raw gnuplot] function{plot[x=-5:5](exp(x)/(1+exp(x)))} ;
\end{tikzpicture}
\hfill
\begin{tikzpicture}[xscale=0.2,yscale=2] 
\draw(-8,0.5)node{($g_{8}$)};
\draw[-latex] (-10,0) -- (10,0) node[right] {$x$} ; 
\draw[-latex] (0,-0.2) -- (0,1) node[above] {$y$} ; 	
\draw[thick] plot[raw gnuplot] function{plot[-8:8](1/(1+exp(x)))} ;
\end{tikzpicture}\hfill
\begin{tikzpicture}[xscale=0.2,yscale=0.5] 
\draw(-10,1)node{($g_{9}$)};
\draw[-latex] (-10,0) -- (10,0) node[right] {$x$} ; 
\draw[-latex] (0,-1) -- (0,5) node[above] {$y$} ; 
\draw[thick] plot[raw gnuplot] function{plot[x=-8:8]( log(x**2+1))} ;
\end{tikzpicture}

\bigskip
\begin{tikzpicture}[xscale=0.6,yscale=0.1]
\clip(-3,-5) rectangle (5,25); 
\draw(-2,2)node{($g_{10}$)};
\draw[-latex] (-2.5,0) -- (5,0) node[right] {$x$} ; 
\draw[-latex] (0,-5) -- (0,4) node[above] {$y$} ; 	
\draw[thick] plot[raw gnuplot] function{plot[x=-2.5:1.9]( exp(x)/(x-2))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=2.1:5]( exp(x)/(x-2))} ;
\draw[dashed](2,-3)--(2,25);
\end{tikzpicture}
\hfill
\begin{tikzpicture}[xscale=0.5,yscale=1.5] 
\draw(-3.5,0.5)node{($g_{11}$)};
\draw[-latex] (-4,0) -- (4,0) node[right] {$x$} ; 
\draw[-latex] (0,-0.5) -- (0,1.5) node[above] {$y$}; 	
\draw[thick] plot[raw gnuplot] function{plot[x=-4:4](exp(-x**2))} ;
\end{tikzpicture}\hfill
\begin{tikzpicture}[xscale=0.8,yscale=0.05] 
\clip(-1,-20) rectangle (5,50); 
\draw(-0.5,10)node{($g_{12}$)};
\draw[-latex] (-1,0) -- (3,0) node[right] {$x$} ; 
\draw[-latex] (0,-20) -- (0,40) node[above] {$y$} ; 	
\draw[thick] plot[raw gnuplot] function{plot[x=0.05:0.9](x*exp(x)/(log(x)))} ;
\draw[thick] plot[raw gnuplot] function{plot[x=1.05:5](x*exp(x)/(log(x)))} ;
\draw[dashed](1,-20)--(1,40);
\end{tikzpicture}
}

\vfill
%=====================================


\pagebreak
\null
%\newpage
%\addcontentsline{toc}{part}{Index}
%\printindex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}


\Theorem{Increment Equation}{If $f$ is differentiable at $a$, then
\[f(a+dx)=f(a)+f'(a)\cdot dx+\varepsilon\cdot dx\qquad \text{ where } \varepsilon\simeq 0\]
}

Consider a continuous function $F$ and the variation of $F$ between $x$ and $x+dx$. If $f=F'$ the increment equation yields $\Delta F(x)=f(x)\cdot dx+\varepsilon\cdot dx$.



\begin{center}
\begin{tikzpicture}[scale=2]
\draw [line width=1.2pt] [smooth,domain=-0.8:1.2] plot(\x,{0.35*\x^3+0.2*\x-0.15});
\draw (-1,-1)--(1.5,-1);
\draw (1.35,1)node{$F$};
\draw[dashed](.5,-1.3)node[below]{$x$}--(.5,0);
\draw[dashed](-1,0)--(1.2,0)node[right]{$F(x)$};
\draw[dashed] (0.95,-1)node[below ]{$x+dx$}--(0.95,0.35);
\draw[dashed](-1,0.35)--(1.7,0.35)node[right]{$F(x+dx)$};
\draw[<->](-1,0.35)--node[left]{$\Delta F(x)$}(-1,0);
\draw(0.1,-0.23)--(2.2,0.9)node[right]{tangent to F at $x$};
\draw[latex-](0.95,0.23)--(1.5,0.23)--(2.5,0.)node[below right]{$F(x)+f(x)\cdot dx$};
\draw(-1,-1.7)node[below,right]{$\Delta F(x)=f(x)\cdot dx+\varepsilon\cdot dx$};
\end{tikzpicture}
\end{center}


