A linear function that returns 8096 when x is 8, and returns 1024 where x is 65536

39 Views Asked by At

I'm struggling to come up with a formula that returns 8096 when x is 8 and 1024 when x is 65536. And appropriately returns the correct y when x is between those values. I think this is a simple graph equation problem but I'm struggling to come up with something nice!

Thanks a lot

1

There are 1 best solutions below

1
On BEST ANSWER

You start with a general approach for linear functions $$ f(x) = mx + b. $$ You want $$ f(8) = m\cdot 8 + b = 8096 $$ and $$ f(65536) = m\cdot 65536 + b= 1024. $$ This gives you a linear system of equations $$ 8m + b = 8096\\ 65536 m+ b =1024 $$ which you want to solve for $m$ and $b$. Now $\frac{65536}{8192}=8$ so this is equivalent to

$$ 8m + b = 8096\\ 8 m+ \frac{1}{8192}b =\frac 1 8 $$

now subtract one equation from the other. That leaves you with an equation only involving $b$ which you can therefore solve for $b$. Now plug this value in either of the two equations above and solve for $m$. Now since you know $m$ and $b$ you found your desired function.