Purpose of Inverse Functions

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.


On the broad surface:

Functions are found in everyday life. There are many small examples like adding ingredients while cooking or performing operations on a game. However, I will use the example of currency conversions. In Real life... 1 US dollar is exactly 2402.9 Pesos, 0.90868 Euros and 0.65070 Pounds. This makes transactions regarding money complicated, so the way to make it easier is by using function to convert and an inverse function to convert back. Different currencies... One example I use everyday is the conversion of US dollars to Colombian Pesos. 2402.9 Pesos are 1 dollar, and to find that out one must use a function. If y=The amount of pesos, and x=the amount of dollars one needs to convert, then: Y=X·2402.9 is true. Converting. With this formula one can find the amount of pesos equivalent to the dollars inputted for X. The inverse of the function To get the original amount back, or simply calculate the other currency, one must use the inverse function. In this case, the inverse function is: Y=X/2402.9. Were Y is the amount of dollars, and X is the pesos. Another example would be to convert measurements units to other measurement units. For example meters to feet, or kilometers to miles.

Metric Conversions In order to convert from meters to feet, one must use the formula of Y=X·3.3. Y is equal to the amount of feet equivalent to the amount of meters inputted on the X value. Although when you are trying to convert in your head you might not think on this equation you are still using the same process. In my life I always use this two examples. Especially since I am not used to the measurements in feet or the dollar currency Therefore, this formulas play an important part in a common day because they can be used all the time. Also, it is not only just me who struggles with the inches, feet and miles. Most people who normally use the metric system aren't used to using feet and inches, that is why this formulas are so vital and commonly used. Also, to convert from miles to kilometers the equation that could be use is Y=X·1.609. Y is the miles and X is the kilometers you want to convert. Also, in order to find the other value, then one must use the inverse function. In this case it would help to find the other value, so switch X and Y. In conclusion, functions and their inverses are used all he time in real life situation. Also, sometimes they are more common than what we think.

Inverses are used in higher level mathematics as you see they came back in the class you are currently taking. It is good to see a student asking deeper ended questions. As teacher if you were to ask me this after or before class we would become friend quickly and I would be super excited to see a student caring so much.


I appreciate that you opted to ask. Basically it is about relationships and dependent functionality in a relationship that works both ways. If a way of working in some direction is clear, then it is incomplete knowledge e.g., in social ambiance like in examples student/teacher,buyer/seller, father/son everything should be comprehensively understood. In mathematics it is quantified with required connection and inverse construction detail.

The inverse function is a first closest relationship among many possibilities.. as if connecting with itself more completely.

If B is the father of A, then A need not be the only son or issue for B. If 9 is square of 3 then 3 need not be the only square root of 9, -3 also has a place. Before understanding how mathematics is beautifully integrated elsewhere, it is equally interesting how it is internally connected...