I have values that range from 0 and 90, and I need to map their values to between 2 and 0. Examples would be 90 = 2, 0 = 0, 45 = 1. How can I go about getting these values converted down to the proper range?

Edit: I messed up on my examples.

Examples should be: 90 = 0, 0 = 2, 45 - 1


1 Answer 1


Use a straight line with equation:

$$y=2-\frac{1}{45}x $$

A general recipe is as follows:

Suppose that you have two points $(x_1,y_1)$ and $(x_2, y_2)$ and you need to identify a straight line that goes through those points. The equation for a straight line can be written as: $y = mx+c$ where $m$ is the slope and $c$ is the $y$-axis intercept when $x=0$.

Thus, we have:

$y_1 = mx_1+c$


$y_2 = mx_2 +c$

Solving the above system of equations gives us:

$m = \frac{y_2-y_1}{x_2-x_1}$


$c = y_1 - \frac{y_2-y_1}{x_2-x_1}x_1$

  • $\begingroup$ Thank you for your answer, but I made a mistake in my question, please see my edits. $\endgroup$ Jun 20, 2013 at 3:45
  • $\begingroup$ Updated. I imagine that you want $1$ for $45$. $\endgroup$
    – response
    Jun 20, 2013 at 3:47
  • $\begingroup$ Perfect. Thank you for the speedy, and accurate answer. $\endgroup$ Jun 20, 2013 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.