# Space Transformations
The notion of **space transformations** arise all over the place in mathematics. They can be a bit odd to wrap your head around at first: I want to explain *why* this is the case, as well as *how to think about them* to resolve this confusion.
Consider the [Logarithmic Transform](Logarithmic%20Transform.md); we can refer to it as $f$:
$f: X \rightarrow Y$
Where $X = \{x \in \mathbb{R} \mid x > 0 \}$ and $Y = \mathbb{R}$. And of course $f(x) = log_2(x)$. As defined this function takes all points from the **domain**, the *space* $X$, to the **codomain**, the *space* $Y$.
What feels *strange* is that many points *start* in $\mathbb{R}$ and end in $\mathbb{R}$. For instance, consider the point $x = 8$:
$f(8) = log_2(8) = 3$
So, this point started in $\mathbb{R}$, was transformed, and ended up in $\mathbb{R}$. *This* is what feels strange! We have said that our space was being transformed, but from the looks of it our entire space is still described via $\mathbb{R}$! Where is the error in our intuition?
The misconception is as follows. A function (in this context a transformation):
> A **function** associates elements in one spaces to elements in another space.
In this case the function associates $8$ in the space $X$ with $3$ in the space $Y$. This **association** (i.e. a *map*) applied to the entire space $X$ *defines* the function.
If we naively look at $X$ and $Y$ and see that the real numbers are used to describe both we miss the key point:
> $X$ has a set of elements that we may be working with. If we transform $X$ via $f$ to get $Y$, the elements of $Y$, described via the real numbers, will *not* be related to $X$ via the identity! They were transformed!
Let's put this another way: If I simply showed you the space $Y$ it would just be the real numbers, $\mathbb{R}$. Only seeing that, you would have *no idea* that $Y$ was actually the codomain of the log transform. However, we generally have some sort of relationship with the elements of $X$! Consider that $X$ is meant to represent peoples heights (so we are just using the positive reals to represent heights). We have a clear, intuitive idea of what the elements 60 (inches) in $X$ represents. If that element is that transformed via $f$ to its associated element in $Y$, we know that $60$ in $Y$ will not have the same properties as $60$ in $X$!
This is all to say: we tend to have a relationship/understanding/connection to elements in the original space (domain). So, once they are transformed, while it is true that they are described in $\mathbb{R}$ and with an infinite domain you would never know, we generally do not have an infinite domain! Visually we can see this below. Generally, we have a relatively small number of points, meaning an examination of the **image** of the transform will show how the log squishes some points together (larger points get more squished):


There is one final question that should still be answered! If the codomain of a log transform, $Y$, is simply $\mathbb{R}$, then why when we plot a logarithm do we observe a distinct curve? This is simply because plotting the logarithm provides a visualization of the *relationship* between the elements of $X$ and $Y$! However, if we simply were to plot $Y$ on it's own with no reference to $X$, we would not be able to notice this behavior!
The key takeaway of all of this is:
> In transformations we generally look at elements in the codomain and think about their **associated element** in the domain! This is often done implicitly, but it is this association we make (especially when we specifically graph it) that is the culprit for the confusion.
### Neural Networks
There is a great blog post that gets into this: [Neural Networks, Manifolds, and Topology -- colah's blog](https://colah.github.io/posts/2014-03-NN-Manifolds-Topology/)

---
Date: 20220519
Links to: [Mathematics MOC](Mathematics%20MOC.md)
Tags: #review
References:
* [Neural Networks, Manifolds, and Topology -- colah's blog](https://colah.github.io/posts/2014-03-NN-Manifolds-Topology/)