# Integrals
# Riemann vs. Lebesgue
* Riemann integrals have several disadvantages:
* Riemann integrals involve much more work due to their limiting process
* This makes it much harder to expand into higher dimensions
* They also have a dependence on continuity
* If we have a fully continuous function, then we are all good. If we have discontinuity points, then there should be only finitely many of them. If we have infinitely many, it can destroy the integrability of the function.
* Limit process. Can I pull a limit sign inside the integral sign. For instance, when does the following equality hold?:
$\lim_{n \to \infty} \int_a^b f_n(x)dx
\;\;\; \longleftrightarrow \;\;\;
\int_a^b \lim_{n \to \infty} f_n(x)dx
$
* In the Riemann integral case we do not have many options. We only are allowed to pull the limit inside the integral in the case of *[Convergence > Uniform Convergence](Convergence.md#Uniform%20Convergence).
* Fantastic video [here](https://www.youtube.com/watch?v=PGPZ0P1PJfw)
# Change of Variables
Suppose we wish to integrate a function over a region. We will need to decide: what coordinate system should we use? For instance, a rectangle is very easy to compute in *rectangular* (cartesian) coordinates, while a circle is very easy to compute in polar coordinates (but very hard in rectangular coordinates).
With that said, we can move on to *any* coordinate system that we wish to define. If that system makes it easy to express riemann sums, then it may be useful using that coordinate system. Consider the coordinate system below:

We see that we have two common lines in green, horizontal lines, that specify particular $y$ values. However, if we then look at the two red lines, we see there is a certain symmetry (they are parallel) but it is not the same *vertical* symmetry that is often represented in cartesian coordinates. So the question is, what if we do a **change of variables**? That is, what if we introduce:
$v = y$
$u = x - y$
So, for the two diagonal lines that were not easily expressed by $x$ being equal to some fixed value, if we set $u = x - y$, then our lines are:
$y = x - 2 \rightarrow 2 = x - y \rightarrow u = 2$
$y = x - 1 \rightarrow 1 = x - y \rightarrow u = 1$
These are indeed just constants. Now, if we were to draw the *exact same region* but now in the $u$ - $v$ plane (expressing in terms of $u$ and $v$ instead of $x$ and $y$), then we get a *rectangle*:

The idea here is that it will be far easier to integrate in this coordinate system, because our limits will simply be $1$ and $2$ for both $u$ and $v$. So, the question is, how do we actually integrate in some new, generic coordinate system?
#### 1-D $u$-substitution
So, let's think back to what we used to do for simple, single variable **u-substitution**. Suppose we have an integral of some function of $x$:
$\int_{x = g(a)}^{x = g(b)} f(x) dx$
Then we can take $x$ and write it as some function of a new variable, $u$:
$x = g(u)$
We can then perform our $u$-substitution which allows us to rewrite this as:
$\int_{x = g(a)}^{x = g(b)} f(x) dx =
\int_{u = a}^{u = b} f(g(u)) g'(u) du$
Our new integral is now in terms of $u$. The function of $x$ has now turned into $g(u)$ (since we defined it to be so). And finally the $dx$ transforms into $g'(u) du$ (intuitively we can think of this as: previously we treated $dx$ as a small nudge in $x$. We now want to represent a small nudge in $x$, but in terms of $u$. Well, since $x = g(u)$, we can look at a small nudge in $g(u)$,)
See:
* https://en.wikipedia.org/wiki/Integration_by_substitution
* https://photos.google.com/photo/AF1QipNH05I8YWkyvZhoiQgDwRouJv5ZNeMe2wMGRyrD
### Double integral as area vs volume
See [here](https://mathinsight.org/double_integral_area) for area and [here](https://mathinsight.org/double_integral_volume) for volume.
The main idea is that if we are simply integrating over $1$ times the area/volume element, we will be dealing with area:
$Area = \int \int_D 1 dA$
On the other hand, if we are integrating over some function $f(x,y)$, we will end up with the volume under that surface:
$Volume = \int \int_D f(x,y) dA$
The reason for this really comes down to the fact that in our area example we are really letting $f(x,y) = 1$, meaning our $z$ dimension has a constant height of 1. Hence, multiplying the area under the surface (defined by $D$) by a constant height of 1 will just yield the area under the surface, $D$.
### Why are integrals so tied to the x-axis?
I had an interesting thought the other day: whenever we visualize integrals it is always as the area
under the curve:

This makes the $x$-axis appear to be incredibly critical! It is always the "base" from which we sum up our heights, $f(x)$ (the $y$-axis). But that is just a misconception. We aren't using the $x$-axis as the base/floor - it is simply that the $x$-axis, by convention, is always laid at $y=0$. It is really $y=0$ that we are interested in.
Why is it that we are interested in $y=0$? It is actually unbelievably simple: because that is how we define numbers. Imagine I told you that I was giving you $7$ dollars. What does that actually mean? What is $7$? Well we can think of that as defined *with respect to* $0$!
So when we compute the integral, we are just summing up numbers on the $y$ direction, and a number is *implicitly* defined with respect to $0$!
----
links: [Mathematics MOC](Mathematics%20MOC.md)