[Math] Purpose of Inverse Functions

algebra-precalculus

Finding inverse functions and understanding their properties is fairly basic within mathematics. During my studies it was found fairly simple and easy to comprehend that it was a swapping of the outputs and inputs of a function. But now it has reappeared in calculus as finding the derivative of inverse functions and has me thinking what is the actual real world application of inverses.Like how studying quadratics is extremely useful in modeling objects in free fall. I know my question may seem trivial to many here, i'm a high school student and we never get to have these discussions in class.

Best Answer

I find many of the answers here dwell too much on mundane applications of inverses on linear functions like money and units of measurement so I will offer an alternative perspective: inverses are about information. If I can invert a function (i.e., reverse a procedure), that means that no information is lost when I apply that function.

For example, when I use the function $y=f(x)=x^3$ on some input $x$, I know that if I know only the result $y$, I know exactly what $x$ I started out with. Yet if I use a function like $y=g(x)=x^2$ instead, the $y$ by itself does not give enough information for me to figure out what $x$ I put into the function to begin with. If $y=16$, $x$ could equal $-4$ or $4$; I don’t know which. Both $x$s give me the exact same result $y$.

When this happens, we say that $g(x)=x^2$ is not invertible. Similarly, we say that $f(x)=x^3$ is invertible because it is not a destructive operation like $x^2$. To say that a function is destructive is the same as saying that it is not invertible. To say a function is lossless is the same as saying that it is invertible.

The function $g(x)$ is destructive because (with one exception, $y=0$) the outputs alone are not enough to tell me what the inputs were. We need more information, to replace the information that was destroyed by the function. In the previous example, if I told you that the input was a positive number (mathematically speaking, this is called restricting the domain), then you now know enough to conclude that the original input must have been $4$, because $4$ is the only positive number in the solution set $\{-4, 4\}$. If I always gave you this hint, that the input was positive, then I have effectively made $g(x)$ invertible over that domain, since you will always be able to determine the input from the output—just take the positive root. Hence, we can say that while $g(x)$ is not invertible over all real numbers $(-∞, ∞)$, $g(x)$ is invertible over the domain $[0, ∞)$.†

If this all seems a little abstract, keep in mind that this concept of destruction of information is hugely important in day to day life. Compression algorithms are built on inverses. If you have ever downloaded a .zip file, you can be sure that when you extract the archive (invert the compression function), what you get out is exactly‡ what the person who made the file put in, that the file wasn’t distorted or damaged in any way by going through the compression and decompression process, and that’s all because the compression algorithm that made the .zip file used an invertible function.

On the flip side of it, invertibility (or lack thereof) is why, for example, JPEGs degrade in quality every time you save them. The JPEG compression algorithm is non-invertible, so if you save a photo as a JPEG (and delete the original), you will never be able to get 100% of the original quality back, because some of it was destroyed when you ran the compression algorithm. That’s why professional photographers always save their originals as PNGs or TIFFs—formats that use invertible compression algorithms.

Invertibility allows us to accomplish incredible feats—as a computer programmer, I can use an invertible function to represent an object millions of bytes long with just 64 bits (often less), with no loss of information. This function is called the reference operator (&() in most C-like languages) and its output is called a pointer, which is simply a unique integer identifier for the object (its address in computer memory). Its inverse is the dereference operator (*() in most C-like languages), which allows us to get back the original object from the 64-bit pointer. Passing by reference, as it’s called, allows us to work on data objects with minimal data copying. If we didn’t have pointers, computers would be excruciatingly slow, since we would have to copy the entire data structure in memory every time we wanted to do something with it. This is called passing by value and we generally avoid it unless we genuinely want to make a copy of the data.

Sometimes we want the opposite, a non-invertible function. One reason we might want this is if we’re building a cache.

Imagine if I asked you to compute the value of cos(6π/31) by hand to 12 decimal places. There are ways to do this, it would take you a long time to do it though. For the record, it’s 0.820763441207.

Now what if I asked you what the value of cos(68π/31) is? You could repeat the same process as before, crank out the result, and find that the result is…0.820763441207. Why? Because cos(68π/31) = cos(6π/31 + 2π), and cosine repeats every $2π$. You could have saved yourself a lot of time by just reusing your answer to the first question.

This happened because the input value 68π/31 gave you too much information. All you really needed to know was what 68π/31 % 2π was. The extra multiples of $2π$ just caused us to waste time. In this case, we want to use the modulus function to discard the extraneous information, so that we can see that 68π/31 and 6π/31 are equivalent for our purposes and map them both to a single cache entry.

† Strictly speaking, this means that the hint I gave you was that $x$ was non-negative, instead of just positive, since $0$ is a special case where both roots $\{-0, 0\}$ are identical.

‡ In fact, inverses allow you to be doubly sure that you have the right file, because many cryptographic procedures are simply very very complex invertible functions. For example RSA, used in HTTPS, relies on modular exponentiation of a certain kind, which is an invertible function that depends on something called the public key, and is easy to invert if you know the private key, but (as of today) is not known to be easy without the private key. For what it’s worth, many other useful cryptographic procedures such as hashing, aren’t invertible, and that’s exactly what makes them so powerful and why we use them to store sensitive credentials such as passwords. Using the hash function allows us to be reasonably sure that the password you entered is correct (if it was invertible we would be 100% sure), but because it’s not invertible, then even if a hacker managed to get a hold of the hash (which happens a lot), it will be hard for them to extract the password itself because some of the information that constitutes the password itself was destroyed by the hash function.

edit

As @user21820 points out, in practice, it is not really the destructivity of hash functions that make them effective at protecting credentials, rather it is the sheer computational complexity required to solve for the possible inputs that makes hashes such as the SHA strong. In fact, over most “realistically used” low-entropy domains (such as dictionary words), hashes like the SHA512 are effectively invertible, since the chance of a hash collision (think two $x$s, same $y$) occurring in such a restricted domain are relatively small.

Indeed, even in cases where the SHA destroys some of the information, human hackers can easily fill in the gaps. If the assumed entropy is low enough, a solution subset can be found by intersecting a rainbow table of the hash function (basically a finite list of precomputed points) with the hash output. Because SHA has a finite range but an infinite domain (can you use this to prove that SHA is destructive?), the solution set for any hash output is infinite, so the larger a table you can generate, the more chances you get to find the password. Generally this isn’t difficult — a typical solution set for a hash input will look something like $\{$v4#5dH&*~]?9a, hG8^5H-39u@JPW, ilovekittens13, 5!fHjeOs*7^==2, $...\}$, and anyone can probably guess which one is the password. In fact, rainbow tables can be made more efficient for cracking human-generated passwords by only computing hashes of strings made up of dictionary words and a few numeric digits; this is broadly known as a dictionary attack. This is why in the real world, we often combine hashes with other techniques such as salting to reduce the utility of rainbow tables, as well as attempt to increase the input entropy (with special characters, non-dictionary words, etc) so that it is computationally unfeasible to generate the rainbow table to begin with.

If you are interested in this sort of thing, spend some time browsing through the information security stackexchange, where a good understanding of functions and function inverses will take you a long way.

Related Question