Solution

Two points on the axis

Using GeoGebra, plot two points \(A\) and \(B\) on the \(x\)-axis of a graph. Can you instruct GeoGebra to draw a quadratic which passes through both of them?

Here is a solution:

We want the quadratic to pass through \(A\) and \(B\) on the \(x\)-axis. If we write the coordinates of these points as \(A=(a,0)\) and \(B=(b,0)\), we see that the roots of the quadratic must be \(a\) and \(b\).

A quadratic which has these roots is \(y=(x-a)(x-b)\), so this is what we need.

To draw this in GeoGebra, we need to work out \(a\) and \(b\). We can do this by typing:

a = x(A)
b = x(B)
y = (x-a)(x-b)

or all in one go as:

y = (x-x(A))(x-x(B))

Taking it further

Developing this idea further, add a point \(C\) to the \(y\)-axis. Can you make your quadratic pass through \(A\), \(B\) and \(C\), like this?

Here is a solution:

In the first part of this problem, we found that one quadratic which passes through \(A\) and \(B\) has equation \(y=(x-a)(x-b)\).

We could expand this to get \(y=x^2-(a+b)x+ab\), and we see that the coefficient of \(x^2\) is \(1\).

There was no need for us to make this choice, though: we could choose any (non-zero) coefficient for \(x^2\). So we could equally well have used \(y=k(x-a)(x-b)\) as our equation, as this also passes through \(A\) and \(B\) on the \(x\)-axis.

This new quadratic crosses the \(y\)-axis where \(x=0\); substituting in \(x=0\) shows that the intercept is at \((0,kab)\). As we want it to cross the \(y\)-axis at \(C(0,c)\), we choose \(k\) so that \[kab=c.\] This can easily be rearranged to get \(k=\dfrac{c}{ab}\).

We can therefore specify the whole quadratic to GeoGebra as

y = y(C)/(x(A)*x(B)) * (x-x(A))(x-x(B))

We are assuming here that \(ab\ne0\). If \(ab=0\), this means that either \(A\) or \(B\) lies at the origin, and it is not going to be possible for the quadratic to then pass through both \(A\) and \(B\) along with \(C\).

The one exception is if \(C\) also lies at the origin. In this case, we have \(k=0/0\), which is not defined. And geometrically, in this situation, we are only specifying where the quadratic crosses the \(x\)-axis, so there are many possibilities for the quadratic.


One point as the vertex

On a new graph, plot a point \(A\). Can you instruct GeoGebra to draw a quadratic which has its vertex at \(A\)?

Here is a solution:

Since we are thinking about the vertex of the quadratic, it makes most sense to work with the completed square form of the quadratic: \[y=(x-a)^2+c.\] This has its vertex at \((a,c)\).

So if we write the coordinates of point \(A\) as \((a_1, a_2)\), our quadratic could be \[y=(x-a_1)^2+a_2.\]

In GeoGebra terms, we can type this in as either:

a1 = x(A)
a2 = y(A)
y=(x-a1)^2+a2

or all in one go as

y=(x-x(A))^2+y(A)

Taking it further

Developing this idea further, add a point \(B\) to the \(y\)-axis. Can you make your quadratic have its vertex at \(A\) and pass through \(B\), like this?

Here is a solution:

In the first part of this problem, we found that one quadratic which passes through \(A\) has equation \(y=(x-a_1)^2+a_2\).

As we noted in the “taking it further” part of question 1 above, there was no need for us to make the coefficient of \(x^2\) equal to \(1\). We could equally well have used \[y=k(x-a_1)^2+a_2\] for any choice of \(k\), for this also has its vertex at \(A(a_1,a_2)\).

