\documentclass[11pt,a4paper,twoside]{book}
\renewcommand\familydefault{iwona}\selectfont
\renewcommand\sldefault{it}
\usepackage[T1]{fontenc}
\usepackage{a4wide,theorem,amsmath,amssymb,tikz,etoolbox,multicol}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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
}{}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\exofont}{}%\fontfamily{cmbr}\selectfont}

\usepackage{fancyhdr}

\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{\limo}{\lim_{h\rightarrow 0}}
\newcommand{\lima}{\lim_{x\rightarrow a}}
 \newcommand{\Lim}[3]{\lim_{\substack{#1\to#2\\#1#3#2}}}
% \newcommand{\caution}{{\LARGE \fbox{\textbf{!}}} }
\newcommand{\caution}{{\Huge \ensuremath{\bigtriangleup}}\hspace{-13pt}\begin{minipage}{4pt}\vspace{-7pt}\textbf{!}\end{minipage}\qquad } 
%============================================================
%
%
%

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


\begin{document}

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

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

with ultrasmall numbers\end{center}

\addcontentsline{toc}{part}{Part I}
\begin{center}
Standard Level

\Large{PART I}
\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, 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  copyleft license.






\tableofcontents

%========================================================
\chapter{Introduction}
\section{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.


\bigskip

A curve can be approximated by a piecewise linear function whose slope is easily calculated by pieces. It can also approximated by a ``staircase'' function whose area is calculated by adding the areas of the rectangles. 

\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}
\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}



\bigskip
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?




\section{Tiny and Huge}


%\exo{The time it takes for a falling object to reach the ground depends on the height from which it is dropped. It does not depend on its weight. The relation is usually given the other way round: the height depends on how long the object fell. This is given by a well known formula:
%\[h(t)=\frac{1}{2}\cdot g\cdot t^2\]
%where $g\approx 9.81 m/s^2$. (The value $g$ is specific to planet Earth.)
%
%Assume $g$ is rounded to 10. An object falling for 2 seconds covers a vertical distance of $\frac{1}{2}\cdot 10\cdot 2^2=20 m$
%
%\begin{itemize}
%\item Check the units in the previous operation.
%\item The average velocity over those 2 seconds was $10 m/s$. Why?
%\item What is the average velocity during the first second?
%\item What is the average velocity during the last second?
%\item What is the velocity when the object hits the ground?
%\end{itemize}
%
%
%}

\exo{
If $\delta$ is a positive value which is really tiny (even tinier 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...}
}


\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}
}

\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{
Let $f:x\mapsto x^2$,  and let $\delta$ be vanishingly small and positive.

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

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

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

Show, on the drawing, the values $2$ and $f(2)$,  $2+\delta$ and $f(2+\delta)$,  $2-\delta$ and
$f(2-\delta)$.
\item Similar question for a zoom centred on $\langle 0;0\rangle $.
\item Similar question for a zoom centred on $\langle -1;1\rangle $.
\end{enumerate}
}

\exo{
Draw  the result of zooms so that a tiny $\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\leq 0$}\\
  1 & \text{if $x>0$}
  \end{cases}$$
}

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 --
\begin{center}
$\boxed{f(a)\quad \text{is observable}}$
\end{center}
This refers to the context, by the word "observable".  The only parameters of this property are $f$ and $a$. This is the context.

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{
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}$.
}
\newpage
\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 level, 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 level.
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 the reference to a level 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 level independently of the 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
\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}}




%%%%%%%%%%%%%%%%%%\varepsilon\cdot\delta%%%%%%%%%%%%%%
\chapter{Derivatives}

 \tproof{\textit{The goal of this chapter is to give meaning to the definition of the derivative. Nothing about the derivative will be assumed other than the definition. Differentiation rules will be proved later.}
 
 \textit{This chapter contains no theorem and no proof.}
 }

We will often use $\Delta x$ to indicate an ultrasmall \textit{increment}\footnote{increment: a positive or negative change in a variable.} of the variable $x$. It may be positive or negative but will never be chosen to be $0$.


