# Need help creating formula for something simple

My mind is fried and I just can't think of what formula I would use for this.

I have a range of 0% to 100% that I pick. Let's call this X.
At the end of the equation 0% will be equal to 1 and 100% is equal to 0.

So for example, if X = 100%, then the result is 0, and if X = 0% then the result is 1. If X = 70%, then the result is 0.3, and if X = 30%, then the result is 0.7. So on and so forth.

• Must your formula be linear? Exponential? Sinusoidal? There's infinitely many ways to do this. – Sean Roberson Nov 28 '16 at 16:49
• Sean, I'd like it to be linear. Whatever is simplest is best, really. – lolikols Nov 28 '16 at 16:50

Based on new information, you wish to have a linear function $f: [0, 1] \to [0, 1]$ such that $f(0) = 1$ and $f(1) = 0$. This is easy to do.

First see that we have a y-intercept: $f(0) = 1$. Next we need the slope, again easy:

$$m = \frac{0 - 1}{1 - 0} = -1$$

and so your formula is $f(x) = 1-x$.

• Sorry Sean, I guess linear isn't what I needed, and I'm just dumb. Is there a standard form equation of way of achieving the same result? Oh god. Nevermind. I'm stupid. Sorry! Your solution works perfectly! – lolikols Nov 28 '16 at 16:55
• There isn't, really, for you can find many functions that yield the same kind of boundary conditions. – Sean Roberson Nov 28 '16 at 16:56

I feel like the simplest way is to do this: if X is 1, Y is 0. if X is 0, Y is 1. If we plot this on a graph and draw a line between the points, we have Y=-X+1, which would seem to satisfy the purposes of your function.

Percentages can be represented as normal numbers and 0% to 100% basically means from 0 to 1. Since you want to achieve the exact opposite just do 1 - X where X is the numerical representation of the percentage. Ex. 75% = 75/100 = 0.75 (X) 1 - X = 1 - 0.75 = 0.25

Conclusion f(x) = 1 - x/100 where x∈[0;100]