+0

# Finding an equation based off x and f(x) values

+1
199
1
+31

So I'm writing a program, but I can't figure out this one algorithm. I'll write it like this

When x = 8, f(x) = 1

When x = 10, f(x) = 4

When x = 13, f(x) = 8

What is the SIMPLEST equation that would make all three of these points true? Thank you

Feb 15, 2019

#1
+2343
+1

Given three points, the simplest equation that I can think of would be a quadratic. The standard form of a quadratic is written as $$ax^2+bx+c$$ , where we can tweak a,b, and c so that it intersects the points listed above.

 $$f(x)=ax^2+bx+c$$ Let's substitute in the individual values of x into these equations. $$\boxed{1}\quad f(8)=a*8^2+b*8+c\\ \boxed{1}\quad 1=64a+8b+c$$ Substitute in x=8 to create the first equation. Simplify completely. $$\boxed{2}\quad f(10)=a*10^2+b*10+c\\ \boxed{2}\quad 4=100a+10b+c$$ Substitute in x=10 to create the second equation. Simplify completely. $$\boxed{3}\quad f(13)=a*13^2+b*13+c\\ \boxed{3}\quad 8=169a+13b+c$$ Substitute in x=13 to create the second equation. Simplify completely.

Notice that we have now generated a three-variable system of equations. Let's solve this for all the variables. I tried my best to pick the best path possible. I have numbered all the equations so that you can refer to them easily.

 $$\boxed{1}\quad 1=64a+8b+c\\ \boxed{4}\quad -1=-64-8b-c$$ Notice that all I did here was to negate all the sides. I do this so that I can eliminate the "c" values from two of the equations. $$\boxed{2}\quad 4=100a+10b+c\\ \boxed{4}\quad -1=-64a-8b-c\\ \overline{\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad}\\ \boxed{5}\quad 3=36a+2b$$ I added equation 2 and 4 together to generate a new equation, 5, with one fewer variable.

 $$\boxed{3}\quad 8=169a+13b+c\\ \boxed{6}\quad -8=-169a-13b-c$$ I have done the exact same process as above; I negated both sides of equation 3. This is for the same purpose; eliminate "c." $$\boxed{6}\quad -8=-169a-13b-c\\ \boxed{2}\quad 4=100a+10b+c\\ \overline{\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad}\\ \boxed{7}-4=-69a-3b$$ Yet again, I added equations 6 and 2 to create another equation with one fewer variable.

We have now successfully eliminated "c" in two instances; it is now time to use these two new equations in order to isolate another variable. I will still use elimination.

 $$\boxed{5}\quad 3=36a+2b\\ \boxed{8}\quad 9=108a+6b$$ In order to create equation 8, I multiplied both sides of equation 5 by 3. $$\boxed{7}-4=-69a-3b\\ \boxed{9}-8=-138a-6b$$ In order to create equation 9, I multiplied both sides of equation 7 by 2. $$\boxed{8}\quad 9=108a+6b\\ \boxed{9}\quad -8=-138a-6b\\ \overline{\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad}\\ \boxed{10}1=-30a$$ Finally! We have reduced this to one variable only! $$a=-\frac{1}{30}$$ We now have the value of "a," Let's use this information to help us fill out the rest.

Let's now substitute this back into one of the equations and find "b."

 $$a=-\frac{1}{30}\\ \boxed{5}\quad 3=36a+2b\\ 3=36*-\frac{1}{30}+2b$$ I have substituted in the value of "a" into equation 5. I can now solve for b. I will multiply both sides of this equation by 30 to eliminate the presence of those fractions. $$90=-36+60b\\ 15=-6+10b\\ 21=10b\\ b=\frac{21}{10}$$ Notice how I decided to divide the equation by 6 immediately to simplify it into more manageable numbers. While this is not strictly necessary, I think this is always a good strategy to use when equations get out of hand. Look at that! We have the value of "b!"

Equation 2 looks like the easiest one to substitute back into so that is the one that I will do.

 $$a=-\frac{1}{30}; b=\frac{21}{10}\\ \boxed{2}\quad 4=100a+10b+c\\ 4=100*-\frac{1}{30}+10*\frac{21}{10}+c$$ You might be able to see why I preferred equation 2. The substitution appears to be the path of least resistance. $$4=-\frac{10}{3}+21+c\\ -17=-\frac{10}{3}+c\\ 51=10-3c\\ 41=-3c\\ c=-\frac{41}{3}$$ We have finally solved for the final unknown.