\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$, (for $\Delta x$ ultrasmall as mentioned above) 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 observable value is this slope ultraclose to?
\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 
\[\frac{f(a+\Delta x)-f(a)}{\Delta x}\simeq D\]
not depending on ultrasmall $\Delta x$.

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

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


\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 can't see.

\exo{
Using definition \ref{derivative} calculate the derivative of:
 $f:x\mapsto 3x^2+x-5$ \qquad at $x=-2$ and $x=2$.}


\exo{
Using definition \ref{derivative} calculate the derivatives (if they exist) of the following:
\begin{enumerate}
\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-3x-2$. 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.
}

\Pract{deriv0}{
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}

}


\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, if there is one, the division is \textbf{always} between two ultrasmall numbers. They \underline{cannot} be replaced by 0 since $\frac{0}{0}$ is not defined.

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

\chapter{Continuity}\label{conti}


Informally: a function is continuous if it is where you would expect it to be by observing where it is just before and just after.


\Definition{Continuity \label{Dcontinuity1}}{
Let  $f$ be a real function defined around $a$. We say that \textbf{$f$ is continuous at $a$} if
 \[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$.
% Note that this does not depend on $x$ as long as it satisfies the condition of being ultraclose to $a$.



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

\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:\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:\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}

}



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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\chapter{Continuity continued}


\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{The converse of theorem \ref{continuity} does not necessarily hold.
% Find functions $f$ and $g$ (either by a rule or graphically) such that
% \begin{enumerate}
%  \item $f+g$ is continuous at 1 but at least one of $f$ or $g$ is not continuous at 1.
% \item $f \cdot g$  is continuous at 1 but at least one of $f$ or $g$ is not continuous at 1.
% \item
% $\ds\frac{f}{g}$  is continuous at 1 but at least one of $f$ or $g$ is not continuous at 1 (with $g(1)\not=0$).
% \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)$.}

\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$.


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

\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, using the definition of continuity, 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.}



% \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 that $x\mapsto\sqrt{x}$ is continuous on its domain i.e, for any value $x=a$ in the domain.
}

\chapter{Derivative Functions}
\definition{
If a function is differentiable on a given interval $I$, then for any $x\in I$ the value $f'(x)$ exists. Hence we can define \textbf{the derivative function} by 
\[f':x\mapsto f'(x)\]}\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$ -- 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$.

Hence
\[\frac{\Delta f(a)}{\Delta x}= f'(a)+\varepsilon \text{ with }\varepsilon\simeq 0 \]
and we also have the form
\[\Delta f(a)=f'(a)\cdot \Delta x+\varepsilon\cdot\Delta x\]
which is called \textbf{the increment equation}.

\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 is merely to help the mind.

\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}
}


