Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Maximum input to function is $40$, minimum is $1$. Function works like this:


we also want to know what $f(x)$ would produce. The answer would be "linear" to these two cases - for example, $f(20)$ would return something around $0.6$.

Can someone help me with this function?

share|cite|improve this question
up vote 1 down vote accepted

If $f$ is linear then $f(x)=ax+b$ for some $a,b$. Plug in the values $x=1$ and $x=40$ to obtain $a$ and $b$.

share|cite|improve this answer
Thank you, this is the first, the shortest and the most universal answer and that's why I've chosen it. I'd like to thank the other two participants as well. – Primož Kralj Apr 15 '12 at 20:48

For linear $f$ we have $f(x) = a\cdot x + b$, so $0.2 = a \cdot 40 + b$ and $1 = a \cdot 1 + b$. Solving this set of equations we have that $a = \frac{-4}{195} = -0.0205128$ and $b = \frac{199}{195} = 1.02051$.

Hope that helps ;-)

share|cite|improve this answer
Thank you, it helped :) – Primož Kralj Apr 15 '12 at 20:45

Since $f(1)=1$ and $f(40)=0.2$, and you want the function be linear, the output must decrease by $1-0.2=0.8$ units for every $40-1=39$ units of increase in the input. Therefore the output must decrease by $\dfrac{0.8}{39}$ units for every increase of $1$ in the input, and we have $$f(x)=1-\frac{0.8}{39}(x-1)=1-\frac8{390}(x-1)=1-\frac4{195}(x-1)\;.$$ If you want, you can simplify this to $$f(x)=\frac1{195}(199-4x)\;.$$

share|cite|improve this answer
My calculations produced different constant, 199/195. – dtldarek Apr 15 '12 at 20:40
@dtldarek: sigh I really need to wake up. Thanks. – Brian M. Scott Apr 15 '12 at 20:43
Thank you for your straightforward answer. – Primož Kralj Apr 15 '12 at 20:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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