The simplest equation I could come up with is $$f\left(x\right)=-\frac{1}{30}x^2+\frac{21}{10}x-\frac{41}{3}$$

.
Feb 16, 2019

#1
+2343
+1

Given three points, the simplest equation that I can think of would be a quadratic. The standard form of a quadratic is written as $$ax^2+bx+c$$ , where we can tweak a,b, and c so that it intersects the points listed above.

 $$f(x)=ax^2+bx+c$$ Let's substitute in the individual values of x into these equations. $$\boxed{1}\quad f(8)=a*8^2+b*8+c\\ \boxed{1}\quad 1=64a+8b+c$$ Substitute in x=8 to create the first equation. Simplify completely. $$\boxed{2}\quad f(10)=a*10^2+b*10+c\\ \boxed{2}\quad 4=100a+10b+c$$ Substitute in x=10 to create the second equation. Simplify completely. $$\boxed{3}\quad f(13)=a*13^2+b*13+c\\ \boxed{3}\quad 8=169a+13b+c$$ Substitute in x=13 to create the second equation. Simplify completely.

Notice that we have now generated a three-variable system of equations. Let's solve this for all the variables. I tried my best to pick the best path possible. I have numbered all the equations so that you can refer to them easily.

 $$\boxed{1}\quad 1=64a+8b+c\\ \boxed{4}\quad -1=-64-8b-c$$ Notice that all I did here was to negate all the sides. I do this so that I can eliminate the "c" values from two of the equations. $$\boxed{2}\quad 4=100a+10b+c\\ \boxed{4}\quad -1=-64a-8b-c\\ \overline{\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad}\\ \boxed{5}\quad 3=36a+2b$$ I added equation 2 and 4 together to generate a new equation, 5, with one fewer variable.

 $$\boxed{3}\quad 8=169a+13b+c\\ \boxed{6}\quad -8=-169a-13b-c$$ I have done the exact same process as above; I negated both sides of equation 3. This is for the same purpose; eliminate "c." $$\boxed{6}\quad -8=-169a-13b-c\\ \boxed{2}\quad 4=100a+10b+c\\ \overline{\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad}\\ \boxed{7}-4=-69a-3b$$ Yet again, I added equations 6 and 2 to create another equation with one fewer variable.

We have now successfully eliminated "c" in two instances; it is now time to use these two new equations in order to isolate another variable. I will still use elimination.

 $$\boxed{5}\quad 3=36a+2b\\ \boxed{8}\quad 9=108a+6b$$ In order to create equation 8, I multiplied both sides of equation 5 by 3. $$\boxed{7}-4=-69a-3b\\ \boxed{9}-8=-138a-6b$$ In order to create equation 9, I multiplied both sides of equation 7 by 2. $$\boxed{8}\quad 9=108a+6b\\ \boxed{9}\quad -8=-138a-6b\\ \overline{\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad}\\ \boxed{10}1=-30a$$ Finally! We have reduced this to one variable only! $$a=-\frac{1}{30}$$ We now have the value of "a," Let's use this information to help us fill out the rest.

Let's now substitute this back into one of the equations and find "b."

 $$a=-\frac{1}{30}\\ \boxed{5}\quad 3=36a+2b\\ 3=36*-\frac{1}{30}+2b$$ I have substituted in the value of "a" into equation 5. I can now solve for b. I will multiply both sides of this equation by 30 to eliminate the presence of those fractions. $$90=-36+60b\\ 15=-6+10b\\ 21=10b\\ b=\frac{21}{10}$$ Notice how I decided to divide the equation by 6 immediately to simplify it into more manageable numbers. While this is not strictly necessary, I think this is always a good strategy to use when equations get out of hand. Look at that! We have the value of "b!"

Equation 2 looks like the easiest one to substitute back into so that is the one that I will do.

 $$a=-\frac{1}{30}; b=\frac{21}{10}\\ \boxed{2}\quad 4=100a+10b+c\\ 4=100*-\frac{1}{30}+10*\frac{21}{10}+c$$ You might be able to see why I preferred equation 2. The substitution appears to be the path of least resistance. $$4=-\frac{10}{3}+21+c\\ -17=-\frac{10}{3}+c\\ 51=10-3c\\ 41=-3c\\ c=-\frac{41}{3}$$ We have finally solved for the final unknown.

The simplest equation I could come up with is $$f\left(x\right)=-\frac{1}{30}x^2+\frac{21}{10}x-\frac{41}{3}$$

TheXSquaredFactor Feb 16, 2019