\Pract{deriv1}{
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{
A factory wants to make cardboard boxes (with no top) out of sheets of $30cm
\times 16cm$

\begin{center}
% \includegraphics[width=5cm]{images/box}
\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{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 which is indistinguishable from the curve. This line is the tangent line. 

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

It is the only straight line $T$ which 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{
%Differentiate
%
%\begin{enumerate}
%\item 
%$f:x\mapsto \frac{1}{x}$ for $x=1$, $x=2$ and at general $x$.
%
%\item $g:x\mapsto \frac{1}{3x+2}$ for $x=0$, $x=1$ and at general $x$.
%
%\item $h:x\mapsto \frac{1}{x^2}$ for $x=1$, $x=-1$ and at general $x$.
%\end{enumerate}
%}
%
%
%\exo{Using the definition of the derivative, differentiate
%\[f:x\mapsto \sqrt{x}\]
%
%Hint: you will need to multipl and divide by $\sqrt{x+\Delta x}+\sqrt{x}$ to be able to conclude.
%}





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

\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 +\Delta x$ is $\Delta A(x)$.



\begin{center}
\begin{tikzpicture}[yscale=0.25]
\draw[fill=gray!50, line width=0pt, smooth, samples=100, domain=1:2] (1,0)--plot(\x,{3*\x^2+1})--(2,0);
\draw[fill=gray!30, line width=0pt, smooth, samples=100, domain=2:2.5] (2,0)--plot(\x,{3*\x^2+1})--(2.5,0);
\draw[line width=1pt, smooth, samples=100, domain=0:3] plot(\x,{3*\x^2+1})node[right]{$f$}--(3,0)--(0,0);
\draw(2,0)--(2,-1)node[below]{2};
\draw(1,0)--(1,-1)node[below]{1};
\draw(2.5,0)--(2.5,-1)node[below right]{$2+\Delta x$};
\draw[-latex](0.5,8)node[left]{$A(2)$}--(1.2,3);
\draw[-latex](4.5,8)node[right]{$\Delta A(2)$}--(2.2,3);
\end{tikzpicture}

(of course $\Delta x$ is drawn much too large so as to understand where it is.)
\end{center}

\exo{
Using  the drawing above, consider $f:x\mapsto 3x^2+1$. We would like to calculate the area between $1$ and $3$.  For this we consider first the area up to $2$ and its variation to $2+\Delta x$.

\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  Generalise to $x$ and determine the equation of $A(x)$ -- the area under $f$ between $1$ and $x$.
\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$.


}

\exo{Calculate the area under $f:x\mapsto x^2$ and above the $x$-axis, between 2 and 5 i.e., $a=2$ and $x=b$. Use that $A(2)=0$}

\newpage
\section*{Answers to practice exercises}

\sol{deriv0}{
\begin{multicols}{2}
\begin{enumerate}
\item 10
\item -70
\item 10
\item 20
\end{enumerate}
\end{multicols}
}

\sol{deriv1}{
\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}
}
%===================================================
%\cleardoublepage
%\null
%
%\vfill
%\begin{center}
%\begin{Huge}\textbf{Analysis} \end{Huge}
%
%with ultrasmall numbers\end{center}
%
%\vfill
%\begin{center}
%Standard Level
%
%\Large{PART II}
%\end{center}
%\vfill



\chapter{Differentiation Rules}\label{diffrul}





\bigskip
Since observable numbers remain observable if we zoom further in, a property is not changed if the context is extended.


\bigskip

\hrule
\bigskip
For the following rules, the proofs proceed by five steps:

\begin{enumerate}
\item Definition of the derivative.
\item Definition of the $\Delta$.
\item Definition of operations on functions.
\item Expansion of $f(a+\Delta x)$ as $f(a)+\Delta f(a)$.
\item Division by $\Delta x$.
\item Algebra.
\end{enumerate}


\bigskip

\hrule
\bigskip
\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. }

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{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\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}{x2}$ (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{
Show that for $m\in\mathbb{Z}$
\[\left(x^m\right)'=m\cdot x^{m-1}. \]}




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

\exo{Find the derivative of \[f:x\mapsto\frac{x}{x^2+1}\] }



\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 bothe 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}

}




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}




The slope of the tangent of the inverse is the reciprocal of the slope of the original tangent: \[\dfrac{\Delta x}{\Delta y}=\dfrac{1}{\quad  \dfrac{\Delta y}{\Delta x}\quad }\]

%\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}

\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{\Delta f^{-1}(b)}{\Delta y}=\frac{1}{f'(a)}.\]
}
In general form:
\[\frac{\Delta f^{-1}(y)}{\Delta y}=\frac{1}{f'(x)}\]






\exo{
Find the derivative of $\ds y=x^{\frac{1}{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$.
}


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





\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 that the derivative must be ultraclose to $\dfrac{\Delta f(c)}{\Delta x}$ whether $\Delta x$ is positive or negative.)
}

\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.
}

\exo{Find the derivative of $f:x\mapsto x^3$ at $x=0$ to see that the converse of theorem \ref{max} does not hold.}
%==========================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
\section*{Optimisation and Other 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 outside 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
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 outside 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.
}


\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$? Is it unique?

\item
If $g:x\mapsto ax^2+b$, what values do $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}
}


\section*{Summary}

