How to fit a quadratic function to two points?

In summary: I can't think of what the inverse of 3 is at this point.In summary, you can interpolate a quadratic function by finding the function value at two arbitrary points, and adding the inverse of the point at which the function value is found.
  • #1
samir
27
0
Hi!

I am trying to build a better understanding of quadratic functions. So I had this idea of trying to fit a quadratic function to two arbitrary points, but I am not sure how this really works.

Given the points (-4,1) and (12,1) on a Cartesian plane, how can a quadratic function be defined whose graph passes through these points?

This is what I managed so far.

\(\displaystyle f(x) = (x + 4)(x - 12)+1\)

\(\displaystyle f(x) = x^2-8x-47\)

I am not sure why I did that. But that's definitely a function whose graph passes though the points. I seem to recall some kind of formula to find the function rule based on two zero points. To that, I added the constant 1, because my graph needs to intersect \(\displaystyle g(x)=1\) instead of the "zero" point along the x-axis as in \(\displaystyle h(x)=0\).

Can someone explain this to me? Why is this working? What is the formula for this, if there is any?

This is only one of several possible quadratic functions whose graph passes through these two points. How can I define additional functions that pass through the same two points?
 
Mathematics news on Phys.org
  • #2
What you're doing is called "interpolation". In your case, you're doing exact interpolation, where your model function (in your case, a quadratic) actually goes through all your data points. The general quadratic is $ax^2+bx+c$, with three unknowns, $a,b,c$. You can think of your data points as "information" that can help you to determine the unknowns. But in your case, you have fewer data points than you have unknowns. This means, as you've indicated, that you can have infinitely many quadratics fit through only two data points. However, throw in another data point, and you'll almost certainly nail down the last unknown (so there would only be one quadratic, in general, through three data points). How could you find them? By taking the general equation $y=ax^2+bx+c$, and plugging in your data points to get a simultaneous system of equations. With your two data points, you would have the system
\begin{align*}
1&=a(-4)^2+b(-4)+c \\
1&=a(12)^2+b(12)+c.
\end{align*}
You can solve this, but you'll find a parametric solution - that is, infinitely many solutions.

Alternatively, you can notice that, for your base solution to the problem, if you multiply the first term by an arbitrary constant, you can generate infinitely many solutions:
$$y=a(x+4)(x-12)+1.$$
At the two data points, the first term still vanishes, leaving you with $y=1$. But now you can generate (it turns out, all) other solutions by choosing a particular value of $a$.

Does this answer your question?
 
  • #3
Must we know 3 points in order to exactly define a quadratic function? Not just any quadratic function, but the quadratic function whose graph passes through exactly the 3 given points? So each quadratic function is graphically defined by the graph that passes through exactly 3 points? Or maybe I should say 3 or more points? At least 3 points? At least 3 points are needed to exactly interpolate a quadratic function?

What about functions that have no constant?

In my example, the points (-4,1) and (12,1) are 1 unit above origin, 1 unit above the x axis.

So the function that passes though these points will need to have a constant C.

$y=ax^2+ax+c$

How about functions that don't have the constant term?

$y=ax^2+ax$

Such function would not be able to pass through points (-4,1) and (12,1)? Correct?

But do such functions have the constant term C? Are they simply omitted because the constant evaluates to zero?

$y=ax^2+ax=ax^2+ax+0$

If a, b and c in $ax^2+bx+c$ are the "unknowns", then what is the x? I thought a, b and c were called coefficients.

In the statement $y=ax^2+ax$ the a is equivalent to factor 1 in $f(x) = 1 \cdot (x + 4)(x - 12)+1$?

I tried plugging in some different values for a.

$y=a(x+4)(x-12)+1$

$a=2$

$y=2(x+4)(x-12)+1$

$y=2x^2-16x-95$

$a=3$

$y=3(x+4)(x-12)+1$

$y=3x^2-24x-143$

$a=-1$

$y=-1(x+4)(x-12)+1$

$y=-x^2+8x+49$

$a=-2$

$y=-2(x+4)(x-12)+1$

$y=-2x^2+16x+97$

But for a=0 I got a constant function.

$a=0$

$y=0(x+4)(x-12)+1$

$y=0+1$

$y=1$

Is this the idea? Is this why we factorize the function? Using inverses of x coordinates, i.e. inverse of -4 and 12? I'm trying to understand where the (x+4) and (x-12) comes from, why I did that. I'm sorry if this is too many questions for one thread. If so, let me know and I will post a new thread. I'll try to figure this out on my own from here. I appreciate your help!
 
  • #4
I think I get it now! This really relates functions to equations. I modified the original problem such that my points will sit on the x axis, in other words so that any given quadratic function has the function value 0 at the given points. I even went a step further by plotting two different points.

Given the points (-4,0) and (4,0).

The function value at these points must be 0, which is stated already by the points (ordered pairs (x,y)).

This allows me to make the following statement.

$0=(x+4)(x-4)$

