% This is lecture no. 6 of MH1101/: Calculus II.

\section{The Definite Integral \& Area Under a Curve}%
\label{sec:the_definite_integral_&_area_under_a_curve}

To find the area under a curve $y=f(x)$, where $f(x)>0$ from $x=a$ to $x=b$, we divide the interval $[a,b]$ into $n$ equal subintervals:
\[
	[x_0,x_1],[x_1,x_2],\dotsc,[x_{k-1},x_{k}],\dotsc, [x_{n-1},x_{n}]
.\]
The width of each subinterval is:
\[
	\Delta x=x_k -x_{k-1}=\frac{b-a}{n}
.\]
We have $x_0=a$ and $x_{n}=b$.
Thus, we have:
\[
	x_{k}=x_0 + k \left(\frac{b-a}{n}\right)\quad k = 0,1,2,3,\dotsc,n
.\]
In each $k$-th subinterval $[x_{k-1},x_k]$, we choose a point $x^{*}_{k}$ and evaluate the value $f(x^{*}_{k})$.
The area of the $k$-th rectangle, over $[x_{k-1},x_{k}]$, with height $f(x^{*}_{k})$, is:
\[
	f(x^{*}_{k})\Delta x = \frac{b-a}{n}f(x^{*}_{k})
.\]
Now, we approximate the area under the curve $y=f(x)$ by the total areas of all these rectangles:
\[
	\sum_{k=1}^{n} \left(\frac{b-a}{n}\right)f(x^{*}_{k})
.\]
This sum is called a Riemann Sum of $f$ on $[a,b]$.
If the function is well-behaved, as we increase the number $n$ of subintervals, the length of subinterval $\Delta x$ tends to zero, making the approximation reach the area $A$ under the curve:
\[
A = \lim_{n \to \infty}\sum_{k=1}^{n} \left(\frac{b-a}{n}\right)f(x^{*}_{k})
.\]
In general, the limit may not exist, however, if it exists ,we say that $f$ is \textbf{Riemann} integrable on $[a,b]$.
The definite integral of $f$ from $a$ to $b$, denoted by:
\[
\int_{a}^{b} f(x) \ud x
.\]
Which is the value of the limit.
This value is independent of our choice of $x^{*}_{k}$.
\begin{thrm}
	Existence of Definite Integral.
	If $f$ is continuous or monotonic or piecewise continuous with a finite number of discontinuities on $[a,b]$, then the definite integral:
	\[
	\int_{a}^{b} f(x) \ud x
	\]
	does exist.
\end{thrm}
Note that if $a>b$ we define:
\[
\int_{a}^{b} f(x) \ud x = -\int_{b}^{a} f(x) \ud x
.\]
And if $a=b$, we define:
\[
\int_{a}^{b} f(x) \ud x=0
.\]
For a general function $f$, the definite integral:
\[
\int_{a}^{b} f(x) \ud x
.\]
is the net area between the graph of $y=f(x)$ and the $x$-axis.
\begin{note}
	The definite integral is a number which is independent of the variable $x$:
	\[
		\int_{a}^{b} f(x) \ud x = \int_{a}^{b} f(t) \ud t = \int_{a}^{b} f(s) \ud s
	.\]
	Where the variables $x,t,s$ are dummy variables.
\end{note}
\begin{note}
	If $f$ is an odd continuous function.
	Then:
	\[
		\int_{-a}^{a} f(x) \ud x=0
	.\]
\end{note}