\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 $(u\circ v)'=u'\cdot v'$ (in this case, $u$ depends on $v$ which depends on $x$).
\end{itemize}





\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}
}




\chapter{Asymptotes}


\exo{Consider the real 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]$.
\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$ is ultralarge  (horizontal or oblique asymptote).
\item $y$ (or $f(x)$) is ultralarge  (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}\]

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

\[x\simeq a_- \Rightarrow f(x)\text{ is ultralarge}\]
}\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 $\Delta x$ is a positive ultrasmall number then $f(\Delta x)$ is positive ultralarge. Hence 
\[\frac{1}{\Delta x}\text{ is ultralarge}\]
}

\exo{Show that $f:x\mapsto \frac{1}{x-2}$ has a vertical asymptote at $x=2$. 

Give the domain of $f$.}
\exo{Show that \[g:x\mapsto \begin{cases}\dfrac{1}{x-2} & \text{ if } x\neq 2\\ 3 & \text{ if } x=2\end{cases}\] has a vertical asymptote at $x=2$.

Give the domain of $g$.}

\exo{Show that $h:x\mapsto \left(|x|\right)'$ has no vertical asymptote at $x=0$.

Give the domain of $h$.}

From the previous exercises we can see that there is no immediate link between the fact that values are missing in a domain and the existence of asymptotes.

\begin{center}
\begin{tabular}{c |p{3cm}| p{3cm}}
& values missing in domain & asymptote
\\\hline
$f$ & yes & yes 
\\
g & no & yes
\\
h & yes & no
\end{tabular}
\end{center}

\definition{A real function $f$   has a \textbf{horizontal asymptote on the right} (resp. on the left) if there is an observable number $L$  such that
\[x \text{ ultralarge positive (resp. negative) }\Rightarrow  f(x)\simeq L.\]

}


\example{Consider 
\[
\frac{x^2 - 3x +1}{x^2 +1} \text{ for ultralarge $x$}.
\]
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$.}

\exo{Show that $f:x\mapsto \dfrac{x}{x^2+1}$ has a horizontal asymptote at $y=0$.

Find the value of $x$ for which $f$ crosses its horizontal asymptote.}

\bigskip
We now define the oblique asymptote

\definition{A real function $f$ has an \textbf{oblique asymptote at} on the right (resp. on the left)
if there exist observable numbers $a, b$ such that, if $x$ is ultralarge positive (resp. negative), then
\[
f(x) - (ax+b) \simeq 0 
\]
}

The line $y= ax+b$ is the \textbf{oblique asymptote of $f$}

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$,
i.e.,  $a=1$ and $b=2$.}

\newpage
\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$ on the right (resp. on the left) if and only if, for ultralarge positive (resp. negative) $x$, there are observable $a$ and $b$ such that
\[
\frac{f(x)}{x} \simeq  a \quad \text{ and } \quad
 (f(x) - ax ) \simeq b.
\]
}

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

\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$.
}

\exo{
Prove the previous theorem.
}

\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$ on theb right. 

On the left, the function has an oblique asymptote at $y=-x$.}

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

\begin{multicols}{2}
\begin{enumerate}
\item $\ds i:x\mapsto x^{\frac{3}{2}}$
\end{enumerate}
\end{multicols}
}




\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_7:x\mapsto \frac{x^10}{x^10+1}$

\end{enumerate}
\end{multicols}
}



\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+\Delta x)}{g(a+\Delta x)}\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 $f$ and $g$ need not be defined at $x=a$, but
\[x\simeq a\Rightarrow f(x)\simeq 0 \text{ and } g(x)\simeq 0\] (if $g'(x)\not\simeq 0$)
case $\frac{\text{ultrasmall}}{\text{ultrasmall}}$ and also
 for the case $\frac{\text{ultralarge}}{\text{ultralarge}}$.

\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.}

\bigskip
\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 \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}
}