$0=x^2-4^2$

$0=x^2-16$

$f(x)=x^2-16$

I believe this is called zero product property?

By adding the inverse of -4 to -4 I can get the product 0. By adding the inverse of 4 to 4 I can get the product 0. If anyone factor is 0, then the product is also 0.

This even works for three points along the same horizontal line.

Given the points (-4,0); (2,0) and (4,0).

$0=(x+4)(x-2)(x-4)$

$0=x^3-2x^2-16x+32$

$x^3-2x^2-16x+32$

$g(x)=x^3-2x^2-16x+32$

This is a cubic function, and it's only one of many that can pass through the three points. Correct? To get the exact interpolation of a cubic function one would need at least 4 points? Correct? Can we claim that the number of points needed for exact interpolation of polynomial functions is d+1 where d is the degree of the polynomial?

What I need to figure out is what happens when the function value is 1.

Given the points (-4,1) and (12,1) define a quadratic function whose graph passes through these points.

And this is done by solving the system of following two equations.

$\begin{align*}
1&=a(-4)^2+b(-4)+c \\
1&=a(12)^2+b(12)+c.
\end{align*}$

However, because this needs to be a quadratic function, which is of second degree, we need at least 3 points to interpolate exactly one function. But because we are missing the third point, the solution to this system will be a parametric solution, i.e. infinitely many quadratic functions?

Did I get that right now?

I haven't studied parametric solutions yet, so that's really out of my league right now. But I appreciate that you mention it so I can at least become familiar with the terminology. Besides, I was not really looking to exactly interpolate one single quadratic function. (Again, thanks for using the right terminology.) I was only looking for ways to define arbitrary quadratic functions that pass through my points of interest.
 
Last edited:
  • #5
I understand now why a, b, and c in $ax^2+bx+c$ are the "unknowns".

\begin{align*}
1&=a(-4)^2+b(-4)+c \\
1&=a(12)^2+b(12)+c.
\end{align*}

The x and y from each point need to be plugged into the general formula for the quadratic function. What is left then are the unknown coefficients.

I also understand that I can use the zero product property, not only for 0 function values, but also for 1 function values by adding a 1 to both sides of the equality.

Given the points (-4,0) and (12,0), the way to define a function that passes through these points is...

$0=(x+4)(x-12)$

Because $(x+4)$ with $x=-4$ gives $(-4+4)=0$ and because $(-4+4)=0$, then $(x+4)(x-12)=0$.

Expanding the expression we get:

$0=x^2-8x-48$

Given the points (-4,1) and (12,1), the way to define a function that passes through these points is...

The same as $0=(x+4)(x-12)$ but we add a 1 to both sides.

$0+1=(x+4)(x-12)+1$

$1=(x+4)(x-12)+1$

Expanding the expression we get:

$1=x^2-8x-47$

I believe this only works when both points are on the same horizontal line, that is when they have the same function or y value, which in these examples was either 0 or 1.

The general formula for this can be described as:

For the points

$(x_{1},y_{1})$

$(x_{2},y_{1})$

we have

$y_{1}=(-(x_{1})--(x_{1}))(-(x_{2})--(x_{2}))+y_{1}$

I have put in the negative sign just to get the inverse of each x coordinate, so that the difference of the two inverses will evaluate to zero. This should also work for more than two points.

$(x_{1},y_{1})$

$(x_{2},y_{1})$

$...$

$(x_{n},y_{1})$

But it will not work if the points have different function or y value.
 

FAQ: How to fit a quadratic function to two points?

What is a quadratic function?

A quadratic function is a polynomial function with a degree of 2. It can be written in the form f(x) = ax^2 + bx + c, where a, b, and c are constants and x is the independent variable.

How do you find the equation of a quadratic function given two points?

To find the equation of a quadratic function, you need to substitute the x and y coordinates of the two points into the general form of a quadratic function (f(x) = ax^2 + bx + c). This will result in a system of two equations with three unknowns (a, b, and c). Solve the system of equations to find the values of the constants and plug them back into the general form to get the equation of the quadratic function.

Can two points determine a unique quadratic function?

No, two points can only determine a quadratic function up to a constant multiple. This means that the values of a, b, and c in the general form of a quadratic function (f(x) = ax^2 + bx + c) may be different for different quadratic functions that pass through the two points.

What is the significance of fitting a quadratic function to two points?

Fitting a quadratic function to two points allows you to find a mathematical model that can accurately represent a set of data points. This can be useful in making predictions and understanding patterns in the data.

Can a quadratic function be fit to more than two points?

Yes, a quadratic function can be fit to any number of points, as long as the number of points is greater than or equal to 3. However, as the number of points increases, the accuracy of the fit may decrease.

Similar threads

Replies
6
Views
1K
Replies
2
Views
1K
Replies
6
Views
2K
Replies
4
Views
2K
Replies
1
Views
1K
Replies
5
Views
1K
Replies
2
Views
1K
Replies
6
Views
2K
Back
Top