This new quadratic crosses the \(y\)-axis where \(x=0\), so at \((0,ka_1^2+a_2)\). As we want it to cross the \(y\)-axis at \(B(0,b_2)\) (where \(B\) has coordinates \((0,b_2)\), we will choose \(k\) so that \[ka_1^2+a_2=b_2.\] This can easily be rearranged to get \(k=\dfrac{b_2-a_2}{a_1^2}\).

We can specify this to GeoGebra all in one go as

y = (y(B)-y(A))/(x(A)^2) * (x-x(A))^2 + y(A)

As in question 1, we are assuming that \(a_1\ne0\). What would happen if \(a_1=0\)?


Any three points

The final (very hard) challenge: plot three points \(A\), \(B\) and \(C\) anywhere on the graph, and draw a quadratic passing through these three points, like this:

Here is a solution:

We write \(A(a_1,a_2)\), \(B(b_1,b_2)\) and \(C(c_1,c_2)\) as in the suggestion.

We take our quadratic to be \(y=px^2+qx+r\) (using \(p\), \(q\) and \(r\) instead of the usual \(a\), \(b\) and \(c\) to avoid confusion). Since the quadratic must pass through the points \(A\), \(B\) and \(C\), we can write down three simultaneous equations for \(p\), \(q\) and \(r\): \[\begin{align} a_2 &= pa_1^2 + qa_1 + r\label{eq:1}\\ b_2 &= pb_1^2 + qb_1 + r\label{eq:2}\\ c_2 &= pc_1^2 + qc_1 + r.\label{eq:3} \end{align}\] If we subtract equation \(\eqref{eq:3}\) from equations \(\eqref{eq:1}\) and \(\eqref{eq:2}\), we get \[\begin{align} a_2-c_2 &= p(a_1^2-c_1^2) + q(a_1-c_1)\label{eq:4}\\ b_2-c_2 &= p(b_1^2-c_1^2) + q(b_1-c_1)\label{eq:5} \end{align}\]

which are two simultaneous equations for the two unknowns \(p\) and \(q\).

We can make the coefficients of \(q\) the same by multiplying \(\eqref{eq:4}\) by \(b_1-c_1\) and \(\eqref{eq:5}\) by \((a_1-c_1)\), and then subtracting to get \[(a_2-c_2)(b_1-c_1)-(b_2-c_2)(a_1-c_1) =p\bigl((a_1^2-c_1^2)(b_1-c_1)-(b_1^2-c_1^2)(a_1-c_1)\bigr)\] and so \[p=\frac{(a_2-c_2)(b_1-c_1)-(b_2-c_2)(a_1-c_1)} {(a_1^2-c_1^2)(b_1-c_1)-(b_1^2-c_1^2)(a_1-c_1)}.\]

Rather than trying to substitute this into \(\eqref{eq:4}\) or \(\eqref{eq:5}\) to find \(q\), we can start again: multiplying \(\eqref{eq:4}\) by \((b_1^2-c_1^2)\) and \(\eqref{eq:5}\) by \((a_1^2-c_1^2)\) and subtracting gives \[(a_2-c_2)(b_1^2-c_1^2)-(b_2-c_2)(a_1^2-c_1^2) =q\bigl((a_1-c_1)(b_1^2-c_1^2)-(b_1-c_1)(a_1^2-c_1^2)\bigr)\] so that \[\begin{align*} q&{}=\frac{(a_2-c_2)(b_1^2-c_1^2)-(b_2-c_2)(a_1^2-c_1^2)} {(a_1-c_1)(b_1^2-c_1^2)-(b_1-c_1)(a_1^2-c_1^2)}\\ &{}=\frac{(b_2-c_2)(a_1^2-c_1^2)-(a_2-c_2)(b_1^2-c_1^2)} {(a_1^2-c_1^2)(b_1-c_1)-(b_1^2-c_1^2)(a_1-c_1)}, \end{align*}\]

where we have negated the top and bottom of the final answer to make the denominator the same as for \(p\).

Finally, we substitute this into \(\eqref{eq:1}\) to get \(r=a_2-pa_1^2-qa_1\), so in full, \[\begin{align*} r=a_2 &{}-\frac{a_1^2\bigl((a_2-c_2)(b_1-c_1)-(b_2-c_2)(a_1-c_1)\bigr)} {(a_1^2-c_1^2)(b_1-c_1)-(b_1^2-c_1^2)(a_1-c_1)}\\ &{}-\frac{a_1\bigl((b_2-c_2)(a_1^2-c_1^2)-(a_2-c_2)(b_1^2-c_1^2)\bigr)} {(a_1^2-c_1^2)(b_1-c_1)-(b_1^2-c_1^2)(a_1-c_1)}. \end{align*}\]

This is a bit of a mouthful. It can be entered into GeoGebra, perhaps most easily by working out the common denominator first:

d=(x(A)^2-x(C)^2)(x(B)-x(C))-(x(B)^2-x(C)^2)(x(A)-x(C))
p=((y(A)-y(C))(x(B)-x(C))-(y(B)-y(C))(x(A)-x(C)))/d
q=((y(B)-y(C))(x(A)^2-x(C)^2)-(y(A)-y(C))(x(B)^2-x(C)^2))/d
r=y(A)-p*x(A)^2-q*x(A)
y=p*x^2+q*x+r

While this gives a correct answer, it does not give any idea of what is really going on. It is also not “symmetric”: the roles of \(A\), \(B\) and \(C\) are identical in the problem, though the formula we’ve ended up with does not look symmetrical at all.

The second approach gives much more insight into what is going on here.

The suggestion asked:

Can you find a quadratic which passes through \(A(a_1,a_2)\) and intercepts the \(x\)-axis at \((b_1,0)\) and \((c_1,0)\)?

What other two similar quadratics can you find?

How can you combine these to solve the problem?

We can use the idea from the extension to question 1 above to find such a quadratic. As it passes through \((b_1,0)\) and \((c_1,0)\), it must have the form \(y=k(x-b_1)(x-c_1)\). Since it also passes through \((a_1,a_2)\), it must satisfy \[a_2=k(a_1-b_1)(a_1-c_1)\] so that \(k=a_2/(a_1-b_1)(a_1-c_1)\), giving \[y=\frac{(x-b_1)(x-c_1)}{(a_1-b_1)(a_1-c_1)}a_2.\]

Likewise, a quadratic which passes through \(B\) and intercepts the \(x\)-axis at \((c_1,0)\) and \((a_1,0)\) is \[y=\frac{(x-c_1)(x-a_1)}{(b_1-c_1)(b_1-a_1)}b_2,\] and one which passes through \(C\) and intercepts the \(x\)-axis at \((a_1,0)\) and \((b_1,0)\) is \[y=\frac{(x-a_1)(x-b_1)}{(c_1-a_1)(c_1-b_1)}c_2.\]

If we add these three quadratics together, we get a quadratic which passes through \(A\), \(B\) and \(C\). For example, when \(x=a_1\), the first quadratic evaluates to \(a_2\), while the second and third evealuate to \(0\): the sum is therefore \(a_2\), so the quadratic passes through \(A\). Likewise, it passes through \(B\) and \(C\).

So an alternative way of expressing the equation of the quadratic through \(A\), \(B\) and \(C\) is \[y=\frac{(x-b_1)(x-c_1)}{(a_1-b_1)(a_1-c_1)}a_2+ \frac{(x-c_1)(x-a_1)}{(b_1-c_1)(b_1-a_1)}b_2+ \frac{(x-a_1)(x-b_1)}{(c_1-a_1)(c_1-b_1)}c_2.\]

We can enter this in GeoGebra (all on one line) as

y=(x-x(B))(x-x(C))/((x(A)-x(B))(x(A)-x(C)))*y(A)+
(x-x(C))(x-x(A))/((x(B)-x(C))(x(B)-x(A)))*y(B)+
(x-x(A))(x-x(B))/((x(C)-x(A))(x(C)-x(B)))*y(C)

This formula shows the symmetry of the answer.

The technique we have used here is known as the Lagrange Interpolating Polynomial. The formula was first published by Waring in 1779, rediscovered by Euler in 1783, and published again by Lagrange in 1795.

Can you see how the same idea could be used to fit a cubic through 4 points, or a quartic (degree 4 polynomial) through 5 points, and so on?

Is there more than one quadratic you could draw?

We see from the straightforward approach that the three points give us three simultaneous linear equations in three unknowns (\(p\), \(q\) and \(r\)). These equations will have a unique solution (which we found), so there is only one possible quadratic.

The only exception to this will be if two or more of \(A\), \(B\) and \(C\) share the same \(x\)-coordinate, in which case there may be no possible quadratics (if they have different \(y\)-coordinates) or infinitely many possible quadratics (if they are the same point).