\newpage
\Pract{hospital}{
Evaluate using de L'Hospital's rule.
\begin{multicols}{2}
 \begin{enumerate}
\item $\ds \frac{\sqrt{9+x}-3}{x}$ for $x\simeq 0$
\item $\ds \frac{2-\sqrt{x+2}}{4-x^2}$ for $x\simeq 2$
\item $\ds\frac{\sqrt{u+1}+\sqrt{u-1}}{u}$  for ultralarge $u$
\item $\ds \frac{(1-x)^{1/4}-1}{x}$  for $x\simeq 0$
\item $\ds \left(\frac{1}{t}+\frac{1}{\sqrt{t}}\right)(\sqrt{t+1}-1)$  for $x\simeq 0_+$
\item $\ds \frac{(u-1)^3}{u^{-1}-u^2+3u-3}$  for $u\simeq 1$
\item $\ds \frac{1+5/\sqrt{u}}{2+1/\sqrt{u}}$  for $u\simeq 0_+$
\item $\ds \frac{x+x^{1/2}+x^{1/3}}{x^{2/3}+x^{1/4}}$  for ultralarge $x$
\item $\ds \frac{1-t/(t-1)}{1-\sqrt{t/(t-1)}}$  for ultralarge $t$
 \end{enumerate}
\end{multicols}
}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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 Determine the maximums and minimums.
\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}



\Pract{curve}{
\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}
}


\newpage
\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 $\begin{cases}y=0 & \text{ if } x<0
\\
y=1 & \text{ if } x>0
\end{cases}$
\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 ultralarge 
  \item $2 $
%  \item $2 $
%  \item $1 $
%  \item $2 $ 
\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}
}

%-----------------------------------------------------

\cleardoublepage
\thispagestyle{empty}
\null

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

with ultrasmall numbers\end{center}

\vfill
\addcontentsline{toc}{part}{Part II}
\begin{center}
Standard Level

\Large{PART II}
\end{center}
\vfill


%===================================================
\chapter{Continuity and Differentiability}





\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 explicitly the roots 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$.
}

\tproof{\textit{For standard level, I do not ask for the proof, but I may do it in class.}

\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 is \textbf{smooth} if it is differentiable and its derivative is continuous.}

Almost all functions encountered so far are smooth.


\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 function continuous on $[a;b]$ smooth on $]a,b[$. Then it has a (local) maximum and a (local) minimum on $[a;b]$. }\index{extreme value theorem}
 
\tproof{Not done in class. For a proof, see book or higher level handout.}


\Theorem{Rolle}{Let $f$ be a real function continuous on $[a;b]$ and smooth 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{Critical Point Theorem}{
Let $f$ be a function smooth 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}
}


\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}


\Theorem{Mean Value\label{meanvalue}}{
Let $f$ be a real function continuous on $[a;b]$ and smooth 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}


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}
% \includegraphics[width=6cm]{images/Rolle}
\begin{tikzpicture}[yscale=0.1]
\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}


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

}

\section*{Variation}
We now make the link between global 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.

\Theorem{\label{derivee0}Variation and Derivative}{
Let $f$ be a real function differentiable on an interval $I$. Then
\begin{enumerate}
\item
If $f'(x) \geq 0$ ($> 0$) whenever $x \in I$ then $f$ is
(resp. strictly) increasing on $I$.
\item
If $f'(x) \leq 0$ ($<0$) whenever $x \in I$ then $f$ is
(resp. strictly) decreasing on $I$.
\item
If $f'(x) = 0$ whenever  $x\in I$ then $f$ is constant on $I$.

\end{enumerate} }\index{variation}


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

\exo{
Prove theorem \ref{derivee0} using the mean value theorem.
}

\exo{
Prove the following theorem:

\Theorem{Uniqueness, up to an Additive Constant\label{unique}}{
Let $f$ and $g$ be functions and $I$ an interval.

$$f'=g'\Longleftrightarrow \text{there is a real number $C$ such that }f=g+C$$ 
}

Theorem \ref{f+c} is one direction of theorem \ref{unique}. You will
need theorem \ref{derivee0} (page \pageref{derivee0})  for the other direction. 
}

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

\section*{The differential}

It can be convenient to write $dx$ instead of $\Delta x$, with the understanding that $dx\neq 0$.

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

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

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)}{dx}\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 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}

The chain rule can be written, for $y$ as function of $x$ and $z$ as function of $y$:
\[dz=z'\cdot dy=z'\cdot y'\cdot dx \]
hence 
\[\frac{dz}{dx}=z'\cdot y'\]

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


\chapter{Integrals}

\section{Area under a positive curve}
\theorem{\label{int} Let $f$ be a non-negative function continuous on $[a;b]$ and smooth 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}


\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{
Prove theorem \ref{int}.

Hint: Context is $a,b,f$ and $x$. Let $dx$ be ultrasmall. As $f$ is smooth on $[x;x+dx]$ the function $f$ reaches its maximum, say $(x_M,f(x_M))$, and its minimum, say $(x_m,f(x_m))$ in that interval (theorem \ref{extremes}).

Show that $\Delta A(x)$ is bounded above and below, that these bounds are ultraclose, then conclude.

}

\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$ by the definition that it is the area between $a$ and $a$.}
 
 
 

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


\section{Antiderivative}

\bigskip
\Definition{Antiderivative}{ An antiderivative of a
function $f$ is a function $A$ such that
$A'(x)=f(x)$. }\index{antiderivative}



Newton assumed that gravitation is a constant acceleration. Given such an acceleration, how can one find the equation of position with respect to time?

What is the area under a curve and what is the relation between measuring areas and retrieving the function of position when velocity is known?


\exo{
Prove the following theorem:
\theorem{\label{f+c}If $A$ is an antiderivative of $f$, then for any
  constant $C\in\mathbb{R}$, \ $A+C$ is also an antiderivative of~$f$.}
}



\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$
\item $x\mapsto \frac{1}{\sqrt{x}}$
\end{multicols}
\end{enumerate}

Check your results by differentiating them.
}




\exo{Using $A'=f$ and $A(a)=0$:
\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}
}

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


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

\exo{
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 $\Delta x=\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.


\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} \]

}



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

\tproof{No proof of this in maths 1... see the maths 2 handout for why. It is quite simple
to show that for any ultralarge $N$ , the sum has an observable neighbour (previous
theorem). It is technically more of a mess to show that it does not depend on the
choice of the ultralarge $N$ .
}

\section*{Fundamental Theorem of Calculus}

\definition{Let $f$ be a real function defined on $[a;b]$. Let $n$ be a positive integer.  Let $\ds  \Delta x = \frac{b-a}{n}$ and $x_i = a+ i \cdot
\Delta x$, 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 \Delta x = \frac{b-a}{n}$ and $x_i = a+ i \cdot \Delta x$, for $i = 0, \dots, n$, we have   
\[\sum_{i = 0}^{n-1} f(x_i)\cdot \Delta x \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.

Note also that the integral is written with $dx$ and not $\Delta x$.


\Theorem{Additivity of the integral\label{additivity}}{Let $f$ be a real 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.\]}

\tproof{No proof: there is a hidden difficulty here: Using even divisions of the interval makes most of the proof easier, but for additivity we would need continuity of the integral. See the maths 2 handout.}

\Theorem{Fundamental theorem of Calculus (part 1)}{\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 (part 2)\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).
\]
}


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

The $\int$ symbol is an elongated $S$ and stands for the latin word "summa": a sum, since it can also be shown that instead of finding the area as a variation, it is a $\int$um of $\int$lices.



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]$.
%===================================================


\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{
Let $f:x\mapsto x^2$,

Calculate the area under $f'(x)$ between $x=0$ and $x=5$.
}

\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{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 geometric area of the closed  surface between the two curves.
}



%===================================================
\section*{Integration Rules}








\Theorem{Linearity of the integral\label{linearity}}{Let $f$ and $g$ be real functions integrable on $[a;b]$. Let $\lambda$ be a real number. 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.


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



\exo{
For each of the following functions, find the general form of the antiderivative:
\begin{enumerate}
\begin{multicols}{3}[]
\item $\ds f:x\mapsto 8\sqrt{x}$

\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$. Why is this not so?
}


\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}
}


\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}.}



\section*{Variable substitution}
In this section, the differential notation and the chain rule are used extensively.

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

If we write $g(x)=u$ written  then  $\frac{du}{dx}=g'(x)$ and $dx=\frac{du}{u'}$,

$f(x)\cdot dx$ becomes $\frac{f(u)}{u'}\cdot du$ and the bounds must be
changed to $a_1$ and $b_1$ so that $a_1=g(a)$ and $b_1=g(b)$ 

\example{
For \[\int_1^2 2x\cdot(x^2+1)^2\cdot dx\]

(Considering that $2x$ is the inside derivative, the antiderivative can be seen to be $\frac{(x^2+1)^3}{3}$. Here we consider another approach by variable substitution.) 

Let $u=x^2+1$, then $\frac{du}{dx}=2x$ hence $dx=\frac{du}{2x}$.

Then \[2x\cdot(x^2+1)dx=2x\cdot u^2\cdot\frac{du}{2x}=u^2\cdot du\]

As for the bounds: if $x=1$ then $u=x^2+1=2$ and if $x=2$ then $u=4+1=5$, hence 
\[\int_1^2 2x\cdot(x^2+1)^2\cdot dx=\int_2^{5}u^2 \cdot du=\frac{u^3}{3}\bigg|_2^{5}\]
which gives $(125-8)/3=39$

Compare with $\frac{(x^2+1)^3}{3}\big|_1^2=(5^3-2^3)/3=39$
}

\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.}


\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.

\newpage
\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}
}




\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 properties
\begin{itemize}
\item \(x\simeq 0_+ \Rightarrow f(x)\)  is ultralarge and negative 
\item
\( x \text{ is ultralarge positive } \Rightarrow f(x) \)  is ultralarge positive.
\end{itemize}}

\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$.}


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)}$.


The following property makes it a remarkable function.

\theorem{\label{eexp}$$(\exp(x))' =\exp(x). $$}

(this was proven by exercise \ref{expexp}).

\exo{

Let $f$ be a positive real function whose derivative is continuous. Calculate:
$$\int \frac{f'(x)}{f(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{
\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$.}


% 
%============================================================
%\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_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_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}
}


%===================================================
\newpage
\section*{Applications of the Integral}

\noindent \textbf{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{intmv}
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]$.
}

% \exo{Prove  theorem \ref{intv}.}

Note that theorem \ref{intmv} is a restatement of 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)$.

\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?
}



\bigskip
\noindent \textbf{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$.
}

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

\bigskip
\noindent \textbf{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}
% \includegraphics[width=7cm]{images/length}
\begin{tikzpicture}[scale=2]
\clip(-0.5,-0.2) rectangle (3.6,1.3);
%\draw[line width=1.2pt] plot[raw gnuplot ] function{plot[-0.5:3.5](2.72**x/(1+2.72**x))};
\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}
}

\chapter{Limits}
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)$.



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,\]



\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$.





\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}

The symbol ``$\infty$'' can be used to indicate that the function takes ultralarge values. Since if a function has a maximum, by closure, the maximum would be observable, the fact that it reaches ultralarge values implies that it has no maximum, hence that the intervakl of possible results is infinite.

\newpage
\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}}



\chapter{Curve Sketching}

Now the rules of de l'Hospital may be also required. The functions may include any combination of functions studied up to now. Some functions may be difficult.

Sketch the curves of the following.


\Pract{curve2}{
\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{e^x}{1+e^x}$

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

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

\item $\ds g_{7}:x\mapsto  \frac{e^x}{x-2}$

\item $\ds g_{8}:x\mapsto  e^{-x^2}$

\item $\ds g_{9}: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{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}
}

\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_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_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[raw gnuplot] function{plot[x=0.05:2.5]( x*log(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.3,yscale=2] 
\draw(-4,1)node{($g_{4}$)};
\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_{5}$)};
\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_{6}$)};
\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_{7}$)};
\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_{8}$)};
\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_{9}$)};
%\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}
}


%====================================
\end{document}
